mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2234] [CLOSED] Batch decode: one launch for all rows in QSA attention and GDN recurrence (opt-in) #3941
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#3941
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/2234
Author: @yi-sudo
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:batch-row-kernels📝 Commits (1)
d4b3432Batch decode: one launch for all rows in QSA attention and GDN recurrence (opt-in)📊 Changes
8 files changed (+233 additions, -6 deletions)
View changed files
📝
docs/BATCHING.md(+31 -0)📝
include/strata/kernels/qsa_decode_attn.hpp(+12 -0)📝
include/strata/kernels/qsa_select.hpp(+10 -0)📝
include/strata/kernels/verify_kernels.hpp(+14 -0)📝
src/core/verify.cpp(+69 -0)📝
src/kernels/cuda/qsa_decode_attn.cu(+39 -1)📝
src/kernels/cuda/qsa_select.cu(+22 -4)📝
src/kernels/cuda/verify_kernels.cu(+36 -1)📄 Description
Title
Issue: none (an opt-in speed change)
Summary
With
--batch N, the verify window ran QSA block scoring, top-k and decode attention as one launch per row, and theGDN recurrence (in the window and in the 1-row commit) as one launch per slot. With 4-8 live slots, these serial
launches are most of what a window costs beyond the expert reads. Two opt-in switches run each of them as one launch
for all rows:
STRATA_BATCH_ATTN_ROWS=1: block scores, top-k and decode attention for all of the window's rows (up to 8), onelaunch each. Every row still reads its own slot's indexer keys and K/V pools. These are passed by value as kernel
params, so the graph captured per row layout stays valid. A slot that streams KV (
kv_mode1) keeps the per-rowpath.
STRATA_BATCH_GDN_GROUPS=1: the GDN recurrence in the window, and the commit of 1-row groups, for all slots in onelaunch (
grid.y= slot group). The conv commits stay per slot.Default path: with both switches unset, the engine runs the same launches as before. Only kernel params with a
{}default were added, and they are unused whenn = 0.Exactness with the switches on: the arithmetic per row is the same. I sent 4 concurrent temperature-0 prompts
(
parity.py) and the patched build produced byte-identical output to upstreama0116b2, with both--batch 4and--batch 8.Measured 2026-10-13, same day for both arms, on one RTX PRO 6000 Blackwell Workstation (96 GB, driver
610.57.04, CUDA 13.0, Linux). Settings: IQ3_S with all 24,576 experts in VRAM,
--kv int8, 262144 context,--mtp --spec 4 --spec-min-p 0.5,--vision. The load went through the HTTP server: C different story prompts sentat once, 1024 tokens each, temperature 0.7, mean of 2 rounds. Total tok/s:
--batch 4--batch 8(reserve 6144 MiB)The window time, from
strata batch:in the engine log:That is about 1.7-1.9 ms per added row instead of 2.4 ms. The same patch on 0.1.43 (
7695859) gave 268.5 → 312.9(
--batch 4, 4 clients) and 308.5 → 377.8 (--batch 8, 8 clients).Scripts, raw JSON and engine logs: https://github.com/yi-sudo/strata-batch-boost (
lab/,lab/results/latest-a0116b2).What changed
src/kernels/cuda/qsa_decode_attn.cu,include/strata/kernels/qsa_decode_attn.hpp:attn_chunk_kerneltakes an optionalQsaAttnPoolsRows; queryblockIdx.zuses its own pools.qsa_decode_attn_batch_rows.src/kernels/cuda/qsa_select.cu,include/strata/kernels/qsa_select.hpp:block_scores_multi_kerneltakes an optionalQsaScoreRows(per-query pooled/dead keys).qsa_block_scores_rows.src/kernels/cuda/verify_kernels.cu,include/strata/kernels/verify_kernels.hpp:gdn_step_norm_multi_kerneltakes an optionalGdnGroups(per-group state, keep, first row, token count).gdn_step_norm_groups, for the window and for the commit.src/core/verify.cpp:record_windowuses the row launches in thebatch_rec_QSA and GDN branches when the switches are set.capture_commit_batchcollects 1-row groups into one GDN commit launch.docs/BATCHING.md: a short section with the switches and the table above.What this leaves alone: the solo path,
--batch-mtp, layer splits (not tested), KV streaming (falls back), the convcommits, the indexer appends, and every default.
Extra Notes
.cufiles are also part of the HIP build, which I couldnot build here (no ROCm). The SYCL port has its own copies of these files and is untouched.
shared experts). #1888 changes the QSA decode attention kernel for the single-query case. This PR is independent of
both and only merges launches.
--batch-mtp. Drafts are accepted 50-57% of the timein batch windows, but a row only pays above ~67%, so it was slower (raw data in the repo above).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.