Conversation
The vocab-parallel logits all-gather went through the NCCL ring collective, costing ~21us per decode step on an NVLink-connected TP8 group. Route it through the one-shot custom (or MNNVL Lamport) all-gather instead, with a transparent fallback to the base collective whenever the custom kernel is unavailable or declines the input. The rank-order concat semantics are identical. Measured on Kimi-K3 TP8 (B300, 8192-in/1024-out, concurrency 1, fp8 KV cache): logits all-gather 20.2 -> 10.8 us per decode step, with the Lamport kernel additionally overlapping the LM-head GEMM tail. Signed-off-by: Yongye Zhu <zyy1102000@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughChangesKimi K3 tensor-parallel logits processing
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change accelerates Kimi K3 tensor-parallel logits gathering while preserving the existing behavior when the optimized path is unavailable; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant KimiLinearForCausalLM
participant KimiK3LogitsProcessor
participant TPGroup
participant LogitsProcessor
KimiLinearForCausalLM->>KimiK3LogitsProcessor: process logits
KimiK3LogitsProcessor->>TPGroup: custom all-gather for 2D logits
TPGroup-->>KimiK3LogitsProcessor: gathered logits
KimiK3LogitsProcessor->>KimiK3LogitsProcessor: reshape multi-token results
KimiK3LogitsProcessor->>LogitsProcessor: fallback gather when unsupported or unavailable
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Purpose
Kimi-K3's vocab-parallel logits all-gather went through the NCCL ring collective, which costs ~21us per decode step on an NVLink-connected TP8 group (latency-bound: 7 hops for a ~40KB-per-rank shard). This adds a
KimiK3LogitsProcessorthat routes the gather through the one-shot custom all-gather (MNNVL Lamport when available), which does the same rank-order concat in a single exchange, with a transparent fallback to the base collective whenever the custom kernel is unavailable or declines the input (size, dtype, registration). Gather semantics are identical, including the padded-vocab slice afterwards.Not duplicating open work: searched open PRs; #48572 warms the spec-sized logits all-gather at init and #54433 changes DSpark top-k — neither changes the collective used here.
Test Plan
pytest tests/models/kimi_k3/unit suites on B300, run on a development tree containing this change.Test Result
mnnvl_lamport_all_gatherkernel launches early enough to overlap the LM-head GEMM tail.AI assistance was used for this PR (Claude Code); every changed line was reviewed and the tests above were run by the submitter.
🤖 Generated with Claude Code
Summary by CodeRabbit