Repository navigation
[SM90] Use continuous FP32 activation scale in MegaMoE (drop UE8M0) - #63
Merged
Fridge003 merged 1 commit intoJul 18, 2026
Merged
Conversation
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
approved these changes
Jul 18, 2026
Helicoplacoidea
pushed a commit
to Helicoplacoidea/DeepGEMM
that referenced
this pull request
Aug 31, 2026
…gl-project#63) Co-authored-by: yinding <[email protected]> Co-authored-by: Claude Opus 4.8 <[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.
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.