Skip to content

[TEST] New tests red on GPU hosts since #5035/#5064: gguf_cuda_weight_storage_4387[bias] 512 B bound vs #5014 shift-table cache, kquant capture declaration needs llama-cpp, #5020 gptq_triton node hard-codes a CUDA-only kernel on ROCm #5113

Closed

Description

@Qubitium

Found on main @ 7b8f127, RTX 4090 (torch 2.15.0+cu132, venv with llama-cpp-python) and AMD R9700 (ROCm 10.1, torch 2.16.0.dev, no llama-cpp-python).

The full non-model suite was triaged on both GPUs, and every failure was rerun. Below are the tests added or broken since the last triage (3867c82af) whose failures come from the tests rather than the product. Each was bisected with the HEAD tests copied into older trees.

1. tests/kernels/test_gguf_cuda_weight_storage_4387.py::test_forward_leaves_one_device_copy_of_the_packed_weight[True]: red on CUDA since 0ff0c0ebc (#5035, fix of #5014)

E       AssertionError: assert 10240 <= (83456 - 73728)

The test requires memory_allocated() after the first forward to be at most before - qweight.nbytes, with zero slack. Since #5035, the biased GGUFCudaKernel layer runs its dequant through the inherited GGUFTorchLinear K-quant path. That path now caches its (0, 4) uint8 shift table on the device, by design, as an immutable per-module constant (#5014): 2 bytes, one 512-byte allocator block. Measured:

bias False  nbytes 73728  delta -73728  shift tables {}
bias True   nbytes 73728  delta -73216  shift tables {('cuda', 0): {(0, 4): (2, 'cuda')}}
            after clear_weight_cache(): delta -73728

The packed weight is still released, which is what the test protects (#4387). Suggested fix: subtract the module's cached constants (_u8_shift_tables) from the bound, or call clear_weight_cache() before measuring.

2. tests/kernels/test_gguf_kquant_graph_capture_5014.py::test_graph_capture_declaration_is_per_format: errors on any host without llama-cpp-python (added by #5035)

E   NotImplementedError: Unsupported GGUF quantize target `Q2_K`: install `llama-cpp-python` for native ggml quantization of this format.

_build("q2_k") / _build("q3_k") (the HOST_DEQUANT_BITS loop) call GGUFTorchLinear.pack_original. That path needs llama.cpp's native quantizer for Q2_K/Q3_K, and the test has no importorskip/skip gate for it. On the ROCm venv (no llama-cpp-python) the test fails; on the CUDA venv (with it) it passes. Suggested fix: skip the HOST_DEQUANT_BITS half when llama_cpp is unavailable, or build those modules from pre-packed bytes.

3. tests/test_optimize_dynamo_release_5020.py (added by #5064): [gptq_triton] hard-codes a CUDA-only kernel, so it fails on ROCm

On ROCm, test_optimize_generate_does_not_pin_the_model[gptq_triton] hard-codes BACKEND.GPTQ_TRITON. That kernel is CUDA-only by design, so the node fails with ValueError: TritonV2Linear is CUDA-only and does not run on ROCm instead of skipping. [gptq_torch] passes there. Suggested fix: gate [gptq_triton] on an NVIDIA build, as #5056 did for other CUDA-only nodes.

(Side note, environment only: on this host the HF cache entry for HuggingFaceTB/SmolLM2-135M is incomplete (no refs/), so the fixture's snapshot_download(..., local_files_only=True) raises LocalEntryNotFoundError and all three end-to-end nodes error instead of skipping. tests/test_load_strict_kwargs_4945.py errors the same way, 11 nodes. With a local Qwen2.5-0.5B-Instruct swapped in, using the same 4-layer truncation, the #5020 regression passes 4/4 on CUDA, so the fix itself is fine. A pytest.skip on LocalEntryNotFoundError would make these fixtures fail closed.)


Which test should have caught these: the CI GPU lane. All three files are new or were edited after the last full GPU triage. Severity: low (test-only). The product behaviour each test protects was verified separately on this host.

🤖 Generated with Claude Code

Activity

  1. changed the title [-][TEST] New tests red/erroring on GPU hosts since #5035/#5064: gguf_cuda_weight_storage_4387[bias] 512 B bound vs #5014 shift-table cache, kquant capture declaration needs llama-cpp, #5020 regression needs an uncached SmolLM2[/-] [+][TEST] New tests red on GPU hosts since #5035/#5064: gguf_cuda_weight_storage_4387[bias] 512 B bound vs #5014 shift-table cache, kquant capture declaration needs llama-cpp, #5020 gptq_triton node hard-codes a CUDA-only kernel on ROCm[/+] on Nov 18, 2026
  2. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim: agent-root-5113-test-red is working on this issue now.

    Started 2026-11-18T05:37:24Z. The claim expires 4.0h after this comment was last edited (heartbeat). Other agents: do not start this issue while the claim is live.

    claiming: fix the three GPU-host red tests: gguf weight-storage 512 B bound vs the shift-table cache, the kquant capture declaration needing llama-cpp, and the CUDA-only gptq_triton node

  3. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    More test-only reds from the full triage at main @ 7b8f127 (RTX 4090 + R9700). Each item is deterministic (3/3 reruns) and was bisected with the HEAD tests over 3867c82af..7b8f12785. In each case the product does what the PR intended and the test or its harness is stale.

    # test first bad why it is stale
    4 test_concurrency_guards.py::test_cpu_bf16x3_capability_probe_respects_an_active_scope (CPU/CUDA/ROCm) caa5bb13e (#5070) AttributeError: 'function' object has no attribute 'cache_clear'. #5070 turned has_cpu_bf16x3_precision from an lru_cache into a module-global process constant (_CPU_BF16X3_PRECISION). The #4486 lock guard is still in _probe_cpu_bf16x3_precision, but this test can no longer reach it. Reset with monkeypatch.setattr(cpu_features, "_CPU_BF16X3_PRECISION", None) instead (lines 303/341).
    5 test_kernel_audit_regressions.py::test_device_move_restores_checkpoint_layout[TorchAtenLinear / TorchFusedLinear] 2620daf28 (#5033) NotImplementedError: aten::equal ... Meta tensors. Since #5033 the checkpoint qweight is rebuilt by inverting the runtime layout after _apply. The test uses meta as its stand-in move target, and there the inverse's ret_idx identity check (torch.equal) cannot run. A real dtype move (and a real CPU quantize) still restores correctly. Use a dtype move, or a real second device when present.
    6 test_gemma3_vl_support.py::test_gemma3_vl_prepare_dataset_accepts_pretokenized_text_without_processor, test_qwen3_5_moe_multimodal_support.py::test_qwen3_5_moe_prepare_dataset_routes_pretokenized_rows_to_base_path f3433d159 (#4946) The rows carry a leading attention_mask 0, which #4946 now strips as edge padding ((1, 11) vs expected (1, 12)). Update the expected shapes, or use an all-ones mask.
    7 test_lm_head.py::TestLmHeadLoad::test_eval f28cfc94d (#4972) ValueError: GPTQModel.load: quantize_config cannot be applied to a quantized checkpoint. The shared harness tests/models/model_test.py:1666 (ModelTest.quantModel) always passes quantize_config= even when NATIVE_MODEL_ID is already quantized. The _loaded_model_was_prequantized evaluation branch is therefore unreachable for every ModelTest that evaluates a pre-quantized checkpoint, not just this one.
    8 test_q4_exllama_v2.py::TestsQ4ExllamaV2::test_generation_desc_act_true f28cfc94d (#4972) TypeError: ... unexpected keyword argument(s) for a quantized checkpoint: rivision (did you mean revision?). The strict-kwargs check found a real typo in the test (rivision=revision, line 175), which had been silently ignored since 6f1eb58cd.
    9 test_pre_looper_failure_cleanup_4862.py::test_calibration_rejected_before_the_looper_leaves_no_smi_threads[empty] and ::test_later_processor_failure_releases_the_processors_already_built 7f0ca1f44 (#4985) #4985 validates the calibration data before any processor is built. The empty-dataset message is now Quantize: calibration dataset is empty. (the test expects must not be empty). The adapter_dataset=[123] error now fires before the GPTQ processor exists, so released == []. The "release the processors already built when a later one fails" path is no longer exercised by any test, so it needs a new trigger that fails after the first processor is constructed.
    10 test_ci_free_threaded_lane.py::test_gate_passes_with_gil0 (ROCm 3.14t venv, and a CUDA 3.14t venv on torch 2.16.dev) 7b8f12785 (#5103) The gate script now pins FAIL: expected 2.15.0+cu132 for CUDA 13.2, got 2.16.0.dev...+rocm10.1. The skip only checks for a free-threaded 3.14.10 interpreter, so the test should also skip when the torch build is not the pinned CI one.
    11 ROCm: test_hf_bridge_v2_save_qzeros_4952.py (4 nodes) and test_hf_bridge_cpu_offload_5022.py::test_awq_marlin_uses_the_shared_offload_post_init new tests (#4980, #5046) The first file has no importorskip("optimum") (ImportError: Loading a GPTQ quantized model requires optimum). The second gates on torch.cuda.is_available(), which is true on HIP, and then raises ImportError: Marlin kernel is not supported on ROCm. Use the NVIDIA-build gate from #5056.
    12 test_cpu_int4_verify_cost_4884.py::test_transformed_state_dict_is_bounded_by_its_own_bytes[identity, desc_act] flaky under host load Fails even at its own commit c52ae996d on a loaded host (load ~150). Measured state_dict(): pre-fix 11-27 ms (750-2700x a raw copy), fix 2.5-7.4 ms (178-804x), HEAD 5-7 ms (440-760x), against a 150x bound. The #4884 fix is intact, but the absolute ratio bound is host-sensitive.

    🤖 Generated with Claude Code

  4. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    The rest of the full triage (CUDA pass finished; every item below also fails CPU-only and was bisected the same way):

    # test first bad why it is stale
    13 test_vlm_prepare_dataset_contract_4633.py (62 nodes: test_pretokenized_rows_never_reach_the_processor[*], test_columnar_mapping_is_unpacked_not_rendered_as_key_names[*]) and test_vlm_pretokenized_calibration.py::test_vlm_pretokenized_mapping_rows_take_base_text_path[*] (17 nodes) f3433d159 (#4946) The same edge-padding strip as item 6: the fixture rows carry a leading/trailing attention_mask 0, so the prepared rows are one token shorter than the expected oracle (torch.Size([1, 11]) vs (1, 12)). 79 nodes total.
    14 test_torch.py::test_forward_observes_weight_mutation_and_state_load_clears_metadata, ::test_cached_dequant_offloads_g_idx_to_cpu_on_cuda caa5bb13e (#5070) assert module._zeros_cache is not None / _g_idx_long_cache is not None. TorchLinear now lazily torch.compiles its dequant on the first call (INFO Optimize: TorchLinear compilation triggered). Inside the compiled frame torch.compiler.is_compiling() is True, so _stream_decode_qzeros / _stream_g_idx_long decode inline and never publish the caches, and the test's cache-presence (and g_idx-to-CPU offload) assertions can no longer hold. The behaviour the first test is named for is intact: in-place mutation of qweight/qzeros/scales/g_idx gives the same output as a fresh deep copy on CPU and CUDA. Assert on outputs instead of private caches.
    15 test_torch_cpu_avx512.py::test_cpu_feature_detection_requires_vbmi, ::test_cpu_feature_detection_requires_xsave caa5bb13e (#5070) Same as item 4: has_avx512_bf16.cache_clear() on what is now a module-global constant (_AVX512_BF16).
    16 test_torch_cpu_avx512.py::test_fused_bias_validation 170b34a72 (#5075) Failed: DID NOT RAISE RuntimeError at the match="Meta tensors" block (line 807). #5075 registered FakeTensor impls for the CPU extension ops, so a meta-tensor call now succeeds, as intended. Drop or invert that expectation.
    17 ROCm: test_paro_training_gradients_4958.py::test_cuda_awq_gemm_is_reserved_for_inference new test (#4992) Gated on torch.cuda.is_available(), which is true on HIP. The native AWQ GEMM is CUDA-only, so _forward_cuda_awq_kernel returns None (assert None is not None). Use the NVIDIA-build gate.

    Environment only (not test bugs), for completeness: test_load_strict_kwargs_4945.py (11) and the #5020 nodes need HuggingFaceTB/SmolLM2-135M in the HF cache. Both pass with a local substitute (13/13 and 4/4). test_olora_finetuning_xpu (Llama-3.1-8B GPTQ AdaLoRA, bs16 x 256, no gradient checkpointing) gets past #4974 now but OOMs on a 48 GB card in its first step. test_gptqmodel_nf12_api and test_exllamav3_kernel 2^32-offset OOMs pass 3/3 alone on a free GPU.

    🤖 Generated with Claude Code

  5. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    Item 18, visible only with the optional gguf package installed (the default suite skips these nodes without it, so the main pass stays green):

    tests/test_gguf_all_formats.py::test_gguf_kernel_independent_packed_oracle[{dense,fused}-dtype{0,1,2}-{q4_k,q4_k_m,q4_k_s,q5_k,q5_k_m,q5_k_s,q6_k}] is red on CUDA: 42 nodes, with gguf 0.19.0.

    E   assert tensor([0, 4], dtype=torch.uint8) is tensor([[222,  11, 198, ..., 148, 144, 147]], ...)
    

    The test walks vars(module) and requires every tensor the module holds to be module.qweight, meaning no dense weight cache. Since 0ff0c0ebc (#5035, the fix of #5014), the K-quant shift tables ((0, 4), (0..7), (0, 2, 4, 6) uint8, 2-8 bytes each) are cached per module in _u8_shift_tables by design, so the walk finds them. This is the same root cause as item 1. With HEAD tests: parent 0ff0c0ebc^ 111/111 dense nodes pass, 0ff0c0ebc 21 fail. Exempt _u8_shift_tables (or any tensor below a byte threshold) from the "only qweight" walk.

    🤖 Generated with Claude Code

  6. Qubitium commented on Nov 18, 2026

    @Qubitium
    CollaboratorAuthor

    Agent claim released: agent-root-5113-test-red finished this issue.
    Pull request: #5138

    Fixed the three test-side failures. #4387 now allows the #5014 per-module shift-table constant in the first-forward bound and then asserts the exact packed-weight release after dropping the derived caches, so a second device copy still fails. #5014 skips only the Q2_K/Q3_K declaration nodes when llama-cpp-python is absent, with a unit check for the skip reason; the capturable-format assertions and the Q2_K/Q3_K False declaration still run where llama.cpp is available. #5020 gates the GPTQ_TRITON node, and the repeated-generate node that uses the same backend, on the shared #5056 requires_nvidia_cuda() predicate. Item 3 is ROCm-only and was verified by gate inspection plus a HIP-patched unit check on this CUDA host, not by running ROCm.

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