kv: a group a rank keeps no cache for

rad_kv_group_zero(b, group): the group is declared as on every other rank --
the scheduler indexes groups by position and one block table serves every
rank -- and this rank carves nothing for it: its block count is the shared
table's, its costs are zero, its pool base is null, and issue refuses any op
on this rank that names it. For a rank the geometry gives no attention heads,
whose attention is a fill of zeros and never stores or reads a key. qwen4exp
declares its attention group so on such a rank. The arch test's contract
becomes the real one: same KV groups by position; ops are each rank's own.
This commit is contained in:
baKon authored and StillDeadcode committed 2026-10-06 11:23:06 +02:00
1 parent 7be92ec8f4
commit 3e629e7a27
9 files changed
+95 -18

No files matched your search

+5
View File
@@ -1130,6 +1130,11 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c
lay.attn.qsa_exact_to = m.qsacfg.budget + m.qsacfg.ratio - 1;
}
RAD_ARCH_TRY(rad_bind_layer_kv(b, (int)l, m.kv_full));
/* AN ATTENTION-ZERO RANK KEEPS NO ATTENTION CACHE. Its block is a fill of zeros
* (rad_block_attn_gated_fp8.h) and never stores or reads a key; the indexer below
* reads only the group's block table, which every rank shares. Once per model: the
* group is one and the call is idempotent, but the first layer is the honest place. */
if (g.attn_zero && m.kv_full) RAD_ARCH_TRY(rad_kv_group_zero(b, m.kv_full));
lay.attn.ar_out_take = lay.hc_mix.ar_take();
RAD_ARCH_TRY(lay.attn.declare(b, nm, g, (int)l, m.kv_full, m.n_rot, aw, as,
false, false, kArNone, lay.hc_mix.op_ar_write != 0));