mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #445] fix(sm90): support parameterized SwiGLU in FP8 MegaMoE #451
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#451
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/445
Author: @shiyang814-cpu
Created: 9/14/2026
Status: 🔄 Open
Base:
nv_dev← Head:bugfix/sm90-megamoe-parameterized-swiglu-deepseek📝 Commits (2)
45cef20fix(sm90): support parameterized SwiGLU in FP8 MegaMoE8645ed6fix(sm90): align JIT template arguments📊 Changes
5 files changed (+75 additions, -21 deletions)
View changed files
📝
csrc/apis/sm90_mega.hpp(+13 -5)📝
csrc/jit_kernels/impls/sm90_fp8_mega_moe.hpp(+10 -0)📝
deep_gemm/include/deep_gemm/impls/sm90_fp8_mega_moe.cuh(+14 -9)📝
deep_gemm/mega/__init__.py(+4 -1)📝
tests/test_mega_moe_sm90.py(+34 -6)📄 Description
Summary
This PR adds parameterized SwiGLU support to the SM90 FP8 MegaMoE kernel.
The existing implementation assumes standard SwiGLU:
Some MoE models use parameterized OAI-SwiGLU instead:
For example, MiniMax-M3 uses:
Without these parameters, the SM90 MegaMoE kernel applies standard SwiGLU semantics to models that require OAI-SwiGLU, which produces incorrect model outputs.
Root Cause
The SM90 FP8 MegaMoE epilogues currently hardcode:
Although the activation clamp is configurable, the sigmoid alpha and up-projection bias are not represented by the Python API, host API, or JIT kernel template.
As a result, the generated kernel cannot reproduce parameterized SwiGLU semantics. This affects both the optimized swapAB epilogue and the non-swapAB epilogue.
Changes
activation_alphaandactivation_up_biasto the Python SM90 FP8 MegaMoE API.swigluoaiin the SM90 buffer allocation and execution APIs.activation_alpha=1.702activation_up_bias=1.0activation_clamp=7.0Compatibility
The new parameters default to standard SwiGLU behavior:
Therefore, existing callers that do not provide the new parameters retain the original behavior:
The new activation name is additive, and no behavior change is expected for existing SM90 MegaMoE workloads.
Validation
The change was validated on Hopper GPUs in a real two-node prefill/decode disaggregated deployment.
Environment
MiniMax-M3 uses the following OAI-SwiGLU parameters:
Kernel Accuracy
The SM90 MegaMoE kernel output was compared against the reference implementation on 8 Hopper GPUs.
Both the swapAB and non-swapAB epilogues therefore preserve the expected parameterized SwiGLU semantics.
End-to-End P/D Validation
The patched kernel was also validated in a two-node P/D deployment:
DeepEP normal was active on the prefill node.
SM90 FP8 MegaMoE was active on the decode node.
No fallback to Triton or another MoE backend occurred.
Deterministic English generation passed.
Deterministic Chinese generation passed.
MMLU smoke evaluation passed:
8/8.No corrupted output, scheduler exception, or kernel traceback was observed.
The DeepGEMM JIT cache was cleared before validation to ensure that the generated SM90 kernels were rebuilt from the patched headers.
Static Checks
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.