mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2220] [CLOSED] sm_75: QSA decode attention for INT8 KV off the shared-memory pipe (bitwise) #3931
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#3931
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/2220
Author: @rafatxf
Created: 10/13/2026
Status: ❌ Closed
Base:
main← Head:pr/sm75-qsa-attn-v3📝 Commits (1)
7546f47sm_75: QSA decode attention v3 for INT8 pools (bitwise)📊 Changes
1 file changed (+137 additions, -0 deletions)
View changed files
📝
src/kernels/cuda/qsa_decode_attn.cu(+137 -0)📄 Description
The decode attention over the QSA selection (
attn_chunk_kernel<1>, INT8 pools) saturates the SM's shared-memory pipe on Turing. Its time grew linearly with the queries while the SMs were half empty: per cell, every warp reads two 16-byte slices of each of the 12 query heads from shared memory (a two-way bank conflict atlane * 8) and runs 12warp_sums, 60 shuffles; the value loop then reads the 12 probabilities of a cell as 12 scalar loads. Loading the K/V codes earlier (software prefetch) changed nothing, so it is not memory latency.attn_chunk_q8_v3_kerneldoes the same operations in the same order:reduce12_gfx906(16 shuffles; every sum iswarp_sum's pairs, as its comment says);The chunk partials and the merged output are bit for bit the default kernel's. It is used by both entry points (
qsa_decode_attn_batch,qsa_decode_attn_step), so the MTP drafter's attention gets it too. Default on sm_75 only;STRATA_ATTN_V3=0keeps the default kernel,=1takes this one on any CUDA card. Lane-cell scoring (STRATA_ATTN_LANECELL=1) keeps its path.Setup
RTX 2080 Ti 22 GB (sm_75), i7-6700, CUDA 13.0, SM 1650 MHz, 240 W. Flash-Next, canonical Q2_0 pack,
--kv int8,--max-context 524288,--serve.Kernel (chunk kernel + merge, synthetic INT8 pools, permuted page table, 200 calls)
Partials and outputs compared with
memcmpagainst the default kernel in every case: identical. With the swizzle andreduce12alone (the gfx906 variants, also bitwise on CUDA) the 2,051-cell / 3-query case is 78 µs; the register copy of the query is what takes it to 73 µs, and further at fewer cells. At 2,051 cells and 3-4 queries the registers allow two blocks per SM (198-264 blocks: two waves); forcing three spills.qsa_prompt_attn_parityreports the same errors withSTRATA_ATTN_V3=0and1(its reference is this decode kernel: int8 32K / 2,048 queries 71.5 → 36.0 ms per chunk).Engine
Together with the Q2_0 matvec change of #2221 (both bitwise, measured as one step), 512 new tokens, two runs each: Spanish chat 86.0 → 87.8 t/s, code 103.1 → 106.1, English at 32K 75.3 → 78.4.
Part of the Turing set tracked in #2197.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.