qwen4exp: verify/decode pass launch order, prefetch width, chain polling, turnover slots

Lossless (no kernel arithmetic or operand change): the router weight is read beside the mixer
all-reduce; k/v projections before q|gate; the indexer's keys behind the attention launches within
the exact bound; verify-height prefetch at 32 workgroups (`prefetch` takes an optional `blocks`
param) and the shared down arm before the routed down from 2 rows (kVerifyRows); chain waits poll by
grid size (R4D_CHAIN_TINY/SMALL/MID); the mover's kept-free turnover slots follow the swaps the
engine asked for (MoverConfig::turnover_adaptive) instead of a fixed 640.

arch_test: new a_flash_next_decode_step_orders_its_small_launches; the pinned graph fingerprints and
step hashes of qwen4exp_fp8 move (re-pinned). place_test: the adaptive turnover. r4d_selftest: the
`blocks` param of prefetch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Code000andClaude Opus 5.5 authored and StillDeadcode committed 2026-11-17 20:33:07 +01:00
1 parent 946a6f9e2b
commit ca7a7212ec
20 files changed
+598 -44

No files matched your search

+19
View File
@@ -739,6 +739,25 @@ that equality. `docs/QSA.md` is the decomposition.
The vision tower is declared when the container carries one and `mm-max-patches` is not 0
(`arch/common/rad_block_vit.h`, `spec.md` §11).
**A decode step is its launches.** A verify pass at depth 3 is ~900 launches a rank in ~10 ms on two
R9700, against 4.1 GB of weights read a rank (6.4 ms at the cards' 640 GB/s): the connections' reads,
the delta net's update, the routers and the reductions are bound by their own chains of loads, not
by bytes, and every launch behind another costs the step ~1.6 us where it waits for it and ~0.5 us
where it does not (measured by adding launches; `scripts/stampseq.py`). So where a recorded pass
lets a launch start beside the last ordered one (`Ctx::haz_mark`), the plugin issues the small
launches of a decode step where they ride, the same kernels on the same operands in another order
(`qwen4exp_fp8.cpp`, `kVerifyRows`): k and v in front of the q|gate projection; the indexer's
keys behind the attention's own launches where nothing of the layer reads them (within the
exactness bound); the router's weight read beside the mixer's reduction; and from two rows the
shared expert's down projection in front of the routed one and the weight reads at 32 workgroups
instead of 64. Chain 3 with coupling, one server, interleaved rounds: 12.11 -> 11.82 ms a step
(-2.5%) with the chained kernels' wait polling by grid size (`libr4d/r4d_chain.h`); a plain decode
step takes the order that helps at one row (router read, k and v, the indexer's keys). What did not
help is in the comments beside each: a read of the mixer's first projection or of the connections'
matrices in front of their reads, the shared arm beside the router, more workgroups for the reads
(128: +2.0%, 256: +7.4%), and a connection read that asks for its own matrices before its wait
(+2.3%).
---
# `glm5next`: GLM-5.3-Flash
+5 -2
View File
@@ -945,10 +945,13 @@ the count from `tail`, as a GEMM takes its M from its operands.
| op | params | operands |
|---|---|---|
| `prefetch` | `bytes` | `w`w |
| `prefetch` | `bytes` `blocks`/opt | `w`w |
Reads the first `bytes` of a weight's stored form and writes nothing, so a kernel that streams the
weight next finds those bytes in the on-die cache (64 MB on gfx1201). It is issued beside a
weight next finds those bytes in the on-die cache (64 MB on gfx1201). `blocks` is the number of
workgroups reading where the architecture measured its own (the read holds wave slots and queues
its loads in front of the kernels it runs beside, so the best count depends on them); absent or 0
it is the kernel's `nb` axis. It is issued beside a
collective that leaves the card's memory idle: on the second lane (`rad_lane`), or, where launches
chain (`rad_chain_on`), as its chained form on the same lane right behind the GEMM before the
collective, which waits for that GEMM only and does not hold the collective. A plain read on the