Repository navigation
Merge upstream public release 26/11/26 (deepseek-ai/DeepGEMM#525) - #71
Merged
Merged
Conversation
Add locality-aware Mega MoE execution, GEMM epilogue classes with BF16 stochastic rounding, wider sparse MQA head support, and packed SF strides. Improve Indexer and Mega MoE pipelines, update attention and Mega Gate interfaces, and include runtime and correctness fixes. Export the current source through the OSS filter while retaining public release history and the Mega MoE task-info release-ordering fix. Co-authored-by: Anyi Xu <[email protected]> Co-authored-by: huahuaquq <[email protected]> Co-authored-by: TwenTy_ <[email protected]> Co-authored-by: xyf007 <[email protected]> Co-authored-by: Yongqi Zhuo <[email protected]> Co-authored-by: yukuai26 <[email protected]> Co-authored-by: Zhean Xu <[email protected]>
Add FP8CastWithClamp with optional clamped-element counts, consolidate GEMM epilogue conversions, and accept 128-byte paged sparse KV strides. Keep the Mega MoE localizer alive until test teardown and bump the package version to 2.8.2. Co-authored-by: xyf007 <[email protected]> Co-authored-by: yukuai26 <[email protected]> Co-authored-by: Zhean Xu <[email protected]>
A CUDA graph kernel node keeps the same %gridid on every replay. The mega_mhc split barriers tag each execution with %gridid, so after a replay a barrier line still holds encode_state(grid_idx, kNumSplits), which is exactly the state the next replay waits for. A Mix or Norm waiter whose m-block init CTA has not started yet proceeds immediately and reads the previous replay's split partials. Tag executions with an epoch instead. The epoch and an exit count live in the unused tail of the first barrier line, so the host-side buffer is unchanged. Every CTA reads the epoch after cudaGridDependencySynchronize, and the last CTA to retire resets the exit count and advances the epoch. Signed-off-by: lightseek-bot <[email protected]>
* Public release 26/11/26 * Add 2026.11.26 News entry for deepseek-ai#525
Brings in upstream main up to 09e7d8e: deepseek-ai#471 (FP8 epilogues, 128-byte paged sparse MQA strides), deepseek-ai#478 (already on dev as deepseek-ai#48) and deepseek-ai#525 (Mega MoE fused RMSNorm and low-latency protocol, GEMM bias and FP8 stochastic rounding, experimental fused kernels, `*_inference` renames). - Upstream's new host APIs are ported to the stable-ABI TORCH_LIBRARY bindings: experimental kernels, FP8CastWithClamp / FP8StochasticRounding epilogues, GEMM bias (SM100 only), mega_mhc and Mega MoE inference changes. - The fork's SM100 Mega MoE kernels move to upstream's new protocol and layout: FP8xFP4 (with SiTU folded in), BF16, NVFP4 and FP4xFP4. - SM90 Mega MoE stays on a frozen copy of the previous layout, scheduler and heuristics; SM90 kernel files are unchanged. - Pre-rename Python names and `deep_gemm.mega` remain as compatibility aliases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 28, 2026
2 of 6 tasks
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.
Merges upstream
mainup to the 26/11/26 public release (deepseek-ai/DeepGEMM#525) intodev. This also brings in deepseek-ai#471, which adds FP8 epilogue updates and 128-byte paged sparse MQA strides. deepseek-ai#478 is already ondevas #48.The merge commit's parents are
devand upstream09e7d8e. Please merge with "Create a merge commit" rather than squash, so that the next sync can use upstream's history as its merge base. #30 was squashed, so git had lost that link and this merge had to be redone with the right base.What changes for callers
*_inference(fp8_fp4_mega_moe_inference,bf16_mega_moe_inference,get_symm_buffer_for_mega_moe_inference,MegaMoEInferenceSymmetricBuffer, …).fp8_fp4_mega_moe,bf16_mega_moe,fp4_fp4_mega_moe,nvfp4_mega_moe,SymmBuffer,NVFP4SymmBuffer,transform_weights_for_mega_moe,get_block_m_for_*, and_C.get_symm_buffer_size_for_{,nvfp4_}mega_moe.deep_gemm.megaremains a compatibility package, so vLLM's step5import_module(f"{dg.__name__}.mega")still works.rms_weights,rms_eps) and FP32y, both SM100 only.MegaMoESignalsregion, which includes a 128 MiB source-slot reservation. So buffers grow by about 128 MiB.NVFP4SymmBuffernow subclassesSymmetricBuffer.base=sharing works across all of them, in both directions, as step5 and Muse Spark use it.deep_gemm.epilogue.FP8CastWithClamp(sfd, clamp_value=None, clamped_count=None)andFP8StochasticRounding(sfd).FP8Quantizationstays as an alias.use_128x4_sfd_layout) is kept.[1, N]cthat is notdbecomes a bias on SM100 (upstream). On SM90 and SM120 it still accumulates as a normal C, which is the fork's choice.mega_mhc: shifted mode only (upstream), and a cooperative launch. Upstream requires the full SM count; the fork accepts any count up to it, so vLLM's DBO compute-SM split keeps working.deep_gemm.experimental: upstream's experimental fused kernels, exposed through the stable ABI with upstream's Python signatures.activation_clamp: must now be> 0(upstream). Unset means infinity.Upstream features on the stable-ABI bindings
Upstream adds its APIs through pybind11; here they are translated to
TORCH_LIBRARYand the_C.pyfacade:experimental_*ops; the V41F per-stream state uses the fork's stream/capture helpers.(kind, alpha, sfd, aux). Every GEMM and einsum schema gainsTensor? epilogue_aux=None.FP8CastWithClamp: its per-stream launch tag is keyed likemega_gate/mega_mhc.Fork Mega MoE on upstream's new protocol (SM100)
Upstream's new dispatch drops the pre-pull grid sync and NVLink barrier: counts are published by the last SM, source slots are
+1/zero, expert blocks are balanced, and combine readiness usescombine_ready_count.swiglustepand SiTU.swiglustep, post-expert RMSNorm and TRT-LLM weight layout.ld.global.nc.devby FP32 rounding (≤ 2.7e-4 relative per token).layout::inference, the new scheduler and the barrier-free protocol, with partial activation TMA maps.DG_NVFP4_MOE_*overrides still work.layout/mega_moe.cuh,scheduler/mega_moe.cuhand heuristics (heuristics/mega_moe_sm90.hpp). All SM90 kernel files are byte-identical todev; upstream's two cosmetic SM90 edits are reverted.Fork deviations from upstream (deliberate)
devdid. Upstream splits 6–8 KiB tokens into two chunks.dev; on DSV4 shapes the difference is noise.mega_mhc: acceptsnum_sms <= device SMs(see above).DG_MEGA_MOE_STORE_BLOCK_MandDG_MEGA_MOE_BYTES_PER_PULL, env-only, like the NVFP4 knobs.dg_arange_int64_kernel, sobench_kineto(..., 'gemm_')doesn't match it.Testing
All on GB200 (SM100) with torch 2.14 (cu130) and CUDA 13.1, 4 GPUs per node.
test_layout,test_bf16,test_fp8_fp4(incl. bias, FP8 clamp/SR),test_einsum(incl. 128x4 SFD, clamp count, FP8 SR),test_attention(DG_MQA_NUM_CASES=40),test_hyperconnection,test_mega_gate,test_mega_mhc,test_lazy_init --num-processes 4,test_mega_moe_block_configtests/experimental/*(all 6)test_mega_moe_inference --emu-reference(EP4)swiglustep, SiTU (β = 0 and β > 0), RMSNorm with BF16 and FP32y, FP32y, masked/hot/empty routing,--sweep, CUDA graph replaysdev, identical seeded inputs (EP4, T ∈ {1, 37, 512, 2049})swiglustepand hidden 7168; post-expert norm ≤ 2.7e-4 relative per token (gamma order)test_bf16_mega_moe_trtllm(default andswiglustep)test_nvfp4_mega_moe:--check-api(T = 0/1/17/129/1000), default MiniMax shapes,--x-scales --shared-dtype bf16,swiglustepmasked,--mma-type fp8xfp8test_fp4_fp4_mega_moe: default, Muse Spark (alphas, a2, post-norm), shared experts masked; signal-region-zero, graph replay and shared-base checkstest_locality_domaindev: MLOPart is unavailable on these nodesNot run (no hardware): SM90 and SM120. Their files are unchanged apart from the shared host code, which builds.
Mega MoE performance vs
devup to EP32merged us / dev us (ratio): the kernel time of the slowest rank, frombench_kineto. Both builds ran alternately in the same allocation, usingdev's own test scripts.swiglustep(FP8xFP8): 4096 / 1280 / 288 / top-8.msadds alphas, a2 scales and post-norm.test_mega_moe, for both builds. With the hostdist.barrier(), per-rank times varied 3×.deveverywhere except the cell marked ¹. Decode-size batches gain 5–32%.Full table
¹ Not reproducible. In that run all 32 ranks measured 466–478 µs. Two reruns of the same config were faster than
dev: 370 vs 392 µs at EP32 on another node set, and 359 vs 371 µs with the same per-rank load at EP8. The likely cause was transient NVL72 fabric traffic during that one run.🤖 Generated with Claude Code