vulkan: support TOP_K with large K - #28036
Closed
jeffbolznv wants to merge 2 commits into
Closed
Conversation
Contributor
Author
jeffbolznv
marked this pull request as draft
August 30, 2026 16:11
Contributor
|
Interestingly, seems our implementations have different strengths. These are test-backend-ops perf results of the ops extracted from Qwen 3.8 Flash Next: Results (us/run, lower is better)nv-spark (GB10 Blackwell)
amd-395 (Radeon 8060S RDNA3.5)
llama-bench t/s, Qwen3.8 Flash Next IQ4_XS, -ngl 99 -fa 1nv-spark (GB10)
amd-395 (Radeon 8060S)
|
Contributor
Author
|
In your tests, is 2051 the value of K or the value of ne0? |
Contributor
|
That's K, yes. decode: TOP_K(ne=[2051,1,1,1], sources=f32[16384,1,1,1]) |
Contributor
Author
|
I added some tuning to do fewer workgroups. This recovers the perf on my system but not sure it'll be as fast with fewer SMs. |
Contributor
|
I updated my comment, added a tuned test and actual model tests. My branch is still faster in prefill, and also slightly faster in decode, mostly due to the fusion though. |
Contributor
Author
|
OK, closing in favor of yours. |
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.
Overview
Similar to the N-ary search histogram, but multipass through global memory, and then a final pass writes the top K values.
Perf on RTX 5090:
Requirements