Conversation
Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
gcanlin
requested review from
AndreasKaratzas,
DarkLight1337 and
ywang96
as code owners
August 24, 2026 09:29
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
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
This PR adds a Kimi K3-specific SM100 path that fuses its BF16 shared expert with FP8/FP4 DeepGEMM MegaMoE and removes the standalone shared-output TP reduction from the latent-MoE tail.
Kimi K3 cannot use the same final accumulation as DeepSeek V4 in #53040: routed MegaMoE produces a 3584-wide latent tensor, while the shared expert produces a 7168-wide hidden tensor. The routed result still needs RMSNorm and a
3584 -> 7168up-projection before the two branches can be added. The non-sequence-parallel path therefore uses two kernels:This update also supports sequence-sharded shared experts. Routed tokens remain SP-local, while the BF16 shared branch consumes the gathered token set. DeepGEMM publishes each source rank's full-hidden partial directly to the owning token rank in
[local_token, source_rank, hidden]order. A local Triton reduction followed by BF16addmmsums the TP partials and combines them with the routed up-projection.Sequence-parallel implementation
fp8_fp4_mega_moe_bf16_shared_sp_rspublishes each TP intermediate shard to the destination token owner without materializing a full shared output or running the former shared-outputsp_reduce_scatter.VLLM_DISABLE_KIMI_K3_MEGAMOE_SHARED_EXPERT_FUSION=1remains an emergency rollback.PR dependency and benchmark stack
This PR does not merge #54347. The new commit is directly based on this PR's previous head. #54347 independently enables Kimi K3 model-level SP across a PP boundary. The TP8 x PP2 x EP8 measurements below were collected from a temporary benchmark branch with this PR stacked on #54347; after #54347 lands, this PR's SP-sharded shared path becomes available for that production topology. Without #54347, the existing non-SP behavior and supported SP topology remain unchanged.
DeepGEMM dependency: deepseek-ai/DeepGEMM#416.
Test Plan
Serving setup
The matched tests used two nodes with 8 NVIDIA B200 GPUs per node, TP8 x PP2 x EP8,
max_num_seqs=128,max_num_batched_tokens=32768, exact random lengths,seed=2026, greedy decoding, four warmups, and FULL_DECODE_ONLY CUDA Graphs.The SHARD=1 baseline adds only
VLLM_DISABLE_KIMI_K3_MEGAMOE_SHARED_EXPERT_FUSION=1. All other server and benchmark arguments are identical.Test Results
All requests completed successfully. Baseline and fused runs used the same node pair, image, model, scheduler limits, and request stream.
SP-sharded prefill: 8192 input / 1 output, concurrency 8, 128 requests
Mean median TTFT decreases from
1230.43 msto1186.76 ms(-3.55%). The throughput range within each arm is below 1%.SP-sharded decode: 128 input / 1024 output, concurrency 32, 32 requests
Including the first cold decode run, fused throughput averages
791.23 tok/sversus the baseline's782.16 tok/s(+1.16%). Comparing the second steady-state run gives +2.02%, and the third fused run reproduces800.06 tok/s. The targeted NVLS gather is not selected for this decode-sized M, so this result measures the shared-fusion/tail path rather than the new gather backend.Targeted gather and overlap microbenchmark
TP8 on one B200 node; times are microseconds.
Overlapmeasures shared-input gather running concurrently with routed down-projection.At local M=4096, the overlapped segment decreases by 30.4%. Below M=256 the existing lower-overhead SP gather remains faster, which is why the targeted path is thresholded.
SP-local tail microbenchmark
The current two-kernel tail consists of a Triton source-rank reduction and BF16
addmmwith the routed3584 -> 7168up-projection.addmmonlyDeepGEMM producer microbenchmark
The TP8 producer benchmark uses Kimi K3 matrix widths (
routed H/I=3584/3072,shared H/I per TP rank=7168/768), local routed M=8, global shared M=64, and 100 measured iterations. It takes the maximum rank time.The direct remote publication overhead is about
0.55 us; it replaces downstream shared-output materialization and SP reduction.Original non-SP results
The original TP8 x PP2 published-tail path remains covered by the previous measurements:
Correctness
[local_token, source_rank, hidden]value bitwise against dense output; it passed twice with Kimi K3 matrix widths.git diff --checkpassed.Accuracy
The original fused non-SP path was evaluated on the complete GSM8K v3 test split with
lm-eval 0.4.12: 1,319 samples, 5-shot chat-template evaluation, multi-turn few-shot examples, greedy decoding, and a 1,500-token generation limit. The new SP-sharded extension is covered by the TP8 bitwise and serving regressions above; this full-dataset run was not repeated for the temporary #54347 benchmark stack.The exact scores are
1277/1319and1278/1319respectively.Contribution notes
AI assistance was used during implementation, debugging, review, benchmark analysis, and preparation of this PR description. The human submitter must review and understand every changed line and verify the final commands/results before submission.