attn_flash_esimd (decode / verify and prefill) and attn_flash_quad (prefill) were written over HD
but gated to head_dim 256 (Qwen3.8's full attention); every other model fell to the SIMT kernel.
Both now dispatch 64, 128 and 256; the decode merge takes HD / 16 values a lane.
MiniCPM5-2B bf16 (head_dim 128, gqa 8) on the Arc Pro B65, same build, XE2_ATTN_SIMT=1 as before:
decode 69.3 -> 83.1 tok/s, prefill at ~2k tokens 1806 -> 8080 tok/s. rad-kbench attn_paged:
fixture 207/207, MiniCPM5 160/160, Qwen3.8-27B 160/160. KL against XE2_EXACT=1 over the
12-document corpus: mean 0.00060, top-1 98.59% (the SIMT kernel: 0.00060, 98.59%).
Qwen3.8-27B int4 unchanged (30.1 tok/s, 1361 tok/s prefill).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The score tile is now keys by query rows: K is the A operand (plain 2D loads instead of the
transposed one), Q^T the B operand, staged once a work-group by a transposed load. With the 16
query rows across the lanes, a row's max is a vertical max over the page's 16 key rows instead of
32 horizontal reductions a thread a step, exp(S - base) one subtract a key row, and a row's sum is
taken in reduce<>'s own order (lanes i and i + 8, then i + 4, i + 2, i + 1 -- key rows here), so
every value is the old one: probe output bit-identical, 64 x 64 through 64k. P goes to the swap
area as [query][key], two keys a 32-bit scatter lane, the layout the P V step already reads.
XE2_FAQ_KA=0 at build time keeps the S = Q K^T form.
Probe, 2048 rows over 2k / 16k / 64k: 16.9 / 30.6 / 30.5 -> 18.8 / 32.9 / 32.5 TFLOPS. Fresh
prompts (mtp4fc, MTP 6), against 5e44973: ~2.1k 1425 -> 1427 tok/s, ~24k 1234 -> 1249, ~47k 1048 ->
1066. rad-kbench attn --all-rows 227/227, full replay 1410/1410, greedy 8/8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fewer query heads a work-group (more work-groups a core) lost badly -- 28.3 -> 16.5 TFLOPS at 64k
with two of six, 11.3 with one: the six heads' threads sharing each page through L1 matter more
than occupancy. So the other way: for gqa <= 6 a work-group is two 16-row groups (48 threads, 126
KiB of staged queries and swap area), walking to its later group's end so every thread joins
every barrier (the earlier group's extra keys are past its rows' positions: hidden, P = 0, the
same output). Queries read from global instead of staged cost ~10% and were dropped; three row
groups (72 threads) do not launch. #pragma unroll had left the score and value loops rolled (5
DPAS in the binary); clang loop unroll(full) gives the 64, worth ~1%.
Probe, 2048 rows over 2k / 8k / 32k / 64k: 18.8 / 28.0 / 28.5 / 28.1 -> 18.4 / 30.0 / 30.5 / 30.5
TFLOPS, output bit-identical. Fresh prompts (mtp4fc, MTP 6): ~2.1k 1426 -> 1425 tok/s, ~24k 1221
-> 1234, ~47k 1025 -> 1048. rad-kbench attn --all-rows 227/227, full replay 1410/1410, greedy 8/8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 8-row form holds a thread's 8 x 256 f32 accumulator, which keeps it on the large register file
at 4 threads an EU; its stall samples were scoreboard waits, too few threads to cover the latency
of each step's loads and DPAS chains (paired threads sharing 16 rows showed it: 15 TFLOPS at one
work-group a core, 23.6 at two).
xe2_attn_flash_quad.cpp: a quad of threads takes 16 query rows of one head and 64 keys a step,
thread qd scoring page qd for all 16 rows (two DPAS chains on each key tile), the quad swapping row
maxima, then P and row sums, through local memory, and each thread running P V for its quarter of
the head dims. A 16 x 64 f32 accumulator: 128 registers with no spill, two work-groups (48
threads) a core. The softmax runs in the step's two 32-key halves in turn, so every value is the
8-row form's: probe output bit-identical at 2k..64k. It lives in libxe2 proper (the large-register
library would force it to 256); attn_paged_fast tries it first for rows >= 16, XE2_ATTN_NO_QUAD
skips it. (The query staging split four ways, by head-dim steps too, gave wrong output; two
threads stage a half each, not understood yet.)
Probe, 2048 rows over 2k / 8k / 16k / 32k / 64k of context: 16.7 / 25.0 / 24.0 / 23.4 / 22.3 ->
18.8 / 28.0 / 28.2 / 28.5 / 28.1 TFLOPS. Fresh prompts (mtp4fc, MTP 6), against 2da2eb0: ~2.1k
1419 -> 1426 tok/s, ~6.9k 1382 -> 1400, ~24k 1177 -> 1221, ~47k 952 -> 1025.
rad-kbench attn --all-rows 227/227, full replay 1410/1410, greedy 8/8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>