Skip to content

test: restore the FP8 kernel, packing and doc guards left red by #5242/#5294 (#5325) - #5344

Merged
Qubitium merged 2 commits into
mainfrom
fix/test-triage-5325
Nov 19, 2026
Merged

Qubitium merged 2 commits into
mainfrom
fix/test-triage-5325

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

Restores the test coverage that #5242 (FP8 load-only) and #5294 left broken, and
removes the test-order dependence in the CPU-fallback pair guard.

Refs #5325 — this PR lands items B1, B2, B5, B6, B7. The issue stays open for
B3/B4 (need a ROCm host) and for the section A items tracked in #5113.

Two of these were silently hiding regressions rather than just failing loudly:
tests/test_packing_numeric_boundaries.py did not even import, so all 115
GPTQ/AWQ/QQQ packing-boundary tests were gone, and the FP8 load-only fixture in
test_fail_closed_checkpoint_5218.py decoded ~1e4x too large while its only
assertion (torch.isfinite) passed.

Out of scope: B3/B4 (ROCm-only expectations that need a HIP host to verify),
B7's MLX module itself, and the section A items from #5113, which are tracked
there.

What Changed

B1 — removed FP8 quantizer call sites. #5242 deleted
TorchFP8Linear.pack / pack_original and moved the reference encoder to
tests/fp8_test_utils.py; five modules still called the removed API.

  • tests/test_packing_numeric_boundaries.py: import quantize_fp8_weight from
    tests.fp8_test_utils. The file had failed at collection with
    ImportError: cannot import name 'quantize_fp8_weight'.
  • tests/kernels/test_inference_numeric_range.py::test_fp8_small_weight_scale:
    pack_fp8_module(m, linear) instead of m.pack(linear, None, None).
  • tests/kernels/test_cuda_bias_epilogue.py::_fp8 and ::_gguf:
    pack_fp8_module(module, linear) instead of pack_original.
  • tests/kernels/test_lora_cuda_autograd.py::test_fp8_cuda_lora_preserves_base_and_adapter_gradients:
    pack_fp8_module.

B2 — the #5288 FP8 fixture decoded to garbage. quantize_fp8_weight stores
448 / amax (the inverse convention), but the fixture declared
weight_scale_semantics: "multiplier", so the wrapper multiplied by the inverse
scale. Three changes:

  • declare "inverse";
  • quantize only model.layers.* projections. The tiny source ties lm_head to
    embed_tokens, and the FP8 lm_head the fixture wrote was never decoded with
    its own scale, which is the other half of the ~1e4x logit blow-up;
  • assert the loaded logits against the dense model instead of only
    torch.isfinite.

B5 — Paro Triton CUDA-graph test had no GPU gate.
tests/kernels/test_paro_triton_cudagraph_5225.py carried only
pytest.mark.gpu, so all 5 nodes raised RuntimeError: Paro Triton requires a CUDA or ROCm GPU on a host with no visible device. Added a matching
skipif(not torch.cuda.is_available()).

B6 — stale doc line reference. hessian_inverse moved from
gptqmodel/quantization/gptq.py:2121 to 2140. The citation is now
symbol-anchored (gptq.py::hessian_inverse), like the other
SYMBOL_CITATION entries in tests/test_docs_contract_refs.py, so the next
unrelated edit cannot drift it.

B7 — registry-order dependence. _cpu_fallback_sources enumerated the live
kernel registry, so importing qlinear.mlx (or qlinear.qqq_triton) in an
earlier test turned QQQMlxQuantLinear — an MPS kernel — into an expected
rehome source, and the test then asserted a CUDA calibration kernel must switch
into it. The helper is now restricted to DEVICE.CUDA kernels, which is what
rehome_quantized_kernel actually moves; the _CUDA_SOURCES assertions are
unchanged.

No product code changes. No API or behavior changes.

Tests

Environment: aarch64 GB10, torch 2.11.0+cu130, transformers 5.23.0; no CUDA
toolkit, so JIT-extension builds are unavailable here (see Notes).

PYTHONPATH=$PWD GPTQ_BYPASS_SAFETY_CHECKS=1 S=1 python -m pytest -q \
  tests/test_packing_numeric_boundaries.py \
  tests/test_docs_contract_refs.py \
  tests/test_rehome_cpu_fallback_pairs.py \
  tests/test_fail_closed_checkpoint_5218.py -k "not allspark"
# 173 passed, 3 skipped, 1 deselected

PYTHONPATH=$PWD GPTQ_BYPASS_SAFETY_CHECKS=1 S=1 python -m pytest -q \
  tests/kernels/test_inference_numeric_range.py -k fp8
# 48 passed, 327 deselected

PYTHONPATH=$PWD GPTQ_BYPASS_SAFETY_CHECKS=1 S=1 python -m pytest -q \
  tests/kernels/test_cuda_bias_epilogue.py -k fp8
# 6 passed, 4 skipped, 49 deselected

PYTHONPATH=$PWD GPTQ_BYPASS_SAFETY_CHECKS=1 S=1 python -m pytest -q \
  "tests/kernels/test_lora_cuda_autograd.py::test_fp8_cuda_lora_preserves_base_and_adapter_gradients"
# 1 passed

CUDA_VISIBLE_DEVICES="" PYTHONPATH=$PWD GPTQ_BYPASS_SAFETY_CHECKS=1 S=1 python -m pytest -q \
  tests/kernels/test_paro_triton_cudagraph_5225.py
# 5 skipped (was 5 failed)

bash format/check.sh
# ruff 0.14.2 / All checks passed!

Negative control for B2: with the fixture back on
"weight_scale_semantics": "multiplier" the new dense-logit assertion fails
(test_truncated_weight_only_checkpoint_fails_closed[fp8]), so the test now
detects the mis-declared scale it used to accept.

B7 was reproduced by importing the other qlinear modules in the same session
(import gptqmodel.nn_modules.qlinear.mlx, gptqmodel.nn_modules.qlinear.qqq_triton
before pytest): 6 passed, where the unpatched helper asserted
QQQMlxQuantLinear.

  • Unit tests have been executed and passed, or the reason they are not applicable is documented.
  • I added a new simple/fast unit test for this change, or documented why that is not applicable.
    (B2 extends an existing end-to-end test with the missing assertion; the
    other items repair existing tests.)

Model Support / Module Plan

Not applicable: no model definitions, registry entries, or module plans change.

Logic Flow Documentation

Not applicable: no control flow, resolution order, or tensor lifecycle changes.
The only behavior change is in a test helper (_cpu_fallback_sources now filters
by DEVICE.CUDA), which narrows the expected set to the kernels
rehome_quantized_kernel moves.

Kernel Accuracy Requirements

Not applicable to product kernels: no kernel code changes. The restored FP8
tests still compare against the existing independent references
(tests/fp8_test_utils payloads, the FP64/expected-value oracles in
test_inference_numeric_range.py, and the dense-model logits in
test_fail_closed_checkpoint_5218.py).

Notes

  • tests/test_fail_closed_checkpoint_5218.py::test_every_declared_tensor_is_required[allspark]
    fails on this host with NotImplementedError: AllSpark requires CUDA compute capability 80-120 (GB10 is sm_121). It fails identically on origin/main,
    so it is deselected above and is not a regression from this PR.
  • JIT-extension tests (marlin, AWQ fused, Paro rotation prewarm) cannot build
    here because CUDA_HOME is unset; the FP8 selections above do not need them.
  • B3 (ROCm lean-epilogue expectations) and B4 (missing ROCm gates for QQQ /
    Pangu-Alpha) need a HIP host to verify; they are left for a ROCm lane.

…#5294 (#5325)

B1: #5242 made FP8 load-only and deleted `TorchFP8Linear.pack` /
`pack_original`; five test modules still called them.
- `tests/test_packing_numeric_boundaries.py` failed to import at all, so the
  whole 113-test GPTQ/AWQ/QQQ packing-boundary file was lost. Import
  `quantize_fp8_weight` from `tests.fp8_test_utils` (115 passed).
- `test_inference_numeric_range.py::test_fp8_small_weight_scale`,
  `test_cuda_bias_epilogue.py::_fp8/_gguf` and
  `test_lora_cuda_autograd.py::test_fp8_cuda_lora_*` build the payload with
  `pack_fp8_module` (48, 6 and 1 nodes).

B2: the #5288 FP8 fixture declared `weight_scale_semantics: "multiplier"`
while `quantize_fp8_weight` stores `448 / amax`, so decode multiplied by the
inverse scale (~1e4x too large) and only `torch.isfinite` was asserted.
Declare `"inverse"`, quantize only the decoder projections (the tied FP8
`lm_head` was never decoded with its scale), and compare the logits against
the dense model. Reverting the declaration now fails the test.

B5: `test_paro_triton_cudagraph_5225.py` only carried `pytest.mark.gpu`, so
all 5 nodes failed on a host with no visible GPU. Add a skipif; they now skip.

B6: cite `gptq.py::hessian_inverse` by symbol. The line moved to 2140 and
`test_docs_contract_refs.py` is red on every host (33 passed).

B7: `_cpu_fallback_sources` enumerated the live registry, so importing
`qlinear.mlx` in an earlier test turned `QQQMlxQuantLinear` (MPS) into an
expected rehome source. Restrict it to CUDA kernels, which is what
`rehome_quantized_kernel` moves; the file now passes after those imports.
@Qubitium
Qubitium marked this pull request as ready for review November 19, 2026 03:14
@Qubitium
Qubitium merged commit 3f38d5e into main Nov 19, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/test-triage-5325 branch November 19, 2026 03:14
Qubitium added a commit that referenced this pull request Nov 20, 2026
…re (#5325) (#5678)

Round 26 of the GPU-host triage found two more CPU-verifiable fixtures left
red by #5242 (FP8 load-only) and #5344:

- tests/kernels/test_cuda_bias_epilogue.py::_gguf was switched to the FP8
  test packer, which writes weight_scale_inv/fp8_format onto a GGUF module;
  all four gguf_dense cases raised AttributeError: 'GGUFTorchLinear' object
  has no attribute 'fp8_format'. Restore GGUFTorchLinear.pack_original.
- tests/kernels/test_compile_capability_4739.py::_build_fp8_model still
  quantized through GPTQModel.quantize(FP8Config), which now raises
  ValueError: FP8 is load-only. Write a transformers-style FineGrainedFP8
  checkpoint (128x128 block scales) and load it with BACKEND.FP8_TORCH.
Qubitium added a commit that referenced this pull request Nov 29, 2026
…er (#5325) (#6254)

B1/B2's listed call sites were already migrated on main by #5344/#5678.
A repo-wide sweep still finds four callers of the removed FP8 packers:
they now fail with 'FP8 is load-only' and are silently skipped, losing
the FP8 training-inplace, CPU compile-level and CUDA compile-level
coverage (plus the CPU benchmark builder).

Use tests.fp8_test_utils.pack_fp8_module for the synthetic payloads.

Co-authored-by: OpenAI Agent <[email protected]>
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