libxe2: attention scores a key a lane with 16-byte loads -- decode 32 -> 55 tok/s

Each sub-group now takes sixteen keys a step, one a lane: the lane scores its key in full against
the query in local memory, one max and one sum update the flash state, and the value rows are added
with each key's weight taken from its lane. bf16 cache rows are read 16 bytes at a time, and each
row's own visible span is split evenly 32 ways on the device instead of the context limit (which
left most partitions empty at a short context).

rad-kbench 138/138 and 132/132; KL against libref mean 5.7e-4, p99 3.1e-3, top-1 98.6%.
MiniCPM5-2B on the B65: decode 55 tok/s at a short context and 49 tok/s after a 1797-token prompt
(was 32 and 30); that prompt's prefill 1.62 s, 1109 tok/s (was 4.61 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
claudeandClaude Opus 5.5 committed 2026-10-23 20:58:52 +02:00
1 parent a71783806a
commit c0497e040e
2 files changed
+93 -28

No files matched your search

+14
View File
@@ -427,6 +427,20 @@ and every value computed twice, a double exp each).
- After: **26.6 ms/step** -- gemm_nt 9.62, attn_paged 9.50, rmsnorm_quant_fp8 3.75, logits_gemm 1.02,
gated_quant_fp8 0.87.
## Phase 4, step 5 (2026-10-23): attention, lane-per-key with vector loads
- 16 keys a step, one a lane: a lane scores its key in full against q in local memory; one max and
one sum a step; value rows accumulated with each key's weight taken from its lane. Alone: 9.5 ->
8.8 ms/step.
- Partitions split each row's *own* visible span on the device (P = 32), not the context limit.
Alone it was slower (11.5 ms: fewer active work-groups), which showed the real cost.
- bf16 cache rows read 16 bytes at a time (keys for the lane's dot, values for the lane's 8 dims):
**4.67 ms/step**. P = 64: 4.81, P = 128: 7.46 -- kept 32.
- rad-kbench 138/138, 132/132; KL mean 5.7e-4, p99 3.1e-3, top-1 98.6%.
- **Decode 55 tok/s short context, 49.2 tok/s after a 1797-token prompt (was 29.8); that prefill
1.62 s = 1109 tok/s (was 4.61 s).** Device time a 1.8k-context step 23.4 ms (profiled):
gemm_nt 9.7, attn 4.7, rmsnorm_quant_fp8 3.8.
## Next steps
1. ~~Milestone B, part 2: `minicpm5-2b-fp8.rad`~~ **Dropped by the user (2026-10-23): "instead of the