mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #743] [CLOSED] qsa_select: coalesced streaming top-k for long Turing prompts (+23% 248K prefill) #2800
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2800
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/743
Author: @konijiwa110
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:qsa-topk-stream📝 Commits (1)
83cf4ddqsa_select: coalesced streaming top-k for long Turing prompts📊 Changes
2 files changed (+97 additions, -1 deletions)
View changed files
📝
src/kernels/cuda/qsa_select.cu(+94 -0)📝
src/kernels/qsa_topk_active_parity.cpp(+3 -1)📄 Description
What
The register top-k holds at most
TK_T * TK_PERblocks (~135K cells). Past that the prompt path falls back toblock_topk_kernel, whose per-thread runs read the scores uncoalesced: 12.8 ms per 256 queries at 250K on an RTX2080 Ti, the largest prefill phase there at that length.
block_topk_stream_kernelreads the keys from memory on every radix pass with blockt + i * TK_T(coalesced), soit has no register limit, then emits the cells in ascending chunks of
TK_Tblocks with two block scans (ties to thelowest index), giving
block_topk_kernel's ids.It is taken only where the active bound is already used (Turing prefill, or
STRATA_TOPK_ACTIVE_ANY=1in tests) above22,528 blocks (~90K cells). Decode and other cards are unchanged.
STRATA_TOPK_STREAM=0keeps the previous dispatch.qsa_topk_active_paritygains cases either side of the 22,528-block bound, heavily tied scores at 200K and all-zeroscores at 262K (20 cases), comparing against the capacity-dispatch reference.
Measured
RTX 2080 Ti, 256 queries, capacity 262144, top-k with the active bound (
STRATA_TOPK_STREAM=0/ unset):Selections identical to the reference kernel 256/256 at each length.
qsa_topk_active_parity: PASS (20 cases, idsbitwise identical), with the stream on and off.
End to end, Swift 1.5 IQ3_XXS, same build A/B, prefill tok/s: 248K 951 -> 1167 (+23%), 155K 1166 -> 1210 (+4%),
128K and below unchanged.
qsa selectat 248K: 70.9 s -> 22.2 s. (These runs had #742's scorer on as well.)Only tested on sm_75. Independent of #741 and #742 (merges cleanly with both).
Developed with an AI coding assistant; all numbers measured on an RTX 2080 Ti 22 GB / i5-12490F / 64 GB.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.