Skip to content

test: gate the remaining Marlin nodes on NVIDIA rather than CUDA (#6426 follow-up) - #6439

Merged
Qubitium merged 1 commit into
mainfrom
fix/rocm-marlin-gates
Nov 29, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/rocm-marlin-gates

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Follow-up to #6426 (merged as e3ceb7b38). 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 utils/marlin.py raises ValueError: 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.py and #6279 fixed one more. These three were left behind.

The three nodes

file node why it needs NVIDIA
tests/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
tests/test_openai_server_lifecycle.py test_gpu_memory_does_not_grow_across_serve_cycles loads with backend=BACKEND.MARLIN
tests/models/test_llama3_2_fusion.py test_llama32_1b_fusion_save_reload[gptq-…] asserts AUTO selects MarlinLinear / AwqMarlinLinear

The 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 of tests/accelerator_gates.py.

Change

Use the documented requires_nvidia_cuda() predicate, matching #6426 and #6279. On an NVIDIA build the predicate is True, 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_cpu and test_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 through BACKEND.GPTQ_TORCH).

Status matrix

Simulated HIP = torch.version.hip patched before import gptqmodel, because gptqmodel.utils.rocm.IS_ROCM is computed at import time. GPU work on one pinned RTX 4090 (CUDA_DEVICE_ORDER=PCI_BUS_ID, verified SM 8.9).

file host before after
test_hf_bridge_legacy_qzeros_marlin_6274.py simulated HIP 1 failed, 5 passed 5 passed, 1 skipped
NVIDIA 4090 6 passed 6 passed
CPU 3 passed, 3 skipped 3 passed, 3 skipped
test_openai_server_lifecycle.py simulated HIP 1 failed, 6 passed 6 passed, 1 skipped
NVIDIA 4090 7 passed 7 passed
CPU 6 passed, 1 skipped 6 passed, 1 skipped
models/test_llama3_2_fusion.py simulated HIP 1 failed (kernel assertion), 2 Triton-sim failures, 1 skipped 2 skipped, 2 Triton-sim failures
NVIDIA 4090 3 passed, 1 skipped 3 passed, 1 skipped

The two remaining models/test_llama3_2_fusion.py failures under simulated HIP are not gate defects: they fail inside triton/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:

# simulated HIP
cd <clone>/tests && CUDA_VISIBLE_DEVICES=1 \
  PYTHONPATH=<clone>:<clone>/tests \
  /root/venv/bin/python <hiprun.py> <file> -q --tb=line -p no:cacheprovider

# NVIDIA
cd <clone>/tests && CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES=0 \
  PYTHONPATH=<clone>:<clone>/tests \
  /root/venv/bin/python -m pytest <file> -q -rs -p no:cacheprovider

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:

node injected break result on NVIDIA
…loads_on_the_auto_marlin_kernel device map {"": 0} → {"": "cpu"} FAILED
test_gpu_memory_does_not_grow_across_serve_cycles growth_mib < 64 → < -1.0 FAILED (VRAM grew by 0.0 MiB)
test_llama32_1b_fusion_save_reload[gptq] backend forced to BACKEND.TORCH FAILED ({'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 assert device.type == "cuda", which is true on ROCm. It passes 13/13 on NVIDIA; its 4 simulated-HIP failures are all in triton/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 plain main (dynamic-exclusion regex mismatch); unrelated and pre-existing.

Regression check (CPU)

tests/test_hf_bridge_legacy_qzeros_marlin_6274.py
tests/test_hf_bridge_cpu_offload_5022.py
tests/test_checkpoint_interop_4053.py
tests/test_openai_server_lifecycle.py
tests/models/test_llama3_2_fusion.py
tests/module_tree/test_fusable_models.py
tests/test_rocm_backend_gating.py
→ 169 passed, 480 skipped, 0 failed

ruff check clean on all three changed files.

Caveat

ROCm was simulated by patching torch.version.hip before importing gptqmodel, on an NVIDIA host — not on AMD hardware. That faithfully exercises gptqmodel's IS_ROCM branches (which is where all three defects live) but cannot exercise real AMD Triton kernels; as noted above, that limitation is why the two test_llama3_2_fusion.py Triton failures were classified as artifacts rather than fixed.

…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).
@Qubitium
Qubitium marked this pull request as ready for review November 29, 2026 20:06
@Qubitium
Qubitium merged commit 56a4275 into main Nov 29, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/rocm-marlin-gates branch November 29, 2026 20:06
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.

1 participant