Skip to content

[None][feat] Add MegaMoE support for MiniMax-M3 - #17907

Merged
peihu-nv merged 4 commits into
NVIDIA:feat/m3_with_msafrom
peihu-nv:peihengh/minimax-m3-megamoe-feat-20260817
Aug 19, 2026
Merged

peihu-nv merged 4 commits into
NVIDIA:feat/m3_with_msafrom
peihu-nv:peihengh/minimax-m3-megamoe-feat-20260817

Conversation

@peihu-nv

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

Add MegaMoE CuTeDSL support for MiniMax-M3 on the feat/m3_with_msa branch.

This PR:

  • ports the MegaMoE CuTeDSL update from the already-merged [None][feat] Update CuTeDSL MegaMoE kernels #16190 because the
    feature branch does not contain it;
  • adds MiniMax-M3's SwiGLUBias activation to MegaMoE, including uniform
    swiglu_alpha, swiglu_beta, and swiglu_limit propagation through the
    backend, custom-op ABI, compile/cache identity, and CuTeDSL epilogue;
  • preserves the standard SwiGLU path when those MiniMax constants are absent;
  • fixes shared-expert composition for fused-communication MoE backends by
    computing routed_global + AllReduce(shared_local), avoiding a second
    reduction of the already-global routed contribution; and
  • disables the incompatible deferred post-MoE AllReduce+RMSNorm fusion for
    fused-communication backends.

The default MiniMax-M3 MoE backend is unchanged. MegaMoE remains an explicit
backend selection.

Test Coverage

  • Added unit coverage for uniform MiniMax-M3 SwiGLUBias construction,
    rejection of non-uniform parameters, preservation of standard SwiGLU, and
    external- versus fused-communication composition.
  • Validated the patch-equivalent SwiGLU and SwiGLUBias kernels in eager and
    CUDA graph execution at M32 and M64 on four Blackwell GPUs.
  • Validated matched MiniMax-M3 GEN/decode runs with BF16 combine and MegaMoE
    tactic autotuning disabled; device-step P50 improved by 8.2-11.9% across
    DEP8, DEP16, and DEP32.
  • All 34 changed files pass the changed-file pre-commit suite; all changed
    Python files pass syntax compilation.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@peihu-nv
peihu-nv requested review from a team as code owners August 18, 2026 15:59
@peihu-nv peihu-nv added the api-compatible Accepted LLM API contract change that is backwards-compatible label Aug 18, 2026
@peihu-nv

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67107 [ run ] triggered by Bot. Commit: 52fb7fe Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #67107 [ run ] completed with state SUCCESS. Commit: 52fb7fe
/LLM/main/L0_MergeRequest_PR pipeline #54644 completed with status: 'SUCCESS'

CI Report

Link to invocation

- unittest/_torch/modules/fused_moe/test_deepgemm_fused_gather_finalize.py
- unittest/_torch/modules/fused_moe/test_deepgemm_fused_expand_quant.py
# ------------- MoE: test_moe_backend (by backend) ---------------
- unittest/_torch/modules/moe/test_megamoe_streaming_load.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This registers the new file, but the six tests added to test_moe_backend.py won't be collected. That file is only ever listed by individual nodeid — l0_b200 lines 117 and 348-354, l0_b300 lines 41 and 80-83, l0_h100 line 438 — and none of them match the new functions:

  • test_megamoe_cutedsl_accepts_uniform_minimax_m3_swiglu_bias
  • test_megamoe_cutedsl_rejects_nonuniform_swiglu_bias
  • test_megamoe_cutedsl_standard_swiglu_keeps_original_activation_path
  • test_megamoe_cutedsl_tuning_mode_forces_top_maxt_bucket
  • test_megamoe_cutedsl_tactic_autotune_defaults_off
  • test_enumerate_megamoe_candidate_tactics_curated_space

(test_minimax_m3.py is fine — l0_b200_m3.yml:21 lists it as a whole file, so the new composition test is picked up.)

@brb-nv brb-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@peihu-nv
peihu-nv merged commit 3197c64 into NVIDIA:feat/m3_with_msa Aug 19, 2026
5 of 6 checks passed
brb-nv pushed a commit to brb-nv/TensorRT-LLM that referenced this pull request Aug 25, 2026
Signed-off-by: Barry Kang <[email protected]>
Signed-off-by: peihengh <[email protected]>
Co-authored-by: Barry Kang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-compatible Accepted LLM API contract change that is backwards-compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants