Skip to content

[SM90] Use continuous FP32 activation scale in MegaMoE (drop UE8M0) - #63

Merged
Fridge003 merged 1 commit into
sgl-project:devfrom
qiushixiaoyu:sm90-mega-moe-fp32-act-scale
Jul 18, 2026
Merged

Fridge003 merged 1 commit into
sgl-project:devfrom
qiushixiaoyu:sm90-mega-moe-fp32-act-scale

Conversation

@qiushixiaoyu

Copy link
Copy Markdown

The SM90 MegaMoE L1 epilogue quantized the L2-GEMM input activation with a power-of-two (UE8M0) scale factor. SM90 WGMMA has no hardware block-scale operand -- the SF is applied as a plain FFMA in the epilogue -- so the power-of-two constraint bought nothing on SM90 (unlike SM100 tcgen05, whose block-scaled MMA encodes UE8M0 into the instruction descriptor). It only cost precision, and it turned a ~1e-4 perturbation in the folded topk_weight into an O(1) error whenever amax crossed a power-of-two boundary (the whole row's e4m3 grid shifted by 2x).

Switch to a continuous fp32 scale. The activation SF pool is already fp32, so this is byte/layout/stride-neutral and needs no retuning; it also matches the input quantizer in sm90_mega_moe_pre_dispatch.cuh, which is already continuous. Clamp amax before the reciprocal (padded rows have amax==0; 448/0=inf -> 0*inf=NaN).

Validated on DeepSeek-V4-Flash-FP8 (H20, SM90 FP8 MegaMoE), GPQA-diamond n-repeats=16 (3168 samples): with the Triton fused gate and no env workaround, no_answer dropped from 6.6% to 0.03% and pass@1 rose from 81.3% to 87.5%, matching the torch-reference-gate baseline.

The SM90 MegaMoE L1 epilogue quantized the L2-GEMM input activation with a
power-of-two (UE8M0) scale factor. SM90 WGMMA has no hardware block-scale
operand -- the SF is applied as a plain FFMA in the epilogue -- so the
power-of-two constraint bought nothing on SM90 (unlike SM100 tcgen05, whose
block-scaled MMA encodes UE8M0 into the instruction descriptor). It only cost
precision, and it turned a ~1e-4 perturbation in the folded topk_weight into an
O(1) error whenever amax crossed a power-of-two boundary (the whole row's e4m3
grid shifted by 2x).

Switch to a continuous fp32 scale. The activation SF pool is already fp32, so
this is byte/layout/stride-neutral and needs no retuning; it also matches the
input quantizer in sm90_mega_moe_pre_dispatch.cuh, which is already continuous.
Clamp amax before the reciprocal (padded rows have amax==0; 448/0=inf ->
0*inf=NaN).

Validated on DeepSeek-V4-Flash-FP8 (H20, SM90 FP8 MegaMoE), GPQA-diamond
n-repeats=16 (3168 samples): with the Triton fused gate and no env workaround,
no_answer dropped from 6.6% to 0.03% and pass@1 rose from 81.3% to 87.5%,
matching the torch-reference-gate baseline.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Fridge003
Fridge003 merged commit 4a25337 into sgl-project:dev Jul 18, 2026
Helicoplacoidea pushed a commit to Helicoplacoidea/DeepGEMM that referenced this pull request Aug 31, 2026
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.

2 participants