Skip to content

[WIP][ROCm][MiniMax-M3] Fold routed scaling into the AITER top-k weights - #64206

Closed
micah-wil wants to merge 4 commits into
vllm-project:minimax-m31-flashfrom
ROCm:m31-moe-scale-fold
Closed

micah-wil wants to merge 4 commits into
vllm-project:minimax-m31-flashfrom
ROCm:m31-moe-scale-fold

Conversation

@micah-wil

@micah-wil micah-wil commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Without shared-expert fusion, have the router fold routed_scaling_factor into the top-k weights instead of scaling the bf16 MoE output, and pass the factor to AITER's biased_grouped_topk, which applies it in-kernel, rather than multiplying the weights afterwards. Removes one elementwise kernel per MoE layer

Overview

Claims

Validation

Details


Pull Request Checklist
  • I used vLLM's /pr-checklist skill. (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.

BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing (anything written below this line will be removed by GitHub Actions)

zyongye and others added 3 commits October 27, 2026 06:40
… ROCm

Squash of the MiniMax-M3.1 serving branch, rebased on 5d35ce3.

NVIDIA:
- Route NVFP4 routed experts in MXFP8 checkpoints to the CT NVFP4 MoE
- NVFP4 KV cache on the MSA sparse attention path, served only by the
  CUTLASS Q8KV4 kernels (E4M3 query) on SM100/SM103/SM107
- NVFP4 index-K cache via the MSA Q8KV4/Q8KV8 indexers; opt-in decode
  context parallelism for the NVFP4 indexer at TP4
- Vendor fmha_sm100 from vllm-project/MSA dev 25c1447
- NVFP4 MSA decode past 512 sequences: Q8KV4 limits, bounded indexer and
  plan memory
- Decode metadata before the forward: 13 ops -> 2; in-place indexer I/O,
  no counter reset, PDL chain for the NVFP4 sparse decode
- DeepGEMM NVFP4 MegaMoE on the unified DeepGemmMegaMoEExperts layer;
  per-token FC1 input scales outside MegaMoE; split staging rows over
  programs
- Fuse small-batch MoE finalize into the all-reduce + Gemma norm + MXFP8
  quant
- QKV+indexer MXFP8 GEMM with fused epilogue; SM100 fused dense GEMM1
- Fused QK-norm/RoPE/KV insert: persistent row-group kernel
- Read aux hidden states after the deferred TP all-reduce
- FA4: pass no FP8 descale for a unit per-tensor scale
- Keep KV cache zeroing for mixed-precision UniformTypeKVCacheSpecs groups
- Clear per-token A4 metadata for NVFP4 W4A16 MoE kernels (Marlin only)
- Hand the Q8KV4 prefill a per-device split workspace
- Align image preprocessing: long-side resize with detail tiers, fp32
  patch embedding
- NIXL KV-head re-sharding for per-head-contiguous NVFP4 pages; BLHNC
  layout for NIXL transfer
- SimpleCPUOffload: 1 GiB HugeTLB host buffer + PreferCE batch copies

Spec decode:
- DSpark for MiniMax-M3.1: draft model, fixes and perf; default the draft
  to the checkpoint's dspark/ subfolder
- Fuse the draft's q/k norm + RoPE and its context-K/V write
- FLASHINFER_TS: prims_ts paged decode for non-causal draft blocks
- Store the draft tokens' K/V under torch.compile
- Markov sampling: one step helper, bias in the Gumbel kernel
- DFlash: pad the prepared inputs in wide blocks on every platform

ROCm:
- Re-quantize the NVFP4 routed experts to MXFP8 (or MXFP4) at load;
  NVFP4 -> MXFP4 re-quantization and fused shared experts through the
  online quantization API
- Mono decode (one FlyDSL launch per layer): native MXFP8 shared expert,
  top-16 sort/merge, aux hidden states, indexer CP
- NVFP4 KV + NVFP4 indexer on gfx950, decode indexer CP
- Tune small-M MXFP8 linears
- Sequence-parallel prefill under pure TP (opt-in), with MXFP4 MoE
  support; TBO/DBO under pure TP; warm the microbatch threads' hipBLASLt
  handles at init
- gfx942: avoid the load-time FP8 MoE quant crash; fall back from the
  fused QK-norm
- Keep the NVFP4 KV-insert helpers CUDA-only so the fused kernel builds
  on HIP

Co-authored-by: Taoyu Zhu <zhutaoyu97@gmail.com>
Co-authored-by: Hongxia Yang <hongxia.yang@amd.com>
Co-authored-by: qizixi <22851944+zixi-qi@users.noreply.github.com>
Co-authored-by: indivats <Indira.Vats@amd.com>
Co-authored-by: andyluo7 <43718156+andyluo7@users.noreply.github.com>
Co-authored-by: Thien Tran <gau.nernst@yahoo.com.sg>
Co-authored-by: Jee Jee Li <pandaleefree@gmail.com>
Co-authored-by: fxmarty-amd <felmarty@amd.com>
Co-authored-by: Jiejing Zhang <280536569+jiejingzhangamd@users.noreply.github.com>
Co-authored-by: Prasun Gera <pgera@users.noreply.github.com>
Co-authored-by: Dao Le <daole@inferact.ai>
Co-authored-by: Isotr0py <mozf@inferact.ai>
Co-authored-by: Neha Prakriya <neha.prakriya@amd.com>
Co-authored-by: Summer Yang <girasoley@inferact.ai>
Co-authored-by: Zhewen Li <jerven.vllm@gmail.com>
Co-authored-by: Zijing Liu <liuzijing2014@users.noreply.github.com>
Co-authored-by: xiaozhoupy <peiyuanzhou1994@gmail.com>
Co-authored-by: v <v@inferact.ai>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
…wn PRs (vllm-project#63490)

Signed-off-by: Taoyu Zhu <zhutaoyu97@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ssage (vllm-project#63492)

Signed-off-by: Seungmin Kim <8457324+ehfd@users.noreply.github.com>
@mergify mergify Bot added minimax rocm Related to AMD ROCm labels Oct 28, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Oct 28, 2026
Without shared-expert fusion, have the router fold routed_scaling_factor
into the top-k weights instead of scaling the bf16 MoE output, and pass the
factor to AITER's biased_grouped_topk, which applies it in-kernel, rather
than multiplying the weights afterwards. Removes one elementwise kernel per
MoE layer; the weights are bit-identical.

Signed-off-by: Micah Williamson <micah.williamson@amd.com>
@mergify mergify Bot added ci/build deepseek Related to DeepSeek models multi-modality Related to multi-modality (#4194) performance Performance-related issues quantization qwen Related to Qwen models kimi k3 DSv4.1 Related to DeepSeek-V4.1 models nvidia labels Oct 29, 2026
@mergify mergify Bot added speculative-decoding dflash mrv2 Model Runner V2 specific labels Oct 29, 2026
@mergify mergify Bot added the tool-calling label Oct 29, 2026
@mergify

mergify Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @micah-wil.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Oct 29, 2026
@github-project-automation github-project-automation Bot moved this to Unsorted queue in Tool Calling (arpera) Oct 29, 2026
@github-project-automation github-project-automation Bot moved this to Unsorted queue in Tool Calling Oct 29, 2026
@zyongye
zyongye force-pushed the minimax-m31-flash branch 3 times, most recently from 1f5ea52 to f4ca759 Compare October 29, 2026 17:08
@mergify mergify Bot added the nixl NIXL KV connector / multi-tiered KV offloading (KVCR) label Oct 29, 2026
@khluu
khluu force-pushed the minimax-m31-flash branch from f4ca759 to f4bf304 Compare October 29, 2026 20:59
@zyongye
zyongye deleted the branch vllm-project:minimax-m31-flash November 2, 2026 02:43
@zyongye zyongye closed this Nov 2, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Nov 2, 2026
@github-project-automation github-project-automation Bot moved this to Done in NVIDIA Nov 2, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Sprint - DFlash Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build deepseek Related to DeepSeek models dflash DSv4.1 Related to DeepSeek-V4.1 models k3 kimi kv-cache-manager kv-connector minimax mrv2 Model Runner V2 specific multi-modality Related to multi-modality (#4194) needs-rebase nixl NIXL KV connector / multi-tiered KV offloading (KVCR) nvidia performance Performance-related issues quantization qwen Related to Qwen models rocm Related to AMD ROCm scheduler speculative-decoding tool-calling

Projects

Status: Done
Status: Done
Status: Done
Status: Unsorted queue

Development

Successfully merging this pull request may close these issues.

4 participants