Repository navigation
Conversation
The fused all_gather_pair_kimi_topk kernel (_AllGatherPairLaunch with kimi_topk) uses the same two-level top-16 as the standalone kimi_topk16 and the same exhausted-queue sentinel: an out-of-range lane and an exhausted queue are refilled with pack(-inf, expert(keys[...])), which is a valid key. When fewer than 16 selection scores are above -inf, that key can win again and repeat an expert id. Use the zero packed key instead, in both reduction levels. Zero sorts below every valid packed key, including -inf, so an exhausted queue can no longer re-offer an expert. This is the same change as the standalone kernel fix in "Exclude exhausted candidates from Kimi top-16 merging". Results are unchanged whenever at least 16 selection scores are > -inf (ids and weight bits). The fused kernel's compile-spec version goes 1 -> 2; the plain paired gather keeps its key.
8 of 12 tasks
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
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.
📌 Description
The fused
all_gather_pair_kimi_topkkernel (_AllGatherPairLaunchwithkimi_topk) selects Kimi's 16 experts with the same two-level top-16 as the standalonekimi_topk16. It has the same exhausted-queue flaw that the second commit of #97 fixes in the standalone kernel. Out-of-range lanes and exhausted queues are refilled withpack(-inf, expert(keys[...])), which is a valid key. When fewer than 16 selection scores are above -inf, that key can win again, and an expert id is repeated.This PR uses the zero packed key instead, in both reduction levels. Zero sorts below every valid packed key, including -inf, so an exhausted queue can no longer re-offer an expert. The change is 3 hunks in
_AllGatherPairLaunch. The fused kernel's compile-spec version goes 1 -> 2; the plain paired gather keeps its key. There is no switch: results are unchanged whenever at least 16 selection scores are > -inf.🧪 Tests
This branch was validated on GPU (2x RTX PRO 6000 Max-Q, world 2). The same validator was run on
mainand on this branch, with both transports (pull and, where present, push).mainvs this branch differs in 74 cases. All 74 have fewer than 16 selectable scores, and they are exactly the 74 rows wheremainemits duplicate expert ids. This branch emits 0 duplicates.main, 7.25 us on this branch, which is noise.kimi_topk16output is unchanged (0 differing cases).tests/experimental/b12x/comm/test_pcie_dcp_a2a*.py, push addresses, preparation compile, two-shot unit/bindings): 42 failed / 302 passed / 22 skipped. This is the identical failure set tomain. The failures are pre-existing source-inspection and fake-signature drift.Topology assumptions
Generic. Any world size; the change is inside the per-rank top-16.
Reviewer Notes
test_kimi_topk16_gpu.pycould be reused in the world-2 DCP GPU test if you prefer one in this PR.