Repository navigation
test: gate the remaining Marlin nodes on NVIDIA rather than CUDA (#6426 follow-up) - #6439
Merged
Merged
Conversation
…w-up) `torch.cuda.is_available()` is true on ROCm because HIP reuses the CUDA device namespace, so a `skipif(not torch.cuda.is_available())` marker lets a Marlin-only test run. There is no ROCm Marlin kernel, so the load raises `ValueError: Marlin kernel is not supported on ROCm.` -- a failure where a skip is correct. #6426 fixed two nodes in `test_hf_bridge_cpu_offload_5022.py` and #6279 fixed one more; these three were left behind: - `test_hf_bridge_legacy_qzeros_marlin_6274.py`: `test_legacy_symmetric_checkpoint_loads_on_the_auto_marlin_kernel` loads with `{"": 0}` and asserts the selected kernel is `MarlinLinear`, so on ROCm it fails on the assertion instead of skipping. The sibling nodes in that file are device-agnostic and keep running on ROCm. - `test_openai_server_lifecycle.py`: `test_gpu_memory_does_not_grow_across_serve_cycles` loads with `backend=BACKEND.MARLIN`, and its gate additionally read `torch.cuda.get_device_capability(0)`, which reports an unrelated numeric pair on HIP (gfx1201 -> (12, 0)) -- the anti-pattern documented in `tests/accelerator_gates.py`. - `models/test_llama3_2_fusion.py`: `test_llama32_1b_fusion_save_reload` asserts AUTO selects `MarlinLinear`/`AwqMarlinLinear`. Its sibling `test_tiny_llama_fusion_after_fresh_quantization` quantizes through `BACKEND.GPTQ_TORCH` and is device-agnostic, so only the 1B node is gated. Use the documented `requires_nvidia_cuda()` predicate, matching #6426 and #6279. On an NVIDIA build it is True, so all three nodes run exactly as before; on HIP they skip with a reason that names the requirement. Not changed, after measurement: `tests/kernels/test_asymmetric_real_models.py` already skips on ROCm via `_require_candidate_backend()` -> `validate_device()` -> `NotImplementedError`, and `tests/test_requant_embed_endpoint_5116.py` gates generic CUDA-device tests that are valid on ROCm (it passes 13/13 on NVIDIA; its simulated-HIP failures come from Triton's AMD driver, not from gptqmodel's ROCm branches).
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.
Follow-up to #6426 (merged as
e3ceb7b38).torch.cuda.is_available()isTrueon ROCm because HIP reuses the CUDA device namespace, so askipif(not torch.cuda.is_available())marker lets a Marlin-only test run. There is no ROCm Marlin kernel, soutils/marlin.pyraisesValueError: Marlin kernel is not supported on ROCm.— a failure where a skip is correct.#6426 fixed two nodes in
tests/test_hf_bridge_cpu_offload_5022.pyand #6279 fixed one more. These three were left behind.The three nodes
tests/test_hf_bridge_legacy_qzeros_marlin_6274.pytest_legacy_symmetric_checkpoint_loads_on_the_auto_marlin_kernel{"": 0}and asserts the selected kernel isMarlinLineartests/test_openai_server_lifecycle.pytest_gpu_memory_does_not_grow_across_serve_cyclesbackend=BACKEND.MARLINtests/models/test_llama3_2_fusion.pytest_llama32_1b_fusion_save_reload[gptq-…]MarlinLinear/AwqMarlinLinearThe server node also had a second problem: its gate read
torch.cuda.get_device_capability(0), which reports an unrelated numeric pair on HIP (gfx1201→(12, 0)). That is the anti-pattern documented in the module docstring oftests/accelerator_gates.py.Change
Use the documented
requires_nvidia_cuda()predicate, matching #6426 and #6279. On an NVIDIA build the predicate isTrue, so every node runs exactly as before; on HIP it skips with a reason that names the requirement.Deliberately not module-wide: the device-agnostic siblings keep their
cuda.is_available()gate so they still run on ROCm —test_legacy_symmetric_checkpoint_loads_when_auto_resolves_to_cpuandtest_matching_width_legacy_checkpoint_loads_on_cpu_offload(all-CPU reselect paths) — verified running and passing under simulated HIP;test_tiny_llama_fusion_after_fresh_quantization(quantizes throughBACKEND.GPTQ_TORCH).Status matrix
Simulated HIP =
torch.version.hippatched beforeimport gptqmodel, becausegptqmodel.utils.rocm.IS_ROCMis computed at import time. GPU work on one pinned RTX 4090 (CUDA_DEVICE_ORDER=PCI_BUS_ID, verified SM 8.9).test_hf_bridge_legacy_qzeros_marlin_6274.pytest_openai_server_lifecycle.pymodels/test_llama3_2_fusion.pyThe two remaining
models/test_llama3_2_fusion.pyfailures under simulated HIP are not gate defects: they fail insidetriton/backends/amd/driver.py(Pointer argument … cannot be accessed from Triton) because the simulation makes Triton select the AMD backend on NVIDIA hardware. The same two nodes pass on NVIDIA, and the same file passes 3/3 there.Baseline before/after commands:
Non-vacuity
Each fixed node still fails (rather than skipping) on NVIDIA when the thing it asserts is broken — done on scratch copies of the test files in a throwaway worktree, with the real worktree untouched:
…loads_on_the_auto_marlin_kernel{"": 0}→{"": "cpu"}test_gpu_memory_does_not_grow_across_serve_cyclesgrowth_mib < 64→< -1.0VRAM grew by 0.0 MiB)test_llama32_1b_fusion_save_reload[gptq]backendforced toBACKEND.TORCH{'TorchLinear'} == {'MarlinLinear'})Files checked and deliberately left alone
tests/kernels/test_asymmetric_real_models.py— already correct. All 6 nodes skip on ROCm through_require_candidate_backend()→candidate_cls.validate_device()→NotImplementedError. Under simulated HIP:6 skipped, 0 failed.tests/test_requant_embed_endpoint_5116.py— not Marlin-gated. Its three CUDA-gated nodes assertdevice.type == "cuda", which is true on ROCm. It passes 13/13 on NVIDIA; its 4 simulated-HIP failures are all intriton/backends/amd/driver.py, i.e. simulation artifacts, not gptqmodel ROCm branches. Adding an NVIDIA gate here would lose real ROCm coverage.kernels/test_awq.py,kernels/test_gptq.py,test_post_quant_eora.py,models/test_llama3_2_dynamic_skip_layer_replay.py,module_tree/test_fusion_device_inference.py— 0 failures attributable to ROCm branching under simulated HIP (only Triton-AMD artifacts).models/test_llama3_2_gptq_protocol.py— fails identically on plainmain(dynamic-exclusion regex mismatch); unrelated and pre-existing.Regression check (CPU)
ruff checkclean on all three changed files.Caveat
ROCm was simulated by patching
torch.version.hipbefore importing gptqmodel, on an NVIDIA host — not on AMD hardware. That faithfully exercises gptqmodel'sIS_ROCMbranches (which is where all three defects live) but cannot exercise real AMD Triton kernels; as noted above, that limitation is why the twotest_llama3_2_fusion.pyTriton failures were classified as artifacts rather than fixed.