{{ message }}
Repository navigation
[Perf][MiniMax-M3] MSA prefill attends with the E4M3 query; bump fmha_sm100 to 968061a - #60684
Merged
zyongye merged 6 commits intoOct 11, 2026
Conversation
… a BF16 copy With CUTLASS sparse decode on (an NVFP4 KV cache, or an FP8 E4M3 cache with the CUTLASS MSA decode backend), the fused insert writes only an E4M3 query, and MiniMaxM3SparseMSAImpl dequantized it into the BF16 query buffer before every prefill. Both fmha_sm100 prefill kernels take an E4M3 query natively: sparse_atten_func runs FP8 QK/PV MMAs over the FP8 cache, and sparse_atten_nvfp4_kv_func stages the NVFP4 cache to E4M3 instead of BF16. Prefill now passes the E4M3 query as is with q_scale folded into the softmax scale; only the Triton decode fallback still reads the dequantized copy. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
be4a52a -> dev 968061a. This brings the Blackwell (SM100/SM103) sparse prefill port, which now also serves an FP8 query over strided K/V views such as vLLM's packed K|V pages, so FP8-cache MiniMax-M3 prefill runs on it. The APIs vLLM calls (fmha_sm100 / fmha_sm100_plan / _fmha_sm100(_plan) / sparse_topk_select / sparse_atten_func / sparse_atten_nvfp4_kv_func / nvfp4_head_slot_views) keep their signatures, and vLLM's decode plans still pin decode_backend="kv_mode3". Install the files the package now imports: _jit_cache.py, msa_warmup.py, q8kv4_prefill_adapter.py and prefill_q8kv4/. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
zyongye
marked this pull request as ready for review
October 8, 2026 20:14
zyongye
requested review from
AndreasKaratzas,
Harry-Chen,
LucasWilkinson,
WoosukKwon,
mgoin,
tlrmchlsmth and
yewentao256
as code owners
October 8, 2026 20:14
Member
Author
|
/ci run |
|
✅ Triggered Buildkite CI #93707 for commit |
7 tasks done
Member
Author
|
/ci run |
zyongye
enabled auto-merge (squash)
October 10, 2026 06:33
|
✅ Triggered Buildkite CI #93993 for commit |
…ll tests The E4M3-query prefill kernels round each split's probabilities to E4M3, and the split schedule follows the SM count, so a rare output element lands just past atol/rtol 0.05: on B200, 1 of 4.1M elements in the TP1 NVFP4 prefill test (0.057 vs 0.052 allowed). The FP8 and NVFP4 prefill tests now require all but 1e-4 of the elements within 0.05/0.05 and bound the rest at 0.25, as other fp8-q prefill tests do. On GB300 over 16 seeds the worst case is 2.4e-7 of the elements outside 0.05/0.05 and 0.07 max abs error. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
Member
Author
|
/ci run |
ZJY0516
approved these changes
Oct 11, 2026
michael-gpu
pushed a commit
to practical-inference/vllm-ampere-extended
that referenced
this pull request
Oct 20, 2026
…_sm100 to 968061a (vllm-project#60684) Signed-off-by: Yongye Zhu <zyy1102000@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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
With CUTLASS MSA sparse decode on (an NVFP4 KV cache, or an FP8 E4M3 cache with the
CUTLASS_MSAdecode backend), the fused QK-norm/RoPE/insert kernel writes MiniMax-M3's query only in E4M3.MiniMaxM3SparseMSAImplthen dequantized it back into the BF16 query buffer before every prefill. Bothfmha_sm100prefill kernels take an E4M3 query natively, so prefill now passes it through as is. The PR also bumpsfmha_sm100(vllm-project/MSA) frombe4a52ato968061a. The new pin includes MSA's Blackwell prefill port, which now serves an E4M3 query over vLLM's packed K|V pages (vllm-project/MSA#32).Claims
Validation
Tests: on GB300 (SM103, CUDA 13.4,
fmha_sm100built from the new pin),pytest tests/kernels/attention/test_minimax_m3_msa_cutlass_sparse_decode.py tests/kernels/attention/test_minimax_m3_fp8_triton_indexer.py tests/kernels/attention/test_minimax_m3.py tests/kernels/test_minimax_m3_sparse_attn_fp8_scale.py tests/kernels/test_fused_minimax_m3_qknorm_rope_kv_insert.pygives 240 passed, 45 skipped. All skips are ROCm-only tests. The MSA test file runs in CI on B200.test_msa_prefill_reads_query_fp8_over_fp8_cache[tp1|tp4]covers FP8-cache prefill, including chunks over cached context, with CUTLASS decode on. It checks thatsparse_atten_funcreceives the E4M3 query and that the output matches Triton on the dequantized query.test_msa_prefill_nvfp4_matches_triton_on_dequantized_cachenow checks thatsparse_atten_nvfp4_kv_funcreceives the E4M3 query. Its reference is now the cache as an E4M3-query kernel reads it (see Details).[torch.bfloat16] == [torch.float8_e4m3fn].Performance:
MiniMaxM3SparseMSAImpl.forwardon prefill-only batches (build_k2q_csr+ attention + combine, plus the dequant where the query is BF16). GB300, one request, top-k 16, page 128. Each value is the median of 3×50 iterations after warmup; spread ≤1%, except ±5% on the first FP8 row of the main run.be4a52a, BF16 q)Percentages are relative to main. With the new pin, a BF16 query over the FP8 cache also reaches the Blackwell port, but with BF16 MMAs. The E4M3 query gives the bulk of the FP8 gain at either pin: on main's pin alone it is 13–24% (411 → 356, 462 → 367, 801 → 623, 1423 → 1083, 1498 → 1162 µs).
Benchmark script (run from the repo root with
PYTHONPATH=.)No end-to-end accuracy eval or serving benchmark is included; validation is the kernel-level numerics and per-layer timings above.
Details
Kernel capability (MSA
968061a; same atbe4a52aexcept the Blackwell port):sparse_atten_funcaccepts an FP8 E4M3 query over FP8 E4M3 K/V and runs FP8 QK/PV MMAs, on the Blackwell port when eligible. The BF16-Q × FP8-K/V mode stages K/V up to BF16 instead.sparse_atten_nvfp4_kv_funcaccepts a BF16 or E4M3 query. With E4M3 it dequantizes each NVFP4code × block_scaleto E4M3 instead of BF16, and applies the K global scale to the scores and the V global scale in the combine.Scales:
q_scalefolds intosoftmax_scale. The FP8 cache is written with unit scales and the NVFP4 global scales are passed as before, so K/V scale handling is unchanged.Numerics: the E4M3-query kernels round the softmax probabilities to E4M3. The NVFP4 kernel also rounds K/V to E4M3. On the NVFP4 test (TP1):
On the FP8 test the max abs error is ≈0.03.
Limitations: validated on SM103. SM100 is covered by the CI kernel job. The E4M3-query NVFP4 kernel is untested on SM107 here.
MSA pin bump (
be4a52a→968061a):fmha_sm100,fmha_sm100_plan,_fmha_sm100(_plan),sparse_topk_select,sparse_atten_func,sparse_atten_nvfp4_kv_funcandnvfp4_head_slot_views.decode_backend="kv_mode3". The newprefill_backendplan option only routes sparse-prefill plans built throughfmha_sm100_plan, which vLLM does not use._jit_cache.py,msa_warmup.py,q8kv4_prefill_adapter.pyandprefill_q8kv4/.Duplicate check: no open PR touches the MSA prefill query or
fmha_sm100.cmake. Open MiniMax-M3 MSA PRs (#55838, #56932, #59979) change decode or indexer metadata only.AI assistance (Claude Code) was used to investigate, implement, test and benchmark this change.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
🤖 Generated with Claude Code