Repository navigation
[SM10x] Mega MoE: recover the NVFP4 prefill perf regression - #170
Merged
Merged
Conversation
zcnrex
added a commit
that referenced
this pull request
Nov 25, 2026
Resolve the get_block_config_for_mega_moe conflict: keep the SM103/SM107 NVFP4 decode block_m floor and #170's NVFP4 192-row cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zcnrex
added a commit
that referenced
this pull request
Nov 25, 2026
…ompiled arch - Host picks the SM10x arch from the JIT target (`103a` / `107a` / `100f`), so an older NVCC that compiles CC 10.3 / 10.7 as `100f` gets the `Default` policy instead of a K=96 / K=128 request the kernel cannot run. - Rename the mainloops by arch: Default, SM107PackedK64, SM103UltraK96, SM107K128. - The device plan no longer downgrades the request: it static_asserts the mainloop's constraints and that the compiled arch supports it. MegaMoEEffectiveMainloop and the plan's arch parameter are gone. - SM103 K=96 is selected only for BLOCK_M <= 192. The compact 32-col K=96 ring for BLOCK_M = 240 is removed: NVFP4 is capped at 192 since #170, so it was only reachable through DG_MEGA_MOE_TILES, which now runs `Default`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
aryatsc
added a commit
to aryatsc/DeepGEMM
that referenced
this pull request
Nov 28, 2026
Brings in sgl-project#170, sgl-project#165, sgl-project#169, sgl-project#178 and sgl-project#171. Conflicts: - csrc/jit_kernels/impls/sm100_fp8_fp4_mega_moe.hpp: the K=64 switch is now `uses_packed_fp4_weights(config.mainloop)` (sgl-project#165); the row-shuffled FP8 x FP4 layout asserts that mainloop instead of `config.use_sm107_k64`. The kernel template takes the mainloop in place of the two K=64 / K=96 flags, followed by this branch's four parameters. - deep_gemm/include/deep_gemm/impls/sm100_fp8_fp4_mega_moe.cuh: sgl-project#165's mainloop plan and validity check replace the K=64 static assert; the base MMA loop is taken from dev (now under `run_base_loop`) with this branch's SFB word order for row-shuffled packed FP4 weights re-applied in it.
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.
Problem
NVFP4 MegaMoE prefill on the Muse shape (256 experts, top 8, hidden 4096, intermediate 4096, post-expert norm) became slower after #162 and #160. At 16K tokens it is about 1.34x slower on CC 10.7 and about 1.4x slower on GB300 than 169d4d5. Leave-one-out arms on
devattribute the gap to two causes:Change
Two commits:
block_m = std::min(block_m, 192).DG_MEGA_MOE_TILESoverride still applies.num_m_blocksbucket.max_m_blocks >= 3) and slot contract as before. Ties are now in expert index order.EVICT_LASThints from [SM100] Mega MoE: dynamic LPT expert ordering, N-outer L2 weight reuse, and skewed prefill BLOCK_M heuristic #162 stay.__frcp_rnLUT again (1 KB of shared memory).constexprpredicate,math::use_nvfp4_sf_inv_lut, sizes the host shared memory budget and selects the kernel path.Outputs are bitwise identical to
devwithout the post-expert norm, at every point below. With the post-expert norm, they stay within the run-to-run variation of its atomics.Benchmark
Setup
nvfp4_mega_moe,dev(5121415) built from source vs this PR.replay= 16 captured Muse serving routings.#160 / #162 benchmark shapes,
devvs this PR (tokens per rank)Muse Spark (256/8/4096/4096), GB300 EP8 (32 local experts),
devvs this PROther model shapes, CC 10.7 EP4, no post-expert norm,
devvs this PRCommit 1 alone (EP4),
devvs commit 1dev: 192 wins at every point.Commit 2 on top of commit 1 (CC 10.7 EP4), commit 1 vs both commits
Not covered