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

+14
View File
@@ -30766,6 +30766,20 @@ static void device_phase(const Plugin& pl) {
std::vector<RadTensor> ts = { T(d, RAD_U8, { (int64_t)1 << 20 }) };
std::vector<RadParam> ps = { PI("bytes", (int64_t)1 << 20) };
run_case(r, ts, ps);
/* With the architecture's own workgroup count (`blocks`): one block, the count
* Qwen3.8-Flash-Next asks for at a verify, the most the row takes, and absent, 0 and
* one past the most (the kernel's own count each) all launch, and the weight they read
* is the weight afterwards: the row writes nothing at any count. */
std::vector<uint8_t> h((size_t)1 << 20), back((size_t)1 << 20);
for (size_t i = 0; i < h.size(); ++i) h[i] = (uint8_t)(i * 131u + (i >> 9));
st_memcpy(d, h.data(), h.size(), hipMemcpyHostToDevice);
for (const long long nb : { 0ll, 1ll, 32ll, 1024ll, 1025ll }) {
std::vector<RadParam> pb = { PI("bytes", (int64_t)1 << 20), PI("blocks", nb) };
run_case(r, ts, pb);
}
st_memcpy(back.data(), d, back.size(), hipMemcpyDeviceToHost);
ok("prefetch at its caller's workgroup count leaves the weight as it was", back == h,
"the weight's bytes changed");
RadLayout L{};
const int st = r->layout ? r->layout(nullptr, 0, 0, nullptr, nullptr, nullptr, 0, &L) : 0;
ok("prefetch's layout hook takes any stored form (RAD_LAYOUT_ANY)", st == RAD_LAYOUT_ANY,