Repository navigation
test: restore the FP8 kernel, packing and doc guards left red by #5242/#5294 (#5325) - #5344
Merged
Merged
Conversation
…#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
marked this pull request as ready for review
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]>
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.
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.pydid not even import, so all 115GPTQ/AWQ/QQQ packing-boundary tests were gone, and the FP8 load-only fixture in
test_fail_closed_checkpoint_5218.pydecoded ~1e4x too large while its onlyassertion (
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_originaland moved the reference encoder totests/fp8_test_utils.py; five modules still called the removed API.tests/test_packing_numeric_boundaries.py: importquantize_fp8_weightfromtests.fp8_test_utils. The file had failed at collection withImportError: cannot import name 'quantize_fp8_weight'.tests/kernels/test_inference_numeric_range.py::test_fp8_small_weight_scale:pack_fp8_module(m, linear)instead ofm.pack(linear, None, None).tests/kernels/test_cuda_bias_epilogue.py::_fp8and::_gguf:pack_fp8_module(module, linear)instead ofpack_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_weightstores448 / amax(the inverse convention), but the fixture declaredweight_scale_semantics: "multiplier", so the wrapper multiplied by the inversescale. Three changes:
"inverse";model.layers.*projections. The tiny source tieslm_headtoembed_tokens, and the FP8lm_headthe fixture wrote was never decoded withits own scale, which is the other half of the ~1e4x logit blow-up;
torch.isfinite.B5 — Paro Triton CUDA-graph test had no GPU gate.
tests/kernels/test_paro_triton_cudagraph_5225.pycarried onlypytest.mark.gpu, so all 5 nodes raisedRuntimeError: Paro Triton requires a CUDA or ROCm GPUon a host with no visible device. Added a matchingskipif(not torch.cuda.is_available()).B6 — stale doc line reference.
hessian_inversemoved fromgptqmodel/quantization/gptq.py:2121to2140. The citation is nowsymbol-anchored (
gptq.py::hessian_inverse), like the otherSYMBOL_CITATIONentries intests/test_docs_contract_refs.py, so the nextunrelated edit cannot drift it.
B7 — registry-order dependence.
_cpu_fallback_sourcesenumerated the livekernel registry, so importing
qlinear.mlx(orqlinear.qqq_triton) in anearlier test turned
QQQMlxQuantLinear— an MPS kernel — into an expectedrehome source, and the test then asserted a CUDA calibration kernel must switch
into it. The helper is now restricted to
DEVICE.CUDAkernels, which is whatrehome_quantized_kernelactually moves; the_CUDA_SOURCESassertions areunchanged.
No product code changes. No API or behavior changes.
Tests
Environment: aarch64 GB10,
torch 2.11.0+cu130,transformers 5.23.0; no CUDAtoolkit, so JIT-extension builds are unavailable here (see Notes).
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 nowdetects 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_tritonbefore pytest): 6 passed, where the unpatched helper asserted
QQQMlxQuantLinear.(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_sourcesnow filtersby
DEVICE.CUDA), which narrows the expected set to the kernelsrehome_quantized_kernelmoves.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_utilspayloads, the FP64/expected-value oracles intest_inference_numeric_range.py, and the dense-model logits intest_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 onorigin/main,so it is deselected above and is not a regression from this PR.
marlin, AWQ fused, Paro rotation prewarm) cannot buildhere because
CUDA_HOMEis unset; the FP8 selections above do not need them.Pangu-Alpha) need a HIP host to verify; they are left for a ROCm lane.