Skip to content

perf(sm103): SIMT dispatch pull for NVFP4 MegaMoE at block_m <= 128 - #174

Merged
zcnrex merged 2 commits into
devfrom
chunan/megamoe-nvfp4-decode-bm128
Dec 1, 2026
Merged

zcnrex merged 2 commits into
devfrom
chunan/megamoe-nvfp4-decode-bm128

Conversation

@zcnrex

@zcnrex zcnrex commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Turn on the SIMT dispatch pull by default for NVFP4 MegaMoE on SM103 when block_m <= 128 (decode and small prefill). BM192/240 prefill keeps the TMA pull. DG_MEGA_MOE_SIMT_PULL=0/1 still overrides.

This PR was split out of #165 with a second change, a block_m=128 decode floor for NVFP4 on SM103/SM107. That change is now dropped: a decode sweep found it 1-5% slower than the current BM64 for uniform and moderately skewed routing on both arches (results in the comment below).

Why the SIMT pull helps on SM103

  • SM103 has no oversized-SMEM mode, so the SIMT pull costs no SMEM budget. It also drops the TMA pull's send buffer, which gives BM64 one more pipeline stage (8 -> 9 at the Muse shape).
  • Measured on top of Merge deepseek-ai/DeepGEMM main (public release 26/11/26, #525) into dev #177's batched TMA pull (the current SM103 default): 0.2-1.8% faster in every decode cell (1 to 64 expected tokens per expert, 4 routing distributions), with no cell slower.

Testing

  • B300 (SM103), EP4, Muse shape, x_scales + alphas + post-expert norm, 4 ABBA rounds. The dev + DG_MEGA_MOE_SIMT_PULL=1 arm is the exact config this PR selects by default (DG_PRINT_CONFIGS shows use_simt_pull=true at every block_m <= 128). An A/A arm stays within +-0.3%.
  • No kernel change; only the SM103 default changes. SM107 has used the SIMT pull for NVFP4 since [SM100] Mega MoE on CC 10.7: K=64 packed-FP4 MMA and SIMT dispatch pull #126.

🤖 Generated with Claude Code

Use block_m=128 as the decode floor for NVFP4 on SM103 and SM107
(monotonic in the multi-block loop) and enable SIMT dispatch pull by
default on SM103 NVFP4 decode (block_m <= 128).

Split out from #165 so it can be gated on Muse replay-routing
benchmarks independently of the arch-policy refactor and SM107 K=128.
@zcnrex
zcnrex force-pushed the chunan/megamoe-nvfp4-decode-bm128 branch from d998e61 to cca508d Compare November 27, 2026 08:23
@zcnrex
zcnrex changed the base branch from chunan/sm103-decode-megamoe-1d1d-opt to dev November 27, 2026 08:23
A 4-round decode sweep (expected 1..64 tokens per expert, uniform / zipf /
biased routing) found the BM128 floor 1-5% slower than BM64 on SM103 and
SM107 for uniform and moderately skewed routing; it wins only under heavy
skew at 16+ expected tokens per expert. The SM103 SIMT pull alone is
0.2-1.8% faster in every cell, including BM16.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zcnrex zcnrex changed the title perf(sm10x): NVFP4 MegaMoE decode block_m=128 + SM103 SIMT dispatch pull perf(sm103): SIMT dispatch pull for NVFP4 MegaMoE at block_m <= 128 Dec 1, 2026
@zcnrex

zcnrex commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Decode sweep: block_m=128 floor vs SIMT pull

The PR is now trimmed to the SM103 SIMT pull (09f24aa). Below is the sweep behind that.

Setup. Base dev 6840aa7 (includes #177's batched pull) vs dev + this PR's original commit. EP4, NVFP4, 4 cold layers, 5 warm-up calls, 7 reps x 20 iters, rank-max per rep, median. 4 rounds per arm, order reversed on odd rounds. Same seeded routing in every arm:

  • u: uniform top-k.
  • z: zipf 0.85 over a fixed expert permutation.
  • b0.5 / b1: Gaussian scores plus a per-expert bias of sigma 0.5 / 1 (b1 is heavy skew).

exp = expected tokens per expert. Cells show the median change vs dev; the 4-round range is always on the same side of zero unless noted. The A/A arm (dev run twice) is within +-0.3% everywhere.

SM103 (B300), Muse shape, deployed regime (x_scales, alphas, post-expert norm)

Arms split the two changes:

  • Ds = dev + DG_MEGA_MOE_SIMT_PULL=1, which is exactly this trimmed PR.
  • Pn = original PR with DG_MEGA_MOE_SIMT_PULL=0, i.e. BM128 floor only.

The full original PR measured about Ds + Pn.

SIMT pull only (Ds)

route exp 1 2 3 4 8 16 24 32 48 64
u -0.5 -0.2 -0.5 -0.6 -0.5 -0.5 -0.5 -0.5 -0.6 -0.2
z -0.2 -0.2 -0.5 -0.5 -0.5 -0.8 -1.7 -1.8 -1.7 -1.1
b0.5 -0.5 0.0 -0.6 -0.5 -0.5 -0.7 -0.7 -1.1 -1.6 -0.9
b1 -0.6 -0.7 -0.9 -1.0 -0.5 -0.9 -1.7 -1.7 -1.5 -1.0

BM128 floor only (Pn)

route exp 1-2 3 4 8 16 24 32 48 64
u ~0 +3.3 +3.1 +3.1 +2.7 +2.5 +2.6 +1.7 ~0
z ~0 +2.9 +1.7 +2.0 +1.2 -0.6 -2.0 -4.3 ~0
b0.5 ~0 +3.1 +3.3 +3.1 +2.3 +1.1 -0.5 -1.8 ~0
b1 ~0 +2.5 +1.2 +0.8 -1.2 -1.9 -3.1 -4.8 ~0

At exp 1-2 both pick BM16, and at exp 64 dev already picks BM128.

SM107 (VR200), second production NVFP4 shape, 188 SMs

SM107 already uses the SIMT pull for NVFP4, so only block_m differs between the arms.

Original PR (BM128 floor) vs dev

route exp 1-2 3 4 8 16 24 32 48 64
u ~0 +4.8 +4.7 +4.8 +4.9 +4.6 +4.8 +5.3 ~0
z ~0 +4.7 +4.8 +4.9 +2.3 +5.6 +1.0 -3.4 ~0
b0.5 ~0 +7.9 +5.0 +5.0 +2.4 +1.2 -0.5 -2.5 ~0
b1 ~0 +4.5 +4.3 +3.3 -1.7 -3.1 -6.9 -8.5 ~0

Reading

  • The BM128 floor wins only under heavy skew at 16+ expected tokens per expert. There, hot experts exceed 64 rows, so BM64 splits them into several blocks that each re-read the expert's weights.
  • At the loads decode actually runs (exp 3-16) with uniform or moderate skew, BM128 costs 1-5% on both arches.
  • The original "no regression on balanced decode" check used 1024-4096 tokens/rank, where dev already picks BM >= 128.
  • A skew-aware block_m would need real routing captures; none usable exist yet.
  • The SIMT pull alone is a win in every cell, so that is all this PR keeps.

🤖 Generated with Claude Code

@zcnrex
zcnrex marked this pull request as ready for review December 1, 2026 06:39
@zcnrex
zcnrex merged commit 81651f7 into dev Dec 1, 2026
@zcnrex
zcnrex deleted the chunan/megamoe-nvfp4-decode-bm128 branch December 1, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant