perf(m3): enable prefill CUDA graph + EAGLE3 draft-loop kernel cleanup - #837
Open
syuoni wants to merge 7 commits into
Open
perf(m3): enable prefill CUDA graph + EAGLE3 draft-loop kernel cleanup#837syuoni wants to merge 7 commits into
syuoni wants to merge 7 commits into
Conversation
Add tqdm progress bar to PrefillGraph._capture_all_buckets mirroring the decode graph capture UX. Drop --disable-prefill-graph from all M3 server commands; the flag was required to work around a D2H sync (.item() call) inside the CuTe MSA extend wrapper that crashed capture, fixed in lightseekorg#819 (perf(m3): avoid per-layer D2H sync in MSA prefill). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Override resolve_embed in MiniMaxM3Model to use a non-sharded VocabParallelEmbedding (tp_size=1), eliminating the allreduce on every embedding lookup. Each rank holds the full 200K-entry table (~2.4 GB vs ~0.6 GB sharded); weight-sharing with the EAGLE3 draft via set_embed_and_head is unaffected. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Replace the mapping.attn.tp_size > 1 check with embed_tokens.tp_size > 1. The former is redundant (embed tp_size derives from the mapping), and with non-sharded embeddings (tp_size == 1, e.g. M3 after the resolve_embed override) it caused an unnecessary allreduce + FillFunctor that scaled embeds by the TP degree before input_layernorm -- harmless due to RMSNorm scale-invariance but wasteful (~9 us per draft step on B200 TP4). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ce arg Apply the PR lightseekorg#78 FusedRMSNorm pattern to the remaining eagle3 norm+concat sites: - llama_eagle3 fc_norm (step 0): chunk pairs run through the fused parallel kernel and all chunks write into slices of one preallocated buffer -- 3 norm launches + concat become 1 fused + 1 single, no concat. - llama_eagle3 midlayer (every draft step): input_layernorm(embeds) + hidden_norm(hidden) + concat collapse into one FusedRMSNorm launch on the non-allreduce-fused arm; the fuse_embed_reduce arm is unchanged. - deepseek_v3 Eagle3MlaModel fc_norm: same treatment (its midlayer was already fused by lightseekorg#78). RMSNorm.forward gains an out= buffer arg (both backing kernels already accept strided outputs) and loses inplace -- out=x expresses it; the one caller (kv_a_layernorm in deepseek_v3) migrated. Zero-token guards skip the fused launches on idle forwards, matching RMSNorm's internal guard. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Enwei Zhu <21126786+syuoni@users.noreply.github.com>
syuoni
marked this pull request as ready for review
July 29, 2026 14:10
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3088dea80
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Enwei Zhu <21126786+syuoni@users.noreply.github.com>
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
Notes for reviewers