Skip to content

[TEST] ROCm (R9700/gfx1201) suite triage at b225a4383: ~80 tests drive CUDA-only kernels without a HIP skip, CUDA-capability fakes that cannot apply on ROCm, stale HIP-only expectations #4770

Closed

Description

@Qubitium

Found on main @ b225a43, Radeon AI PRO R9700 (gfx1201), ROCm 10.1, torch 2.16.0.dev+rocm10.1, Python 3.14t (one card via ROCR_VISIBLE_DEVICES). These are the ROCm-only failures from a file-by-file run of tests/ (excluding tests/models). Failures shared with CUDA are in #4764 (this round's regressions) and #4769 (pre-existing). Each ROCm failure below was re-run 3x in isolation and failed 3/3 unless marked.

1. Missing ROCm skip: the test drives a CUDA-only kernel on ROCm

The library correctly refuses, with an explicit "CUDA-only ... use X on ROCm" error. The tests are gated only on torch.cuda.is_available(), which is true on ROCm.

test (count) error
kernels/test_awq_native_eval_autograd.py::test_awq_native_eval_preserves_requested_gradients[input,bias] (2) The native AWQ JIT extension is CUDA-only and cannot be built by hipcc
kernels/test_static_cache_compile_4669.py::test_static_cache_does_not_compile_a_graph_breaking_kernel (1, new this round) Marlin kernel is not supported on ROCm.
test_marlin_scratch_cuda.py (62) require_dtype() calls pytest.fail(marlin_runtime_error(dtype)); it should pytest.skip when torch.version.hip
test_marlin_device_profile.py (6), test_marlin_g_idx.py::test_marlin_decodes_noncontiguous_g_idx, test_q4_marlin.py (10), test_lora.py::{test_load_0_marlin,test_evalution_from_path}, test_gptaq.py::TestQwen2_5_GPTAQ::test_qwen2_5, test_dynamic.py::TestDynamic::test_dynamic_bits_2_marlin, test_inference_speed.py (marlin cases) Marlin kernel is not supported on ROCm. / Marlin device profile requires CUDA.
test_asymmetric_real_model_gates.py::test_generation_propagates_extension_build_failure[awq_marlin,awq_machete,gptq_machete] (3) ... only supports [DEVICE.CUDA]
test_kernel_audit_regressions.py::{test_awq_gemm_validation_matches_native_width_and_group_contract, test_machete_validation_checks_extension_availability} (2) expects ImportError, gets NotImplementedError('Machete ... is CUDA-only ...')
test_hf_packing_api.py::test_gpu_feasibility_and_best_format hf_check_packing_feasibility(..., backend=BACKEND.MARLIN, device='cuda:0') returns False on ROCm (correct)
test_model.py::TestModelSave::test_moe TorchLinear() is not an instance of MarlinLinear (AUTO correctly picks a portable kernel on ROCm)
test_q4_exllama_v2.py (3), test_eval_runtime.py::test_eval_path, test_packable.py (3 exllama cases), test_serialization.py (3) ExLlamaV2 GPTQ is CUDA-only: ROCm support is disabled ...
test_bits.py::TestBits::test_bits, test_dynamic.py::TestDynamic::test_dynamic_bits_1_triton, test_save_loaded_quantized_model.py::TestSave::test_save_2_triton TritonV2Linear is CUDA-only and does not run on ROCm
test_bitblas.py (5 on ROCm) BitBLAS ... is CUDA-only; test_bitblas_validate_accepts_bf16_gptq asserts True
test_checkpoint_modules.py::test_qqq_optional_group_scales_schema, test_qqq_jit.py (2) QQQ (BACKEND.QQQ) has no ROCm kernel
test_glm5_core_cuda.py (4), test_kimi_k3_core_cuda.py (2) EXL3_EXLLAMA_V3 inference requires NVIDIA CUDA
test_exl3_wide_input.py::test_native_exl3_row_boundary_uses_expected_half_kernel[32-bc] assert ['hgemm'] == ['bc']: the native EXL3 bc branch is CUDA-only, so ROCm takes the hgemm branch
test_gptqmodel_nf12_api.py::{test_preloaded_partial_namespace_is_reused_without_a_second_load, test_require_reports_only_the_missing_operator} native NF12 kernels support NVIDIA CUDA, not ROCm (second test: regex mismatch on the same message)
test_awq_gemv_insession_4554.py::test_awq_gemv_quantize_save_and_reload_on_cpu AWQ GEMV/GEMV_FAST/LLM_AWQ kernels require the native CUDA AWQ extension (pack step)
test_awq_gemm.py, test_awq_gemv_fast.py, test_awq_llm_awq.py (reload legs) AwqGEMMLinear requires the native CUDA AWQ extension ... use BACKEND.AWQ_TORCH, or does not support device: DEVICE.ROCM

Suggested: one shared requires_nvidia_cuda marker (torch.cuda.is_available() and torch.version.hip is None) in tests/accelerator_gates.py, used by every test that names a CUDA-only backend.

2. CUDA-capability fakes that do not apply on ROCm

On ROCm, selector validation deliberately ignores the CUDA capability tuple (utils/importer.py:~161, if IS_ROCM: return None). So tests that fake get_device_capability get no grouping and no refusal:

  • test_default_device_mixed_capability_4705.py::{test_default_load_stays_inside_one_capability_group, test_explicit_mixed_placement_is_refused_with_the_remedy, test_mixed_capability_refusal_names_a_way_forward}: DID NOT RAISE ValueError / both devices returned (new this round, fix(loader): keep the default placement inside one compute-capability group (#4705) #4714);
  • test_max_memory_kernel_devices_4632.py::test_a_budget_that_names_both_cards_still_rejects_mixed_capabilities: DID NOT RAISE.

These need skipif(torch.version.hip), or a ROCm arch-based fake.

3. Stale expectations on ROCm only

  • test_allspark_awq.py::test_awq_module_export_keeps_checkpoint_layout[dtype0,dtype1] (the HIP twin of the CUDA test): assert set(pristine) == {"qweight","qzeros","scales","bias"} fails because qzeros_format was added (fix(checkpoint): refuse runtime-layout HF saves, emit AWQ snapshots, carry layout in a tensor (#4125) #4134). The CUDA copy was updated, but this file was not.
  • test_awq_clip_consistency.py::test_clip_grid_low_precision_oracle[{0,1}-32-{False,True}-dtype0-cuda], ::test_clip_grid_edge_cases[mixed_dtype-cuda], ::test_awq_clip_consistency_1_cuda (6, also red at 12c1273): fp16 clip search is compared to a sequential oracle with rtol=0, atol=0. On ROCm, fp16 reduction order differs, so 1-4 of 256 bounds pick the neighbouring grid step (max diff 0.00195). The legacy-consistency case differs by one grid step (0.293). This is a tie-break in fp16, not a wrong clip. Compare the resulting quantization error, or allow one grid step on HIP.
  • test_bench_cuda_even_d2h.py::{test_even_d2h_latency_profile, test_even_d2h_request_wall}: wall-clock thresholds tuned for CUDA, e.g. ratio=3.25, async=0.074 ms > sync=0.043 ms.
  • test_gptq_post_inverse_fallback_4400.py::test_qqq_releases_input_hessian_before_inverse_and_block_pass: peak < 3.5 * hessian_bytes fails with 5.13x (86 MB vs a 16.8 MB Hessian). It passes on CUDA. Likely rocSOLVER cholesky/inverse workspace, which the bound does not model. It needs a ROCm-specific bound, or an owner check that no extra Hessian-sized copy is live on HIP.

4. Not classified as test bugs (instability on a shared card)

These crashed in the full run while the card was shared with other sessions. The logs show expandable_segments: memory mapping failed with OOM around them:

  • test_lm_head.py::TestLmHeadQuant::test_quant_lm_head, test_quant_trust_remote.py::test_diff_batch, test_simple_quant.py: hipErrorIllegalAddress.
  • test_shared_input_hessian_dedup_real_model_e2e.py: abort, illegal address (passes on CUDA).
  • test_awq_gemm.py: NaN assert in AWQ layer-1 scales in 2 of the 4 runs whose failure reason I captured. The other 2 got past quantization. A 3-layer Llama-3.2-1B AWQ with the test's 512 C4 rows was clean 3/3 in isolation.
  • test_qqq.py::TestGroupSize::test_quant_and_inference_0 fails the same way at 12c1273 and at HEAD: HSA_STATUS_ERROR_INVALID_CODE_OBJECT during calibration (grid 4096x256). The error is sticky, so every later test in the file fails with "device kernel image is invalid". With AMD_SERIALIZE_KERNEL=3 it surfaces instead as linalg.cholesky ... not positive-definite in qqq.py:750. A 2-layer Llama-3.2-1B QQQ quantize (g=-1 and g=128) is clean, so I could not reduce it. Someone with an idle R9700 should look at it.

Environment only (ROCm venv): peft, optimum, torchvision, einops and llama-cpp-python are not installed (test_integration, test_quant_and_eora_transformers, ERNIE-VL, Nemotron-H). defuser 0.0.28 is installed (see #4769).

🤖 Generated with Claude Code

Activity

  1. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Follow-up on section 4 ("instability on a shared card"), re-checked on main @ dba142d, one idle R9700 (gfx1201), nothing else on the card:

    🤖 Generated with Claude Code

  2. Qubitium commented on Nov 17, 2026

    @Qubitium
    CollaboratorAuthor

    Round-17 ROCm re-triage at main @ 3867c82 (R9700 / gfx1201, ROCm 10.1, torch 2.16, py3.14t, card selected with ROCR_VISIBLE_DEVICES). Each item below failed in the full run and again 2-3 times when run alone.

    Still red, unchanged from the issue body: every section-1 item (test_awq_native_eval_autograd, test_static_cache_compile_4669, test_marlin_scratch_cuda (70 now, was 62), test_asymmetric_real_model_gates (3), test_kernel_audit_regressions AWQ/Machete (2), test_bitblas, test_qqq_jit, test_checkpoint_modules::test_qqq_optional_group_scales_schema, test_gptqmodel_nf12_api (2), test_exl3_wide_input[32-bc], test_awq_gemv_insession_4554, ...), both section-2 files (test_default_device_mixed_capability_4705 (3), test_max_memory_kernel_devices_4632), and section 3 (test_allspark_awq (2), test_awq_clip_consistency (6), test_gptq_post_inverse_fallback_4400 QQQ 5.13x).

    New ROCm-only red tests since b225a43, same classes as this issue:

    1. Missing HIP skip, CUDA-only kernel forced:
      • test_glm5_core_cuda.py::test_native_mcg_wrapper_matches_serialized_bf16_linear[*-dtype1-*] (4) and test_kimi_k3_core_cuda.py::test_padded_native_and_reconstruct_wrapper_inference[*-dtype1] (2): EXL3_EXLLAMA_V3 inference requires NVIDIA CUDA, but the module is on rocm. The bf16 cases passed at b225a43 only because bf16 used to fall back to torch reconstruction. Since 55b267b (perf(exl3): keep bf16 activations on the native fp16 kernels (#4767) #4817, bisected on this card) bf16 also goes to the native kernel. This is not a user-facing regression: a real Llama-3.2-1B-Instruct-EXL3-W4 loaded with AUTO on ROCm selects ExllamaV3TorchLinear in bf16 and in fp16 and generates " Paris. The Eiff". The tests need skipif(torch.version.hip) for the whole file, not just the fp16 cases.
      • test_awq_gemv_insession_4554.py::test_awq_gemv_fast_quantize_save_and_reload_on_cpu[gemv_fast, llm_awq]: new parameters that fail with the same require the native CUDA AWQ extension error as the listed GEMV case.
      • test_moe_config.py::TestMoEConfig::{test_moe_routing_bypass, test_moe_routing_bypass_batch_size, test_moe_routing_override} (3): experts.10.gate_proj exists but is MarlinLinear (got TorchLinear). Line 153 hard-codes MarlinLinear as the expected quantized class, so on ROCm, where AUTO correctly picks a portable kernel, it fails. (At b225a43 this file timed out at 600 s on ROCm, so it was never seen.) Compare against BaseQuantLinear or the selected kernel instead.
    2. CUDA-capability fakes that do not apply on ROCm (section 2): test_default_device_capability_group_map_4734.py (new file, 3/3): test_one_gpu_per_capability_maps_only_the_first_group, test_a_group_with_two_devices_maps_to_exactly_those (assert 3 == 2), test_an_explicit_mixed_span_is_still_refused (DID NOT RAISE).
    3. HIP JIT cache key: four test_torch_ops_jit_extension.py CUDA-fingerprint tests, red since 6dffaf2 (fix(rocm): key the HIP JIT cache by the gfx target (#4815) #4826). Listed with the bisect in [TEST] Suite triage at 3867c82af (RTX 4090 + R9700): 7 tests left red by #4871, #4829, #4837, #4835, #4810, #4930, #4856 (stale doubles/oracles; library behaves as intended) #4969 item 10.
    4. Wall-clock thresholds (section 3): test_bench_cuda_even_d2h.py::test_even_d2h_pool_shape_sensitivity now also fails (ratio bound), together with test_even_d2h_request_wall.

    Section 4 (instability on a shared card): test_quant_time, test_thread_pool_exit, test_threadx::test_virtual_pool_cuda_alias_behaviour, and the device kernel image is invalid errors in test_qwen2_5_omni_lm_head all pass when run alone (2/2). The full run's test_qwen4_exp_exl3_contracts / test_shared_input_hessian_dedup_real_model_e2e aborts were hipblaslt ... out of memory / hipErrorLaunchFailure while the card was shared. Contention, not bugs.

    🤖 Generated with Claude Code

  3. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim: agent-root-4770-rocm-gating is working on this issue now.

    Started 2026-11-18T00:14Z. The claim expires 4.0h after this comment is last edited; it is released with the PR link or with a stand-down comment.

    Scope: section 1 (a shared requires_nvidia_cuda gate so CUDA-only kernels skip instead of fail on ROCm), section 2 (skipif(torch.version.hip) for CUDA-capability fakes), and section 3's stale allspark expectation. Sections 3's HIP numeric tolerances and section 4 (card-instability) are out of scope for this pass.

  4. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    Section 1 (missing ROCm skip), section 2 (CUDA-capability fakes) and section 3's stale qzeros_format expectation are fixed in #5056, merged as 4d2174fe991164808dd14c33dd011b2301d0ca45.

    What landed

    • New shared predicate tests/accelerator_gates.py::requires_nvidia_cuda() (torch.cuda.is_available() and torch.version.hip is None), unit-tested with torch.version.hip patched (False for HIP, False with no device, True only on a CUDA build + device).
    • Section 1: the predicate now gates the AWQ-native/static-cache/Marlin/ExLlamaV2/Triton/BitBLAS/QQQ/EXL3/NF12 tests listed in the issue (and the Marlin/Triton/ExLlamaV2 reload legs). test_marlin_scratch_cuda.require_dtype() also pytest.skips on HIP, as asked. test_marlin_device_profile.py was already gated on main; unchanged.
    • Section 2: skipif(torch.version.hip is not None) on the three test_default_device_mixed_capability_4705 grouping/refusal tests and test_max_memory_kernel_devices_4632::test_a_budget_that_names_both_cards_still_rejects_mixed_capabilities (they keep running on CPU-only hosts).
    • Section 3: test_allspark_awq.py::test_awq_module_export_keeps_checkpoint_layout now expects qzeros_format and excludes it from the export, matching the CUDA twin.
    • Out of scope and untouched: HIP numeric tolerances (clip tie-break, benchmark wall-clock, QQQ Hessian peak) and section 4's instability/library items. No library code changed.

    Verification (PG506 / sm_80, CUDA 13, torch 2.15; ROCm not executed here)

    • tests/test_accelerator_gates.py: 26 passed (25 on base + the new predicate test).
    • 14 touched files on this CUDA host: 383 passed, 16 failed, 53 skipped vs. 382 / 16 / 53 on unmodified origin/main at the same commit. The only delta is the new predicate test; the 16 failures are pre-existing AVX512-only / device-move nodes and reproduce identically on base. No gated node skipped on CUDA.
    • test_marlin_scratch_cuda.py: 60 passed, 2 skipped (two-GPU cases). test_glm5_core_cuda.py + the AllSpark CUDA twin export test: 12 passed.
    • Simulated HIP (torch.version.hip patched before collection) over the same nodes: 10 passed, 100 skipped, 0 failed - every gated node skips with its reason while ungated nodes still run.
    • ruff check clean on every touched file. CI on test: skip CUDA-only kernels on ROCm with a shared requires_nvidia_cuda gate (#4770) #5056: all checks green.

    Not verified: actual ROCm execution, and the AllSpark HIP twin itself (RDNA4-only, skips on CUDA); its expectation was checked against the CUDA twin and a direct AllSparkAwqLinear.state_dict() key check on this host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions