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

+10
View File
@@ -73,6 +73,16 @@ extern "C" int r4d_rad_prefetch(const RadArgs* a, RadStream stream) {
if ((uintptr_t)w->data % 16) return R4D_NO(RAD_E_ALIGN);
int nb = r4d_cfg_prefetch_nb(a);
if (nb < 1) nb = 64;
/* The architecture's own count (`blocks`): the read shares the card with the kernels it runs
* beside, whose loads queue behind its own and whose launches wait for the wave slots it
* holds, so the best count follows what those kernels are. Qwen3.8-Flash-Next's delta-net
* update, a latency-bound kernel of a few loads a block, loses more to 64 blocks of reads in
* flight than the projection behind it gains (ms a step at 16 / 24 / 32 / 48 / 64 / 128 / 256
* blocks, against 64: +0.77% / +0.14% / -0.31% / -0.24% / 0 / +2.0% / +7.4%). */
{
const long long blocks = r4d_geti_or(a, "blocks", 0);
if (blocks > 0 && blocks <= 1024) nb = (int)blocks;
}
const bool ch = r4d_geti_or(a, "chain", 0) != 0;
return R4D_EMIT(stream, (ch ? r4dchain_prefetch : prefetch_kernel), dim3((unsigned)nb), dim3(256), 0,
(const int4*)w->data, (size_t)(bytes / 16));