[II] TP-shard Kimi MLA latent projections - #345
voipmonitor wants to merge 1 commit into
Conversation
Add an opt-in tensor-parallel layout for Kimi-K3 fused q_a and kv_a weights. Gather rank-local outputs once per layer and restore logical q_a/kv_a ordering before normalization, preserving the replicated projection result while reducing per-rank weight storage.
|
Warning Review limit reached
Next review available in: 52 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
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 |
Status
Implemented and independently validated.
Behavior
VLLM_KIMI_SHARD_QKV_A=1stores the merged Kimi-K3q_aandkv_aprojection as tensor-parallel column shards. Each forward pass gathers one rank-local merged output and restores the logicalq_afollowed bykv_alayout before either latent is consumed.For
moonshotai/Kimi-K3@2496450e92e425c886db095102a52a6682ca3970, each of 24 MLA layers has a 2,112 by 7,168 BF16 merged projection. TP16 sharding reduces this replicated weight storage by approximately 0.634 GiB per GPU.Technical reason
The low-rank latent tensors are logically replicated, but their projection weights do not need to be. A standard tensor-parallel gather reconstructs the exact output. Merged-column collectives produce rank-major shards, so the implementation explicitly restores the two logical projection ranges.
Compatibility
disable_tplayer.MergedColumnParallelLinear.Validation
Environment: NVIDIA PyTorch 26.07 image, PyTorch 2.13, CUDA 13.3.
git diff --checkpasses.