kernels: paged attention at h512/gqa8 and h256/gqa2, windowed prefill band

head 512 (gqa 8) — a head width the library had not compiled before — for the
global layers, head 256 (gqa 2) for sliding-window decode, plus the >=32-token
windowed prefill fix. Numeric selftests vs an inline port of ref_attn_paged
with negative control; env-gated attn-verify probes (R4D_VERIFY_ATTN, default
off) at the decode entries.
This commit is contained in:
sfjes committed 2026-10-10 00:36:08 -07:00
1 parent 8b825a941c
commit dd3310849a
6 files changed
+493 -14

No files matched your search

+7
View File
@@ -57,6 +57,13 @@ set(RAD_W4_GROUP 128 CACHE STRING "libr4d quantised-weight group size (must matc
set(R4D_UNITS
"r4d_attn_paged_h256_gqa6|"
"r4d_attn_paged_h128_gqa4|"
# Gemma 4 dense sliding window: head_dim 256, 2 queries per KV head, windowed decode only
# (prefill falls to the caller's libref path). The windowed twin of the drafter leg above.
"r4d_attn_paged_h256_gqa2|"
# Gemma 4 dense global layers: head_dim 512, 8 queries per KV head, full attention (window 0).
# The head_dim the library had not compiled before -- the prefill KV tile drops to 16 to fit 64
# KiB of LDS, and the decode combine takes the head-generic merge (DPL 16 breaks the vector form).
"r4d_attn_paged_h512_gqa8|"
# Eight queries per KV head, at both head widths: the routed 35B-A3B is 16 over 2 at 256
# and MiniCPM5-2B is 16 over 2 at 128. Same device code, different instantiations.
"r4d_attn_paged_gqa8|"