arch/gemma4: the dense arm on the second lane beside the routed arm, in a step that runs whole

The two feed-forward arms of a Gemma 4 MoE layer read the same normed residual and meet only at
the feed-forward join; issued one after the other, the dense arm's three launches -- gate_up,
act_mul, down, ~36 us under --profile-ops at a 26B-A4B decode step on 4x R9700 -- wait behind the
routed arm's ~120 every layer. At a few rows its GEMMs are latency-bound, nowhere near the
bandwidth the experts' GEMMs take.

In a step that runs whole -- every decode and verify step, and a prefill chunk too short to cut --
the dense arm now rides the second lane: issued behind a join from lane 0 (the attention join is
its producer), beside the routed arm on lane 0, and joined back before the feed-forward reduction
reads both. Its rows of the join buffer and the routed arm's are disjoint. No collective rides it,
so the reductions keep lane 0 here and lane 1 in a cut prefill chunk, and a step's collectives are
on one lane as before. h, gate_up, ffn and ff2 are named to rad_buf_concurrent. Off with the
overlap's switch, RADIANCE_GEMMA4_OVERLAP=0, which now keeps every step on one stream; a startup
note says which.

arch_test: a decode step issues the dense arm's three launches a layer on lane 1 and every
all-reduce on lane 0, two joins a layer, and nothing on the two lanes that touches a common
element unordered; a 4095-token chunk the same; the cut chunks keep lane 1 for their reductions
alone. GUIDE.md's switch and ARCHITECTURES.md say so.

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 7a1ae22690
commit c527863248
4 files changed
+64 -20

No files matched your search

+5 -2
View File
@@ -520,8 +520,11 @@ are above every row band the sliced kernels have, so the step issues the same ke
same rows and its output is the whole step's, bit for bit. On 4x R9700 the reductions were 47% of
a 20K-token prefill under `--profile-ops`; a model of the measured times puts the overlap at up to
a quarter off an unprofiled prefill. The per-op profile syncs every op, so it cannot show it --
time a prefill without `--profile-ops`. `RADIANCE_GEMMA4_OVERLAP=0` runs every chunk whole, and the
startup note says which. A decode step never takes the second lane.
time a prefill without `--profile-ops`. A step that runs whole -- every decode and verify step --
takes the second lane for the dense arm instead, beside the routed arm, which needs nothing of it
until the feed-forward join: at decode the dense arm's GEMMs are a few rows, latency-bound and far
from the bandwidth the experts take, and its reductions stay on lane 0. `RADIANCE_GEMMA4_OVERLAP=0`
keeps every step on one stream, and the startup notes say which.
**The draft head in fp8.** The drafter's head is the widest read on the draft path: the target's
bf16 table, 352 MiB a rank at tp 4, every draft pass. A container converted with the line
+1 -1
View File
@@ -1860,7 +1860,7 @@ rad-kbench --home $RADIANCE_HOME --max-cases 1 # are the kernels correct at al
| `RADIANCE_LOG_STEPS` | log one line per step: its phase, sequences, and each one's token count and context (§4.5) |
| `RADIANCE_G4K_WMMA` | `0` keeps `gemma4k`'s prefill attention on its scalar kernel instead of the WMMA one. An A/B switch and a way out if the matrix path misbehaves on a card; read once |
| `RADIANCE_GEMMA4_FUSE` | `0` makes `arch/gemma4` declare the chains instead of `gemma4k`'s fusions: the rmsnorm / add chain for the sandwich joins (`norm_add_norm`, `norm_add_norm_route`, `join_add_scale`), `embed_lookup` + `mul` for `expert_scale`, and a `cast` lifting q for `attn_paged` for `attn_paged_qrow`. An A/B switch; read at declare |
| `RADIANCE_GEMMA4_OVERLAP` | `0` runs every `arch/gemma4` prefill chunk whole, its all-reduces on the compute stream, instead of as two slices whose all-reduces ride a second stream beside the other slice's compute. An A/B switch; read at declare |
| `RADIANCE_GEMMA4_OVERLAP` | `0` keeps every `arch/gemma4` step on one stream: a prefill chunk runs whole, its all-reduces on the compute stream, instead of as two slices whose all-reduces ride a second stream beside the other slice's compute; and a decode step runs the dense arm after the routed arm instead of beside it. An A/B switch; read at declare |
There is also a family of instruments for engine development — `RADIANCE_DEBUG_*` (residual probes,
idle scrubs, routing and issue dumps), `RADIANCE_OP_ORACLE*` (named ops checked against `libref` on