Repository navigation
[Perf][MiniMax-M3] (NVIDIA-only) Fused norm+quant MXFP8 - #64852
Merged
Merged
Conversation
gau-nernst
force-pushed
the
m3-norm-mxfp8
branch
4 times, most recently
from
October 31, 2026 06:31
cc44c4b to
157e4dc
Compare
gau-nernst
force-pushed
the
m3-norm-mxfp8
branch
6 times, most recently
from
October 31, 2026 10:11
9ad5687 to
6f2996c
Compare
…P8 input All MiniMax-M3 NVIDIA Gemma RMSNorm call sites run as one Triton kernel (ops/norm_mxfp8.py): the input norm (fused add and layer 0's plain norm), the final norm, the MTP embed/hidden norms, and the dspark drafter's per-head context norms (leading dims flattened; the kernel normalizes the last dim). When qkv_proj consumes MXFP8 the input norm additionally writes its input directly (E4M3 data, UE8M0 scales in the 128x4 swizzled layout), deleting the separate quantize kernel, which re-reads the full normed activation. The output format is chosen per call from get_input_quant_key(qkv_proj) == kMxfp8Dynamic with a FlashInfer MXFP8 linear kernel, following the Qwen3.5 fused norm+quant dispatch. TP>1 input norms keep the fused all-reduce + norm. The token count is marked do_not_specialize (varies per call; one compiled variant per output format); the hidden size stays constexpr. Accuracy bar: residual and scales bitwise, quantized codes within one E4M3 step. BF16-out norm matches FlashInfer's norm within 1 BF16 ulp and is 1.006-1.35x faster at every M measured except a noise-level 0.99x cell (plain norm, M=1024), GB300, H=6144. Kernel (CUPTI, cold L2, H=6144, GB300, fused vs norm->quantize chain): 1.39x at M=1, 1.60x at 16, 1.41x at 1K, 1.46x at 4K, 1.55x at 16K; 6.46 TB/s at 16K, ~96% of the measured streaming ceiling. Co-Authored-By: Kimi Code <noreply@moonshot.cn> Signed-off-by: Thien Tran <gau.nernst@yahoo.com.sg>
gau-nernst
force-pushed
the
m3-norm-mxfp8
branch
from
October 31, 2026 10:15
6f2996c to
7ca045c
Compare
gau-nernst
marked this pull request as ready for review
October 31, 2026 10:19
gau-nernst
requested review from
AndreasKaratzas,
DarkLight1337 and
ywang96
as code owners
October 31, 2026 10:20
Contributor
Author
|
/ci run |
|
✅ Triggered Buildkite CI #98929 for commit ℹ️ This PR is 23 commits behind upstream |
zyongye
approved these changes
Nov 2, 2026
6 tasks done
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.
Overview
Add a new Triton kernel for fused norm+quant MXFP8. To simplify integration, this kernel also covers additional no-quantize callsites:
dspark drafter's per-head norms remain on FlashInfer kernels.
Claims
Validation
.venv/bin/python -m pytest tests/models/minimax_m3/test_norm_mxfp8.py -v→ 13 passed on GB300.pre-commit: all hooks passed.Microbenchmark
Fused MXFP8 norm vs FlashInfer norm + separate MXFP8 quantize chain
BF16-out norm parity vs FlashInfer norm
Faster everywhere except plain M=1024 tokens (0.99×, noise level; a standalone re-measure had the ordering flipped). In the MXFP8 checkpoint, the BF16 path serves the post-attention norm (TP1 branch of the fused all-reduce helper), the final norm, and the MTP norms.
E2E serving
vllm bench serve; MiniMax-M3.1-Flash on GB300; base =upstream/main, PR = this branch.--moe-backend deep_gemm_mega_moe); both configs use dspark speculative decoding.Prefill: PP2 TP1, 100k-token random prefix + 8k-token input, 1 output token.
Decode: DEP4, 60k-token cached prefix, 1024 output tokens.
Speedup is per-round paired (base vs PR within the same run), range across 2 rounds; decode is neutral at c=32 and faster at c≥128, so the fusion does not regress decode.
GSM8K
MiniMax-M3.1-Flash, PP2 TP1 on 2× GB300; first 500 examples, 5-shot, temperature 0,
max_tokens=8192:0.002 delta = 1 question, within run-to-run noise; the BF16 norm path differs from FlashInfer by at most 1 ulp, MXFP8 path is bitwise-identical.
Details
MiniMAXGemmaRMSNorm.forwardcalls the Triton kernel (ops/norm_mxfp8.py) viagemma_rmsnorm_mxfp8(x, weight, eps, residual=None, mxfp8=True).forward_input_normpassesmxfp8=Truewhenget_input_quant_key(qkv_proj) == kMxfp8Dynamicwith a supported FlashInfer MXFP8 linear kernel.tl.constexpr; token count isdo_not_specialize(2 compiled variants total: MXFP8 on/off). Specializes onNoneresidual/sfpointers instead of constexpr flags; asserts 2-D row-contiguous inputs, with arbitrary row stride supported.gdc_waitbefore any global access, thengdc_launch_dependents.Duplicate-work check (2026-10-31): no open NVIDIA MiniMax-M3 TP1 norm+MXFP8 PR found.
AI assistance: Kimi Code assisted with the implementation; Codex wrote this PR description.
Pull Request Checklist
/pr-checklistskill. (Mandatory for agents, optional for humans).BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing (anything written below this line will be removed by GitHub Actions)