Repository navigation
[SM100] Support per-expert normalization for MegaMoE - #104
Merged
Merged
Conversation
Import docker/muse_spark/deep_gemm.patch from sgl-project/sglang at ba5b73d08096066cd35f02a95d469be91c21219b. Adapt its bindings to TORCH_LIBRARY and preserve current SiTU template parameters.
1 of 9 tasks
1 of 2 tasks
zcnrex
added a commit
that referenced
this pull request
Oct 16, 2026
…-ai#471) into dev Two-parent merge of upstream 1fc9c66 (deepseek-ai#441, deepseek-ai#462, deepseek-ai#471) into sgl dev b296ce3, keeping the SGL wheel, the TORCH_LIBRARY binding and the downstream kernels. - Mega MoE: upstream locality-domain scheduling, 4D weight TMA, L1/L2 store blocks and the TMEM prefetch epilogue, with NVFP4/MXFP4, TRT-LLM weights, alphas, SiTU and FP8 combine carried over. TRT weights stay unlocalized. - GEMM epilogue classes threaded through every dispatch; SM90/SM120 assert that no custom epilogue is set. SM120 kernels drop the head-split epilogue parameter, as upstream did for SM90. - Attention takes upstream's API as-is: no clean_logits/logits_dtype, no legacy fp8_mqa_logits/fp8_paged_mqa_logits, no fp8_gemm_nt_skip_head_mid. The SM120 MQA kernels that only served the old API are removed. - Mega gate is sqrtsoftplus-only; bf16_mega_gate defaults to it and get_bf16_mega_gate_config is gone. - TORCH_LIBRARY binding: epilogue classes (Identity, Alpha, FP8CastWithClamp, BF16StochasticRounding) cross as (kind, scalar, sfd, count) into every GEMM/einsum op; shutdown and the locality-domain ops are registered; MLOPart reaches Python through ctypes callbacks installed by deep_gemm/locality_domain.py, which re-raises the callback's exception from the allocating call. - sgl_deep_gemm tests pick up upstream's test changes and the new test_locality_domain.py. - Dev's per-expert post-norm (#104) sits on upstream's restructured epilogue and combine. Its store block of 48 at block_m 192 becomes the L1 store block, upstream's FP8xFP4 L1/L2 blocks at 240 are kept, and DG_MEGA_MOE_TILES sets both L1 and L2. - deep_jit stays at dev's 3732a3b, a descendant of upstream's 2efdab4. 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.
MegaMoE gains optional post-expert RMS normalization before combining routed expert outputs, including an optional FP32 gain and weight-first normalization. This ports the MegaMoE changes from the Muse Spark DeepGEMM patch onto current
dev.DG_MEGA_MOE_TILESoverride, normalization test mode,DG_SKIP_LEGACYoption, and recipe fix.TORCH_LIBRARYwrappers and schemas, retaining the SiTU template parameters introduced after the patch'scbe1727base.Validation:
cbe1727and checked the port for retained changes.git diff --checkand Python syntax checks pass.clang++ -std=c++20 -fsyntax-onlyagainst local PyTorch headers and the current MegaMoE API declarations. This checks the host bindings, not CUDA compilation.b1c6fb0on 4 x GB300 (SM103, driver 580.178.04), PyTorch 2.13.0+cu130, CUDA 13.0, GCC 13.3, in an isolated environment.memcheckandsynccheckpassed for BF16, FP8xFP4 and NVFP4, each with 0 reported errors. Unfiltered synccheck hit an internalnvjetlaunch error in the PyTorch reference matmul, also reproduced without DeepGEMM. The final synccheck runs use the repository's existing--kernel-name-exclude kns=nvjetsetting; all DeepGEMM kernels remain instrumented.