Skip to content

[Fix] Restore online MXFP8 quantization for linear layers - #32953

Merged
mmangkad merged 4 commits into
mainfrom
fix/online-mxfp8-linear
Jul 31, 2026
Merged

[Fix] Restore online MXFP8 quantization for linear layers#32953
mmangkad merged 4 commits into
mainfrom
fix/online-mxfp8-linear

Conversation

@b8zhong

@b8zhong b8zhong commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Any bf16 checkpoint launched with --quantization mxfp8 fails at model init because AMD broke it again:

ValueError: MXFP8 requires fp8-serialized checkpoint for linear layers.

But that is exactly the online quantization path — the weights are meant to be created in bf16 and quantized in process_weights_after_loading.

The guard was unreachable when added in #17449 (nested inside if is_checkpoint_fp8_serialized:). The create_fp8_weight_ refactor in #28291 hoisted it out to an elif, making it fire. Only linear layers are affected; the MoE path never had this guard.

Modifications

Drop the elif use_mxfp8: raise ValueError(...) branch in Fp8LinearMethod.create_fp8_weight_.

Checklist


CI States

Latest PR Test (Base): ✅ Run #30595008130
Latest PR Test (Extra): ❌ Run #30595007887

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@b8zhong b8zhong added blackwell SM100/SM120 quant LLM Quantization labels Jul 30, 2026
`--quantization mxfp8` on a non-fp8 checkpoint builds
`Fp8Config(use_mxfp8=True, is_checkpoint_fp8_serialized=False)`, which
`create_fp8_weight_` rejected with "MXFP8 requires fp8-serialized checkpoint
for linear layers.". The guard used to sit inside the
`if is_checkpoint_fp8_serialized:` branch, where it was unreachable; hoisting
it out during the static-method refactor made it fire. Drop it and let
`process_weights_after_loading` quantize the bf16 weights as it already does.
@b8zhong
b8zhong force-pushed the fix/online-mxfp8-linear branch from 5b08a4e to ba20cb4 Compare July 30, 2026 18:25
@mmangkad
mmangkad enabled auto-merge (squash) July 30, 2026 23:22
mmangkad and others added 3 commits July 31, 2026 07:23
fused_a_gemm_weight_eligible() inspects fc1_latent_proj.weight, but quant
methods rewrite that weight in process_weights_after_loading (e.g. bf16 ->
float8_e4m3fn), so the check at construction time sees a non-final dtype.
Defer it to the first forward instead.
@mmangkad
mmangkad merged commit f94d2c5 into main Jul 31, 2026
150 of 165 checks passed
@mmangkad
mmangkad deleted the fix/online-mxfp8-linear branch July 31, 2026 06:42
@fxmarty-amd

Copy link
Copy Markdown
Contributor

Thanks @b8zhong

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

Labels

blackwell SM100/SM120 quant LLM Quantization run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants