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>
At a verify's 8 rows and a ~300-token context the 32 partitions held ~10 keys each, and every one
loaded the query, wrote a full state and was merged. A partition now takes at least 64 keys; the
ones past a row's keys write only an end marker (l = -1) and return, and the merge stops at it.
Tolerance-held as before: fixture 158/158 (rel_l2 <= 2.9e-4), the 27B 124/124.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
The lane-per-key attention read bf16 value rows with 16-byte loads only at head_dim 128; at 256
(Qwen3.8's full attention, 16 dims a lane) every element went through the generic loader. Two
16-byte loads a lane now. rad-kbench 138/138 on the fixture and 33/33 on the 27B (worst rel_l2
1.5e-4). SYCL_PROGRESS records the first 27B BetterBench run (5720a95): decode median 19.1 tok/s,
prefill 113.4 tok/s at 2000.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
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
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
xe2_gemm_nt_xmx / xe2_logits_gemm_xmx (M >= 17, bf16): joint_matrix M8 N16 K16 with use::b loaded
column-major straight from the [N, K] weight, eight sub-groups a work-group on one 64-column slice
so a B tile is in cache for all of them; tail rows go to the GEMV and shapes the tiles cannot read
to the exact kernel. xe2_attn_paged: one pass with an online softmax, keys over eight sub-groups,
head_dim over lanes, libref's masks, windows, ragged batches and fp8 descales. Both keep their
exact twins under XE2_EXACT=1.
rad-kbench: fixture 499/499, MiniCPM5-2B 482/482 (worst rel_l2 1.7e-4). KL against the libref
reference over 1914 positions: mean 5.8e-4, p99 3.2e-3, top-1 98.7% -- inside the bound.
Prefill of a 1795-token prompt: 4.57 s, 393 tok/s (was ~17); decode 33.2 tok/s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1