mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1821] [CLOSED] qsa_prompt_attn: int8 K/V prefetched in registers and sharing one buffer (Turing / sm_75) #3698
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#3698
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/1821
Author: @xrip
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:pr/turing-prompt-attn-int8📝 Commits (1)
74616caqsa_prompt_attn: int8 K/V prefetched in registers and sharing one buffer (Turing)📊 Changes
2 files changed (+79 additions, -18 deletions)
View changed files
📝
src/kernels/cuda/qsa_prompt_attn.cu(+71 -16)📝
src/kernels/qsa_prompt_attn_parity.cpp(+8 -2)📄 Description
What
Turing (sm_75) only,
--kv int8only: the prompt attention kernel that Turing runs (v1,qsa_prompt_attn.cu) getsfaster with the same output bits. Other GPUs and other KV modes run the same code as before.
Why
On Turing the v1 kernel used 37.9 KB of shared memory per 128-thread block, so only one block fit on an SM (4 warps,
12.5 % of what an SM can hold). Each 32-cell chunk also loaded its scattered K and V rows only after the previous
chunk had finished. Nsight Compute on a CMP 50HX (TU102, RTX 2080 Ti class) showed
long_scoreboard(waiting onglobal loads) as the top stall.
Change
where the old gather stored them. (sm_80+ uses
cp.asyncfor this; Turing does not have it.)p·v, so V is written overK after the scores' barrier; the softmax's barrier keeps it before
p·v. 37.9 -> 29.2 KB per block: two blocksper SM instead of one.
The same bytes land in the same places and the arithmetic is unchanged, so the results are bitwise the same.
qsa_prompt_attn_paritynow also prints a checksum of the new kernel's output, so two builds can be compared bitfor bit.
Measured
CMP 50HX (sm_75, unlocked to RTX 2080 speed, 20 GB), CUDA 13.3, GCC 14.2.
qsa_prompt_attn_parity, int8, 2,048 queries:All output checksums (int8 and fp16, at 4K / 40K / 140K) match the old kernel.
Whole engine: Flash-Next IQ3_XXS, 2x CMP 50HX with
--layer-split auto, 2x Xeon E5-2670 v2. A coding-agent sessiongrew from 34K to 190K tokens over 36 turns (+~4.4K tokens per turn, greedy, fresh server per run). The text of all 36
turns was identical to the old build. Incremental prompt read time went down 3.5 % (median per-turn ratio 0.965), and
decode did not change.
Note: these numbers were measured on a fork based on 0.1.38. The patch applies to current
mainwithout changes;re-measuring on 0.1.41 is still to do.
How to check
On an sm_75 card, before and after:
The
new output checksumlines should be equal and the time per chunk lower.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.