[Bugfix][Kernel] Break native top-k cutoff ties by token index - #56613
Open
LucasWilkinson wants to merge 2 commits into
Open
LucasWilkinson wants to merge 2 commits into
LucasWilkinson wants to merge 2 commits into
Conversation
Break insertion-sort cutoff ties by token index instead of atomic arrival order. Cover prefill and decode selection at top-k 512 and 2048. Co-authored-by: OpenAI Codex Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
LucasWilkinson
marked this pull request as ready for review
September 12, 2026 14:50
LucasWilkinson
requested review from
AndreasKaratzas,
WoosukKwon,
mgoin,
tlrmchlsmth,
yewentao256 and
zyongye
as code owners
September 12, 2026 14:50
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #88522 for commit |
Co-authored-by: OpenAI Codex Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #88526 for commit |
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.
Break native
top_k_per_rowinsertion-sort cutoff ties by token index. Previously, tied candidates were ranked by their temporary shared-memory slot, so atomic arrival order could change which token survived the cutoff. Prefer the lower token index.This is a comparator fix with no new kernel or launch. It does not stabilize the complete output order or change the radix-sort final pass. Separate from #55122 (persistent selector), #53287/#55314 (candidate overflow), and #55872 (opt-in FlashInfer backend); none changes this comparator.
Prior validation on B300, using the identical
sampler.cuon the source-built investigation branch (codex/nixl-pcp-dcp-offload-test, commit279e9406):All four cases failed before the fix and passed afterward (prefill/decode, k=512/2048). Those diagnostic tests remain on the investigation branch; this draft contains only the comparator change. Pre-commit, including clang-format, ruff and mypy, passed. A fresh build/test of the extracted branch is pending.
Model evidence from the combined PCP/offload investigation: GLM-5.2-NVFP4, PCP4+TP1+EP4+DCP4 → TP4 scored 28/32 GSM8K with either GPU caching or CPU offload, versus 26/32 direct TP4. All 32 GPU/CPU pairs matched tokens and log probabilities. That run also included separate ordering/layout/offload fixes; it does not isolate this patch's model-quality effect.
AI assistance: OpenAI Codex. Reviewed by submitter