Repository navigation
Do not crash on a short GPU UUID in the CuPy backend - #431
Open
kjwierenga wants to merge 1 commit into
Open
kjwierenga wants to merge 1 commit into
kjwierenga wants to merge 1 commit into
Conversation
CuPy returns `props["uuid"]` as `bytes` that stops at the first zero byte (cupy/cupy#10522). For a UUID with a zero byte, the value has less than 16 bytes. `uuid.UUID(bytes=...)` then raises `ValueError: bytes is not a 16-char string`, and the backend cannot start. An A100 with the UUID `1eed7047-720e-7d2e-4561-4205587600d0` shows this. Use `None` for a value of the wrong length, as KernelTuner#427 does for HIP. Padding with zeros would give a wrong UUID. The code that reads `env["uuid"]` accepts `None`. The test uses a fake `cupy` module, so it runs without a GPU. It fails without the fix. Co-authored with Claude Code. I've reviewed the result and take full responsibility.
|
kjwierenga
marked this pull request as ready for review
December 2, 2026 15:04
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #430.
CuPy returns the GPU UUID as
bytesthat stops at the first zero byte (cupy/cupy#10522). For a UUID with a zero byte, the value has less than 16 bytes. Thenuuid.UUID(bytes=...)raisesValueError: bytes is not a 16-char string, and the backend cannot start. I found this on an A100 in MIG mode, where the UUID is1eed7047-720e-7d2e-4561-4205587600d0.I set the UUID to
Nonefor a value that is not 16 bytes long, as #427 does for HIP. No point in padding the value with zeros, that would be wrong. The code that readsenv["uuid"]already acceptsNone.The CuPy fix is in cupy/cupy#10523. Until a CuPy release has it, this change is needed.
The new test uses a fake
cupymodule, so it runs without a GPU. It fails without this change. I did not run the full CuPy tuning tests on a GPU with this branch. I did not checknvcuda.py, which has the same code pattern.Although this PR was co-authored with Claude Code, I have carefully steered and checked the result, and I take full responsibility for any issues.