attn_paged_fast sent any window > 0 to the SIMT split-KV kernel, so every sliding-window layer
(Gemma 2/3/4, Mistral-style and gpt-oss models) missed the DPAS decode and prefill kernels. They now
take the window: each 8-row block starts at its first row's bound (pos - window + 1, on a whole
32-key step; the split decode form partitions from there) and the mask hides keys below each row's
own bound, as libref's attn_paged. The window form is its own instantiation (WIN), so the window-0
kernels are unchanged: the Qwen3.5-9B's attention times match a rebuild of the old code to 0.5%.
The quad prefill form keeps window 0; a windowed prefill takes the esimd prefill form.
rad-kbench, Gemma 4 E2B (head_dim 256, window 512): decode 101 -> 23.5 us and 23 -> 18 us;
q_len 128 757 -> 92 us; q_len 512 2833 -> 98 us; 320/320 within tolerance. Qwen3.5-9B 160/160,
default fixture 2144/2144.
Gemma 4 E2B end to end: decode 63.0 -> 74.4 tok/s, 2.4k-token prefill 1537 -> 1886 tok/s; a story,
a 120-paragraph count and a password at paragraph 77 of 120 answered correctly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
At depth the kernel fell from 18 to 13.6 TFLOPS (a 2048-row chunk of Qwen3.8-27B's 24/4 heads,
head_dim 256, over 8k -> 64k of context): every 8-row work-group streamed its kv head's whole history,
and the stall samples were scoreboard waits on each step's loads, issued just before their DPAS.
- gqa <= 8: four 8-row blocks a work-group (the threads of one Xe-core walk the same pages, so a
page comes from L2 once for 32 rows; 128 KiB of staged queries), and two of its threads prefetch
the next step's two pages to L1 (one gather lane a 64-byte line). Each alone was worth little or
lost (prefetch from 8-row work-groups: 7.9 TFLOPS at 64k); together 13.6 -> 19.6.
- the value loop's 2D loads 8 at a time before their DPAS (2, 4, 16 measured; the score loop's
batched the same way spilled and lost).
- the accumulator rescale skipped when no row's max moved (x * 1.0f is x).
Every sum is in the order it was, so the output is unchanged: probe output bit-identical at
2k..64k, rad-kbench attn --all-rows 227/227, full replay 1410/1410, greedy 8/8.
Probe, 2048 rows over a context of 2k / 8k / 16k / 32k / 64k: 13.9 / 18.3 / 16.8 / 15.2 / 13.6 ->
16.7 / 25.0 / 24.0 / 23.4 / 22.3 TFLOPS. Fresh prompts (mtp4fc, MTP 6): ~2.1k 1423 tok/s, ~24k 1177,
~47k 952 (bench-standard's 32k / 64k depths measured 1077 / 806 at 7f95c56).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
S = Q K^T for a step's two pages ran as two chains of 16 DPAS, one after the other, each DPAS
waiting on the last's accumulator. With both pages mapped they now advance together a head-dim
step at a time, the same sums in the same order; a step with one page keeps the single chain.
(Tried before the large-GRF fix it was slower: the extra K operand spilled.)
Probe fa.cpp (24/4 heads, head_dim 256): 8192 tokens 15.6 -> 18.9 TFLOPS, 2048 tokens 13.4 ->
13.5; output identical. rad-kbench attn --all-rows 227/227. qwen3.8-27b-w4a16 (mtp4fc), fresh
prompts: prefill ~6.9k tokens 1301 -> 1326 tok/s, ~2.1k 1376 -> 1381; greedy 8/8 identical.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 128-wide broadcast copies of the row base and correction overflowed the register file;
per-row selects compute the same values (bit-identical output) and the 2048-token call
drops from 7.8 to 6.6 ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Under Geom::plain_norm a down projection that reads the bf16 plane and no codes (w4a16 /
w4a8i8 quantise their own activation) takes `silu_mul` instead of gated_quant_fp8 (the E4M3
pass nobody read: 17 us a call, 64 a round).
- silu_mul: float exp, libref's double chain again only near a bf16 tie (near_bf16_tie, as the
gdn activations): op oracle 300/300 bit-identical at tolerance 0.
- rmsnorm's bf16 head rows (n = 128..512): a lane its contiguous slice by 16-byte loads (16 us ->
a few us a q / k norm call). rad-kbench rmsnorm 240/240.
- the flash kernel's staged queries sized for gqa <= 8 (24 of 64 KiB a work-group).
Greedy decode proxy (depth 5, mtp4, draft vocab 131072): 74.3 -> 81.2 tok/s. KL against the
exact reference 0.00231 (was 0.00239), top-1 96.70%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
attn_paged_fast's single-sequence calls under 16 rows took the SIMT kernel (a lane a key, full
256-wide dots: ~137 us a verify call at ~400 tokens). The flash kernel now has a split form: a
work-group a (row block, kv head, partition), partitions past the context exit at once, each
partition's unnormalised (m, l, O) to scratch and a merge pass a sub-group a (row, head).
XE2_ATTN_DEC_SIMT=1 keeps the SIMT kernel. rad-kbench -m mtp4 --op attn_paged: 240/240; greedy
against SIMT 5/8 identical, the others diverge late at near-ties.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SIMT kernel gives each (query row, kv head) a work-group and scores keys with f32
multiply-adds, so at a 2048-token chunk every row re-reads its keys and values: Qwen3.8-27B's 32
full-attention calls of a 2234-token prompt took 1.41 s (--profile-ops). The ESIMD form takes a work-
group per (8 query rows, kv head), a thread per query head, and shares each page of keys and values
among the 8 rows of all of them: Q K^T on bf16 DPAS with K^T from a transposed 2D load of the page
(a 16-token page is a DPAS's 16 keys), the online softmax in f32 over 32 keys a step, P rounded to
bf16 and P V on DPAS with V by a VNNI-transforming load. Q waits in local memory so the registers
hold the 8 x 256 f32 accumulator. Served for a single sequence's prefill (16+ rows), causal without
a window, bf16 query, cache and output, pages of 16, head_dim 256; everything else keeps the SIMT
kernel (XE2_ATTN_SIMT=1 forces it).
rad-kbench: qwen3.8-27b-w4a16-rtn 240/240 (the flash cases rel_l2 1.6-2.3e-3, tolerance 2e-2),
fixture attn* 237/237. Prefill: 2234 tokens 5.90 -> 4.78 s, 2475 tokens 481 tok/s; the summary of
a 2000-token prompt reads as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>