Archived
An attention block with separate q, k and v projections and per-head norms (Gemma 4) runs five single-pass ops between the projections and the cache store: rmsnorm_p on v (or on the raw k where v is k), rmsnorm over the q heads, rmsnorm over the k heads, rope on q, rope on k. qkv_norm_rope does them in one dispatch, one workgroup a (token, head). Byte-identical to the five: the same norm widths r4d_act_threads picks and rope's ladders, head included. The row is constrained to head_dim 256..512 in steps of 256; other shapes keep the five. The selftest compares both of Gemma 4 31B's attention classes at M 1/4/40.