Conversation
There was a problem hiding this comment.
Code Review
This pull request implements CP-v2 context-parallel prefill support for Kimi-Linear, alternating between Kimi Delta Attention (KDA) on complete token batches and Multi-head Latent Attention (MLA) on zigzag token shards. It introduces KimiLinearCPV2LayerCommunicator to handle layout transitions, updates FlashInfer MLA to support CP-v2 prefill, ensures KDA state parameters and cache shapes use global tensor parallelism, and adds comprehensive unit tests. Feedback suggests removing the unused stream parameter from the postprocess_layer method signature in the communicator.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| def postprocess_layer( | ||
| self, | ||
| hidden_states: torch.Tensor, | ||
| residual: Optional[torch.Tensor], | ||
| forward_batch: ForwardBatch, | ||
| stream: Optional[Any] = None, | ||
| ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]: |
There was a problem hiding this comment.
The stream parameter in postprocess_layer is unused. It is recommended to remove it from the method signature to keep the API clean and maintainable.
def postprocess_layer(
self,
hidden_states: torch.Tensor,
residual: Optional[torch.Tensor],
forward_batch: ForwardBatch,
) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:|
Remove the assertion of deepep? |
|
/rerun-test |
|
⛔ Please specify a test: Examples:
|
|
/rerun-test test/registered/models_e2e/test_kimi_linear_models.py::TestKimiLinear.test_gsm8k |
|
Results for 🚀 |
|
/rerun-test test/registered/cp/test_kimi_linear_cp_v2.py |
|
Results for 🚀 |
|
/rerun-test test/registered/cp/test_kimi_linear_cp_v2.py test/registered/models_e2e/test_kimi_linear_models.py::TestKimiLinear.test_gsm8k |
|
Results for 🚀 🚀 |
|
/rerun-test test/registered/cp/test_kimi_linear_cp_v2.py test/registered/models_e2e/test_kimi_linear_models.py::TestKimiLinear.test_gsm8k |
|
Results for 🚀 🚀 |
Summary
layers/cpPR #31619 has merged; this PR is rebased onto its CP-v2 implementation on
main.Layout transitions
Gathering immediately after MLA is necessary because the following TP MoE/MLP all-reduces require identical token dimensions on all ranks.
Verification
Focused CPU tests on current
main:All pre-commit hooks pass for the changed files, and the final diff passes
git diff --check.Latest targeted
/rerun-testchecks on commitfd7edf561e:The TP4/CP4 GB300 result below predates the KDA head-sharding update. Repeating it on
baizhou-dev-2is currently blocked because the only advertised free GB300 nodes areNodeStatusUnknown.Four-GB300 launch on
baizhou-dev-2:GSM8K, 200 examples, 32 concurrent requests, default decode CUDA graphs:
The TP4 non-CP accuracy reference on the same model and dataset subset was 0.890.
CI States
Latest PR Test (Base): ❌ Run #29684396607
Latest PR Test (Extra): ❌ Run #29684396500