Repository navigation
Use paired router rows for Kimi P8 gather - #258
Merged
lukealonso merged 2 commits intoNov 11, 2026
Merged
Conversation
The eight-row Kimi route exchange submitted its paired latent and router gather with one row block, leaving the transport's independent row partitioning unused. Enable two row blocks only for eight physical rows, where additional CTAs can divide complete rows without changing the route computation. Pass row_blocks=2 for P8 and retain row_blocks=1 for every other multi-row shape. Add a CPU preparation test that inspects the actual b12x call metadata for two, four, six, seven, and eight rows. This is expected to reduce P8 paired-gather serialization; no latency or whole-model improvement is claimed from this CPU-only validation. The focused policy test passed all five geometries, and test_kimi31_query_overlap.py plus test_kimi31.py reported 26 passed and 30 skipped with CUDA disabled. Multi-CTA collective correctness, CUDA graph replay, and performance remain unrun here and require the matching FlashInfer paired-gather revision; the dependency pin remains unchanged. Design-Signed-Off-By: Kimi (Kimi); design-review=cfcf Co-Authored-By: Kimi <noreply@anthropic.com>
The eight-row gather policy needs both counted candidate transport and multi-CTA paired gathers. Integrate the parent's scratch validation and pin the two corrected FlashInfer APIs together, with matching uv.lock metadata, so locked preparation can build both operations. The eight-row policy remains two row blocks; every other paired capacity retains one. The dependency revision excludes the independent standalone top-16 optimization, keeping the required transport changes explicit. Combined FlashInfer CPU coverage passes 152 tests with 16 CUDA skips, and Flare passes 154 tests with 5 CUDA skips. Both dependency locks validate. The underlying transports passed separate TP16 CUDA checks; the paired gather also passed TP4. Whole-model performance remains unqualified. Design-Signed-Off-By: Codex GPT-6; design-review=cfcf Signed-off-by: Martin Vit <martin@voipmonitor.org>
lukealonso
marked this pull request as ready for review
November 11, 2026 12:50
lukealonso
merged commit Nov 11, 2026
58a81a4
into
martin/kimi-counted-owner-transport
1 of 3 checks passed
lukealonso
pushed a commit
that referenced
this pull request
Nov 11, 2026
A single thread block copies every row of the paired latent/router gather. Partitioning eight-row gathers across two blocks exposes more copy work while preserving each output's rank-major layout. Set row_blocks=2 only at eight physical rows and retain one block elsewhere. Pin the merged FlashInfer main that supplies the partitioned-gather API in both pyproject.toml and uv.lock. This ports the policy accepted in PR #258 onto main without replaying the counted-selection change already merged. Earlier isolated TP16 measurements reduced this gather from 33.31 to 31.00 microseconds; they do not establish full-model speedup. On this branch, 41 focused CPU checks pass, including five row-capacity policy cases. The dependency lock validates offline. GPU and end-to-end tests were not rerun for this port. Design-Signed-Off-By: Codex GPT-6; design-review=cfcf Signed-off-by: Martin Vit <martin@voipmonitor.org>
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.
Why
Kimi K3.1 decode gathers the per-rank latent projection and router logits before selecting experts. For eight physical rows, the paired gather previously used one CUDA thread block to copy every row. Two blocks can divide complete rows between them while retaining each output's rank-major layout.
Implementation
Pass
row_blocks=2to the paired latent/router gather only when the prepared route exchange contains eight physical rows. All other paired row capacities use one block. The fused route path and expert-selection arithmetic keep their existing behavior.Result
At the Kimi K3.1 eight-row TP16 geometry, the isolated paired gather's median slowest-rank latency fell from 33.3148 µs with one block to 31.0025 µs with two blocks, a 6.9% reduction. This measures the paired collective. Complete Flare graphs, native serving, and performance policies for other tensor-parallel sizes remain unqualified.
Validation
d1611d36f5fdd245e0a75815f1ed327b86174967, Flare passed 154 CPU tests with five CUDA-only cases skipped. The preparation policy checks physical row counts 2, 4, 6, 7, and 8. Combined FlashInfer passed 152 CPU tests with 16 CUDA-only skips; offline SM120 compilation also checked counted/full-width owner transport and distinct one-, two-, four-, and eight-block paired-gather programs. Both dependency lockfiles passuv lock --check --offline.9bf51994746c2bf6319786351f389ccea0a6c3c9. Each rank supplied an 8 × 224 BF16 latent tensor and an 8 × 56 FP32 router tensor generated from seed 32145. Both configurations used 512 threads per block and 64 gathers per CUDA graph. After warmup and exact output checks, six groups of replays used block counts 1, 2, 2, 1. The reported statistic is the median of the per-replay maximum rank durations divided by 64. After the run, reported graphics clocks were about 2610 MHz, memory clocks were 16,365 MHz, and the power limit was 600 W per GPU.Dependencies
This draft is stacked on the Flare change that enables counted Kimi candidate transport. FlashInfer's paired-gather change supplies the two-block launch configuration. Both dependency files pin
d1611d36f5fdd245e0a75815f1ed327b86174967, which combines the corrected counted transport and paired gather branches without the independent top-16 change. Update this pin after the FlashInfer PRs merge, then retarget this draft tomainafter the Flare parent merges. Flare #257 · FlashInfer #99🤖 Generated with Claude Code