Archived
libxe2: split-KV attention -- a kv head's keys read once for its query heads, decode across the card
The long-context decode profile was 70% attention: one work-group a (row, head) left most of the card idle at one row and read each kv head eight times. xe2_attn_paged now splits a row's keys into partitions of 32 or more across work-groups, each work-group a (row, kv head, partition) whose sub-groups are the kv head's query heads, the partial softmax states merged from 64 MiB of scratch (the scratch hook); prefill-sized row counts take one partition and write directly. rad-kbench 138/138 and 132/132, KL against libref mean 5.8e-4, p99 3.2e-3, top-1 98.5%. Decode after a 1797-token prompt 16.2 -> 29.8 tok/s; short-context decode 32 tok/s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
1 parent
96b3e1be83
commit
b57c2db60c
4 files changed
+143
-85
No files matched your search
@@ -399,6 +399,19 @@ the rest under 1.5% each.
|
||||
head) on a 160-engine card, and each kv head is read by 8 query heads. Next: split the keys across
|
||||
work-groups and share a kv head's reads across its query heads.
|
||||
|
||||
## Phase 4, step 3 (2026-10-23): split-KV attention
|
||||
|
||||
Long-context decode profile (1.8k-token prompt, 64 steps): attn_paged 69.9%, gemm_nt 11.1%,
|
||||
rmsnorm_quant_fp8 9.3%, gated_quant_fp8 4.1%. `xe2_attn_paged` is now flash-decoding: a work-group a
|
||||
(row, kv head, key partition) whose sub-groups are the kv head's query heads (each key read once for
|
||||
all 8), partitions of 32+ keys merged from 64 MiB of scratch; P = 1 for prefill-sized row counts.
|
||||
A first try at 256-key partitions halved short-context decode (all keys in one partition, each
|
||||
sub-group walking every key for its head): 32 keys fixed it.
|
||||
|
||||
- rad-kbench 138/138 and 132/132 (worst rel_l2 2.9e-4); KL mean 5.8e-4, p99 3.2e-3, top-1 98.5%.
|
||||
- **Decode after a 1797-token prompt: 16.2 -> 29.8 tok/s**; short-context decode 32.0 tok/s;
|
||||
1797-token prefill 4.61 s.
|
||||
|
||||
## Next steps
|
||||
|
||||
1. ~~Milestone B, part 2: `minicpm5-2b-fp8.rad`~~ **Dropped by the user (2026-10-23): "instead of the
|
||||
|
||||
Reference in new issue
Block a user