Repository navigation
[SM100] Mega MoE: widen SF ring stride arithmetic to 64-bit - #169
Merged
Merged
Conversation
zcnrex
added a commit
that referenced
this pull request
Nov 28, 2026
Git carried the three PRs' edits through the *_inference renames. 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.
Summary
MegaMoEBuffersizesl1_sf_buffer,l2_sf_buffer, andshared_l2_sf_bufferwith 64-bit byte counts (Buffer::get_num_bytes_per_rank()), and TMA reads those SF buffers using 64-bitcuuint64_tstrides, whereas the kernel's SF ring write offsets insm100_fp8_fp4_mega_moe.cuhstill multipliedkNumSFRingTokens/kNumSharedSFTokensin 32-bituint32_t:!kIsNVFP4):k_uint_idx * mn_stridewraps2^32(4 GiB) when the full-pool SF ring exceeds 4 GiB (e.g.,ep_size=8, num_experts=384, topk=4, num_max_tokens_per_rank=32768, wherekNumSFRingTokens = 17,879,040andmn_stride = 71,516,160bytes wraps atk_uint_idx >= 61), leaving the upper SF columns read by 2D TMA zero-initialized.local_sf_ptrandkIsNVFP4sf_u32_ptr):j * kNumSFRingTokensandn_block_idx * mn_stride_u32wrapuint32_tonce the SF buffer exceeds2^32uint32_twords (16 GiB).Widen the SF ring stride/offset multiplications in
sm100_fp8_fp4_mega_moe.cuhtouint64_tso kernel stores match the 64-bit buffer layout and TMA descriptors.Verification
sm100_fp8_fp4_mega_moe_impl(MmaKind::NVFP4TMA/SIMT pull andMmaKind::MXFP8FP4) withnvcc -std=c++20 -O3 -arch=sm_100a.