gemma4k, arch/gemma4: attn_paged_qrow -- q in the fused row only where gemma4k reads it

8772d5b handed the sliding layers' attn_paged q as a column slice of the fused [q|k|v] row. gemma4k
reads that; libr4d's paged attention reads q only dense and refuses the slice with RAD_E_STRIDE,
which stops the engine at the first step. Under attn_paged the first library in --kernels wins, so
the slice was only safe with gemma4k ahead of libr4d -- and the deploy script's default order
(libr4d,gemma4k,libavx) took the server down at layer 0's attention on both profile runs.

gemma4k now declares the same kernels a second time under attn_paged_qrow: attn_paged's schema
field for field, with q read at its own row pitch. Only gemma4k declares it, so it resolves there or
nowhere. The sliding layers ask for it once; where it resolves they read q in place (no lift), and
where it does not -- a hierarchy without gemma4k, or RADIANCE_GEMMA4_FUSE=0 -- q is lifted into a
dense block by a `cast` again and attn_paged reads that, which every attention library takes. The
lift's buffer is declared only then, since an unnamed buffer is live for the whole program. A miss
is the swa group's first op carrying a block_size, and answers rad_kv_block_size with the
RAD_KV_BLOCK it declares, as attn_paged would. No libref row, as the joins.

The kernel order still matters for speed -- gemma4k first is the order this model was measured with
(ARCHITECTURES.md) -- but no longer for whether the server runs. A startup note says which form
was taken.

arch_test: the slice reaches attn_paged_qrow and never attn_paged; refused, every sliding layer
lifts q for attn_paged; a decode step issues either form; and the three older gemma4 tests
count the sliding layers' attention under its new name. docs: OPS.md's row and paragraph (and a
line of the joins' text reflowed to the width, as one of gemma4.cpp's), ARCHITECTURES.md's kernel
paragraph, which now names expert_scale too, and GUIDE's FUSE row.

Not yet run on the cards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AshlynandClaude Opus 5.5 committed 2026-10-12 14:40:04 -05:00
1 parent e173365823
commit 73c3dc38be
6 files changed
+168 -41

No files matched your search

+7 -4
View File
@@ -520,10 +520,13 @@ expert parity, so a rank holds an even number of experts.
**Kernels.** `--kernels gemma4k,libr4d,libavx`, **gemma4k first.** It serves all of the trunk's
attention -- the sliding layers (h256, gqa 2) and the full layers at gqa 8, 4 and 2 (one or two,
four, eight ranks) -- plus `pair_argmax` and the two sandwich-norm joins (`norm_add_norm`,
`join_add_scale`), which the plugin declares as the rmsnorm / add chain where nothing serves them;
the startup note says how many were fused. libr4d has h256/gqa2 and h512/gqa8 rows as well,
written for the dense 31B; with gemma4k first the 26B-A4B runs on the kernels it was measured with.
four, eight ranks) -- plus `pair_argmax` and the fusions: the two sandwich-norm joins
(`norm_add_norm`, `join_add_scale`), `expert_scale`, and `attn_paged_qrow`, the sliding layers'
attention reading q where the fused qkv projection left it. The plugin declares each one's unfused
form where nothing serves it -- the rmsnorm / add chain, `embed_lookup` + `mul`, a `cast` lifting q
for `attn_paged` -- and the startup notes say which were taken. libr4d has h256/gqa2 and h512/gqa8
rows as well, written for the dense 31B; with gemma4k first the 26B-A4B runs on the kernels it was
measured with.
Without `gemma4k` at all, the full layers have no kernel at four and eight ranks, and a drafter head
sharded over more than one rank has no `pair_argmax`.