Skip to content

test(fp8): migrate remaining callers to the reference encoder (#5325) - #6254

Merged
Qubitium merged 1 commit into
mainfrom
fix/5325-fp8-issue
Nov 29, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/5325-fp8-issue

Conversation

@Qubitium

@Qubitium Qubitium commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #5325 (items B1, B2)

Context

The five B1 files named in #5325 and B2's _fp8_checkpoint fixture are already
migrated/fixed on current main by #5344 (3f38d5ee1) and #5678 (1531ff73f).
I verified those exact nodes green on this base (evidence below). A repo-wide
sweep for the removed TorchFP8Linear.pack* API still finds four unmigrated
callers. Because the removed packers raise
ValueError: FP8 is load-only: GPT-QModel no longer quantizes or exports FP8 weights,
the three test builders are swallowed by their except Exception: pytest.skip
guards, so FP8 coverage is silently lost instead of failing loudly.

Changes

  • tests/test_training_kernel_inplace_4974.py::_fp8 -> pack_fp8_module.
    Restores test_trainable_kernel_allows_inplace_accumulation[*-fp8_torch-cpu]
    (2 CPU nodes) and makes the two fp8_torch-cuda nodes buildable on a GPU.
  • tests/kernels/test_kernel_compile_levels_cpu.py: dedicated _pack_fp8()
    builder -> pack_fp8_module; restores
    test_cpu_kernel_reaches_declared_cpu_level[TorchFP8Linear].
  • tests/kernels/test_kernel_compile_levels_quant.py::_build_fp8 ->
    pack_fp8_module; makes the CUDA TorchFP8Linear compile-level case
    buildable (unverified here: CPU-only run).
  • tests/benchmark/benchmark_cpu_method_kernels.py::_build_fp8 ->
    pack_fp8_module; the CPU benchmark builder no longer raises.

Red before (this patch reverted)

$ cd tests && PYTHONPATH=<clone>:<clone>/tests CUDA_VISIBLE_DEVICES="" \
    /root/venv/bin/python -m pytest test_training_kernel_inplace_4974.py -q -rs -k fp8
4 skipped, 36 deselected
SKIPPED [2] ... fp8_torch cannot be built on cpu: ValueError: FP8 is load-only: ...
SKIPPED [2] ... CUDA required

$ ... pytest "kernels/test_kernel_compile_levels_cpu.py::test_cpu_kernel_reaches_declared_cpu_level" -q -rs -k TorchFP8Linear
1 skipped
SKIPPED [1] ... TorchFP8Linear: cannot build on CPU: ValueError: FP8 is load-only: ...

$ python -c "from tests.benchmark.benchmark_cpu_method_kernels import _build_fp8; _build_fp8(64, 64)"
ValueError: FP8 is load-only: GPT-QModel no longer quantizes or exports FP8 weights...

Mutation check on the originally listed B1 sites (already fixed upstream):
restoring the pre-#5344 import reproduces the exact collection error, and
restoring the removed m.pack(linear, None, None) call reproduces the exact
ValueError:

$ ... pytest test_packing_numeric_boundaries.py -q --collect-only
E   ImportError: cannot import name 'quantize_fp8_weight' from 'gptqmodel.nn_modules.qlinear.fp8'
ERROR test_packing_numeric_boundaries.py
!!! Interrupted: 1 error during collection !!!

$ ... pytest "kernels/test_inference_numeric_range.py::test_fp8_small_weight_scale[tensor-float8_e4m3fn-dtype0-cpu]" -q
FAILED ... - ValueError: FP8 is load-only: GPT-QModel no longer quantizes or exports FP8 weights...

B2's assertion is not vacuous. Mutating the fixture back to
"weight_scale_semantics": "multiplier" fails the dense-logit check:

FAILED test_fail_closed_checkpoint_5218.py::test_truncated_weight_only_checkpoint_fails_closed[fp8-_fp8_checkpoint-required0]
Mismatched elements: 382 / 512 (74.6%)
Greatest absolute difference: 1.103190541267395 ... (up to 0.055159527063369754 allowed)

Green after

$ ... pytest test_training_kernel_inplace_4974.py -q -rs -k fp8
2 passed, 2 skipped (CUDA required)

$ ... pytest "kernels/test_kernel_compile_levels_cpu.py::test_cpu_kernel_reaches_declared_cpu_level" -q -rs -k TorchFP8Linear
1 passed

$ ... pytest kernels/test_kernel_compile_levels_cpu.py -q -rs
46 passed, 2 skipped

$ ... pytest test_packing_numeric_boundaries.py -q -rs
75 passed, 40 skipped (CUDA/ROCm device required)

$ ... pytest kernels/test_inference_numeric_range.py::test_fp8_small_weight_scale \
    test_fail_closed_checkpoint_5218.py::test_truncated_weight_only_checkpoint_fails_closed -q -rs
26 passed

$ python -c "from tests.benchmark.benchmark_cpu_method_kernels import _build_fp8; ..."
benchmark fp8 built torch.float8_e4m3fn (64, 64) (64,) True

ruff check on all four changed files: All checks passed!

Skips / unverified

CPU-only verification (CUDA_VISIBLE_DEVICES=""). Not run: the two
fp8_torch-cuda nodes above, test_kernel_compile_levels_quant.py[TorchFP8Linear],
and the CUDA-only FP8 nodes in test_cuda_bias_epilogue.py,
test_lora_cuda_autograd.py, test_compile_capability_4739.py (all collect
cleanly). The 40 CUDA/ROCm parameters in test_packing_numeric_boundaries.py
are skipped on this host. No ROCm host was available.

…er (#5325)

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.
@Qubitium
Qubitium marked this pull request as ready for review November 29, 2026 08:13
@Qubitium
Qubitium merged commit 00d9d21 into main Nov 29, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/5325-fp8-issue branch November 29, 2026 08:13
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