Skip to content

[TIRx][CUDA] Version-gate CUDA 12.8 tensor-map enums and fix registry-test lock leak - #20154

Open
spectrometerHBH wants to merge 2 commits into
apache:mainfrom
spectrometerHBH:fix-tensor-map-guards
Open

[TIRx][CUDA] Version-gate CUDA 12.8 tensor-map enums and fix registry-test lock leak#20154
spectrometerHBH wants to merge 2 commits into
apache:mainfrom
spectrometerHBH:fix-tensor-map-guards

Conversation

@spectrometerHBH

Copy link
Copy Markdown
Contributor

Two independent fixes found while running the TIRx kernel registry correctness suite on sm100.

Version-gate the CUDA 12.8 tensor-map enums. CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B and the other CUDA 12.8 additions are enumerators, not macros, so every #ifdef guard around them in cuda_device_api.cc was always false: the swizzle/dtype variants they gate were unconditionally rejected, and requesting a 128B_ATOM_32B swizzle failed host validation with Unsupported swizzle enum value: 4 even on CUDA 13.2. The guards are now CUDA_VERSION >= 12080 checks, and the dead guards around the base-enum TFLOAT32/FLOAT32_FTZ members (present wherever the tensor-map API exists) are dropped.

Harden the registry-test GPU locking. The per-device flock release ran after torch.cuda.empty_cache() in the same finally; when a kernel fault poisons the CUDA context, empty_cache() raises, and pytest's saved traceback keeps the frame (and the lock file descriptors) alive — the held flock never releases, and the same worker deadlocks against itself when its next test reopens the lock file. The release now sits in a nested finally. Also skip sm100_fp8_fp4_mega_moe in this suite: its dedicated multi-process scheduler validates physical-device assignments that reject any process already owning a CUDA context, which every process in this suite has by the time the free-memory probe has run.

Verified on sm100: the two gdn_cp_prefill_sm100 configs that requested the 128B_ATOM_32B swizzle now pass, the MegaMoE configs skip, and the previously deadlocking registry suite completes.

…fdef

CU_TENSOR_MAP_SWIZZLE_128B_ATOM_32B and friends are enumerators, not
macros, so every #ifdef guard around them was always false and the
features they gate were unconditionally rejected -- requesting the
128B_ATOM_32B swizzle failed host validation with "Unsupported swizzle
enum value: 4" even on CUDA 13.2. Use CUDA_VERSION >= 12080 checks for
the CUDA 12.8 additions and drop the dead guards around the base-enum
TFLOAT32/FLOAT32_FTZ members, which exist wherever the tensor-map API
does.
… MegaMoE

Release the per-device flocks in a nested finally so a poisoned CUDA
context (empty_cache raising after a kernel fault) cannot leak a held
lock: pytest keeps the failure's traceback frame alive, so the leaked
lock's fd never closes and the worker deadlocks against itself when its
next test reopens the same lock file.

Skip sm100_fp8_fp4_mega_moe here: its dedicated multi-process scheduler
validates physical-device assignments that reject any process already
owning a CUDA context, which every process in this suite does (the
free-memory probe alone creates one).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants