Skip to content

[SM100] Mega MoE: SIMT dispatch pull for FP4 activations - #135

Merged
zcnrex merged 3 commits into
sgl-project:devfrom
zcnrex:simt-pull-fp4-acts
Nov 4, 2026
Merged

zcnrex merged 3 commits into
sgl-project:devfrom
zcnrex:simt-pull-fp4-acts

Conversation

@zcnrex

@zcnrex zcnrex commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

The SIMT dispatch pull (#126) loads each token with one remote round trip from SIMT lanes instead of TMA copies through the shared-memory send buffers. It was gated to FP8 x FP4. This lets NVFP4 and MXFP4 use it:

  • On by default for FP4 activations on CC 10.7, where it was measured faster. SM100/SM103 stay on the TMA pull unless DG_MEGA_MOE_SIMT_PULL=1.
  • Same eligibility rule as before: token bytes must be a multiple of 512, so FP4 needs hidden % 1024 == 0.
  • The DG_PRINT_CONFIGS key now includes the MMA kind and the resolved pull. Before, a forced pull or a second MMA kind at the same shape never printed.

The pull only moves bytes, so outputs are bitwise identical to the TMA pull (checked below); no accuracy eval is needed.

Benchmark

VR (CC 10.7), EP4, hidden 4096, intermediate 4096, 256 experts, top-8, uniform routing, no localization. Kernel time of the slowest rank (kineto), median of 2-6 runs per arm, arms interleaved in one process. NVFP4 uses the #132 benchmark config (TRT-LLM layout, x-scales, post-expert norm); MXFP4 the native layout. Measured with the gate relaxed on #132's head with its staging off, i.e. this kernel path.

Prefill-sized buffer (8192 max tokens/rank), SIMT pull time vs TMA pull:

tokens/rank NVFP4 MXFP4
16 -11.1% -6.4%
256 -4.4% -6.3%
512 +0.7% +0.5%
1024 -15.3% -4.3%
2048 -19.1% -4.3%
4096 -26.8% -9.7%
8192 -12.6% -13.3%

Decode-sized buffer (256 max tokens/rank), SIMT pull time vs TMA pull:

tokens/rank 1 8 32 64 128 256
NVFP4 -12.0% -3.3% -2.2% -3.7% -4.6% -3.3%
MXFP4 -3.7% -2.3% -2.5% -7.1% -7.0% -5.5%

An A/A arm (the same kernel twice) moved -3% to +4.6% in this harness, so the small decode deltas are near the noise floor; the MXFP4 64-256 and prefill >= 1024 deltas are above it. On CC 10.7 the SIMT pull keeps the normal shared-memory budget instead of the oversized one (as with FP8 x FP4), and still wins: the printed configs show 5-11 GEMM stages vs 8-16 for the TMA pull.

GB300 (SM103), same shape: NVFP4 SIMT -3.0% to -3.6% vs the TMA pull, with an A/A arm at -3.1% to +0.6%; MXFP4 too noisy on the shared box to read. Hence opt-in there. Not measured on B200.

Compared with the NVFP4 token staging in #132 on the same VR runs, the SIMT pull was equal or faster in every rerun cell (NVFP4 and MXFP4 at 256/512/2048 tokens/rank, 6 runs per arm, two launches) and it also applies to decode-sized buffers, where staging is off because the ring does not cover the token pool.

Test

test_mega_moe_global_tokens.py now also forces DG_MEGA_MOE_SIMT_PULL=0/1 for every load pattern (balanced, one active rank, uneven, all idle). It checks that the env var resolves to the requested pull, and that y and the expert receive counts are bitwise equal between the two pulls. The new --mma-type mxf4xmxf4 and --x-scales options cover the other FP4 pulls. run_tests.sh adds an MXFP4 run at 4096 tokens per rank, where the ring wraps, and an NVFP4 run with x-scales.

GB300 and VR, test_mega_moe_global_tokens.py, all 5 patterns, both pulls bitwise:
  NVFP4, 2 and 4 ranks                     OK
  MXFP4, 2 ranks, 4096 tokens (ring wrap)  OK
  NVFP4 + x-scales, 2 and 4 ranks          OK
GB300, DG_MEGA_MOE_SIMT_PULL=1:    test_mega_moe_nvfp4_alphas.py OK, test_mega_moe_nvfp4_trtllm.py OK
VR, default (SIMT pull on):        test_mega_moe_nvfp4_alphas.py OK, test_mega_moe_nvfp4_trtllm.py OK
VR, DG_MEGA_MOE_SIMT_PULL=0:       test_mega_moe_nvfp4_alphas.py OK

🤖 Generated with Claude Code

Let NVFP4 and MXFP4 take the SIMT dispatch pull (sgl-project#126), which was gated to
FP8 x FP4. It is on by default for FP4 activations on CC 10.7 and opt-in
elsewhere through DG_MEGA_MOE_SIMT_PULL=1.

The DG_PRINT_CONFIGS key now includes the MMA kind and the resolved pull,
so a forced pull or a second MMA kind at the same shape still prints.

test_mega_moe_simt_pull.py checks SIMT == TMA pull bitwise (y and receive
counts) for NVFP4, NVFP4 with x-scales, and MXFP4, including a ring-wrapping
load, and that the env var resolves to the requested pull.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zcnrex and others added 2 commits November 3, 2026 19:17
Each load pattern now also forces DG_MEGA_MOE_SIMT_PULL=0/1 and checks the
resolved pull and bitwise-equal y and receive counts. --mma-type mxf4xmxf4 and
--x-scales cover the other FP4 pulls; run_tests.sh runs MXFP4 at a ring-wrapping
shape and NVFP4 with x-scales.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Same decisions as before: reuse is_mma_with_sf and the token byte count, and
name the default condition (CC 10.7 with packed FP4 weight stages).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zcnrex
zcnrex merged commit 5a5cbd9 into sgl-project:dev Nov 4, 2026
@zcnrex
zcnrex deleted the simt-pull-fp4-acts branch November 4, 2026 07:01
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