mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3987] [Engine] gfx906: opt-in two-stage split for the decode QSA top-k #4862
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#4862
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/3987
Author: @MarcoTool
Created: 10/24/2026
Status: 🔄 Open
Base:
main← Head:gfx906-topk-split📝 Commits (1)
1ff0677topk: an opt-in two-stage split for the gfx906 decode top-k (STRATA_GFX906_TOPK_SPLIT=1)📊 Changes
2 files changed (+252 additions, -3 deletions)
View changed files
📝
src/kernels/cuda/qsa_select.cu(+247 -0)📝
src/kernels/qsa_select_bench.cpp(+5 -3)📄 Description
Problem and result
At long context, a decode window's indexer top-k on gfx906 runs one CTA per query: HIP takes
block_topk_wide_kernelpast the register kernel's reach (82922f55), and the multi-CTA split from #2072 isCUDA-only. A window with 1–6 queries therefore keeps 1–6 of the MI50's 60 CUs busy.
This PR adds a two-stage split for the gfx906 build, enabled with
STRATA_GFX906_TOPK_SPLIT=1. With the variableunset, the dispatch is unchanged.
qsa_select_benchon one MI50 at this PR's base, 3 queries, capacity 262,144, the decode dispatch(
QSA_BENCH_TOPK_DECODE=1), 200 repetitions, two runs each with identical results:Approach
n_bid, with one CTA per chunk. In LDS,block_topk_kernel's rule picks each chunk's candidates. Every block thewhole query selects is among its chunk's candidates, because a query's selection restricted to a chunk is a prefix of
that chunk's order.
reference's.
The split is taken only for decode calls (no active-block count) past the register kernel's reach, with
nq <= 16and a geometry that fits the candidate buffer; anything else falls through to the existing dispatch.Limits
top-k at the same time.
STRATA_HIP_GFX906; CUDA and wave32 HIP builds areunaffected.
Validation
qsa_select_benchfor gfx906, CUDA sm_86 and wave32 HIP gfx1201; no warnings fromqsa_select.cu.src/core/dflash2.cpp, fixedseparately in #3986), so there is no end-to-end run on main. On a 0.1.43.1 base with the same kernels, decode at
258K went from 37.8 tok/s with the wide kernel to 39.4 tok/s with the split (Flash-Next IQ3_S, 2× MI50), and the
greedy answer was byte-identical to the reference build.
src/kernels/qsa_select_bench.cppgainsQSA_BENCH_TOPK_DECODE=1, which calls the top-k without an active-blockcount, as a decode window does, so the decode dispatch can be measured.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.