Archived
aql: no packet-header acquire on chained launches whose kernels acquire for themselves
A chained kernel that has lost its barrier bit is launched ahead of the kernels it depends on and reads nothing until its prologue wait has passed, where it acquires itself (and, since the previous change, empties the scalar cache). The acquire in its packet header runs when the packet processor launches the kernel, before the launches in front have written, so it guards nothing the kernel reads and only holds the packet processor: on an R9700, 2.1 us per launch with the agent-scope acquire against 1.2 us without. rad_kernel_chain may now answer 2 (libr4d's rows do): the chained forms' acquire covers everything they read. The loader records it (KernelRow::chain_fenced); the engine asks rad_dev_chain_infer(2) when chaining pays and every row that can chain, from every loaded library, says 2 (one row answering 1 keeps the acquire on all chained packets). The backend then issues a chained dispatch without its barrier bit with no header acquire, live and in played passes, unless the ring, the host epoch or a copy asks for one; releases, barrier packets, plain kernels and the prefetch stream are untouched, and a card with its arguments in VRAM and no HDP flush register keeps the acquire. RADIANCE_AQL_CHAIN_FENCE=1 puts it back on every chained launch. Qwen3.8-Flash-Next IQR-V4, TP2, MTP chain 3 with coupling, ABBA over 2 pairs: +0.75% tok/s [0.73, 0.78], all 156 texts identical. The three device tests added before now also run with the packets unacquired, and a shipped-plugins test requires libr4d's chained rows to answer 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
304597970f
commit
01f08152dc
11 files changed
+214
-50
No files matched your search
+8
-3
@@ -10956,7 +10956,12 @@ extern "C" int rad_kernel_concurrent(int i) {
|
||||
|
||||
/* Which rows can chain (RadKernelChainFn, rad_abi.h): every kernel their launch emits has a
|
||||
* chained form (r4d_chain.h) the launch selects from the `chain` parameter. A row joins this list
|
||||
* only once all of its kernels have one. */
|
||||
* only once all of its kernels have one.
|
||||
*
|
||||
* They answer 2: every chained form here ends its wait in r4d_chain_acquire, which empties the
|
||||
* scalar data cache behind the fence, so the engine may issue their packets without the packet
|
||||
* processor's acquire. A form that waited without it would have to keep this at 1 for the whole
|
||||
* library: one row's 1 keeps the fences on every chained packet of the engine. */
|
||||
extern "C" int rad_kernel_chain(int i) {
|
||||
const RadKernelInfo* k = rad_kernel_at(i);
|
||||
if (!k) return 0;
|
||||
@@ -11078,13 +11083,13 @@ extern "C" int rad_kernel_chain(int i) {
|
||||
"kv_store_i8",
|
||||
};
|
||||
for (const char* p : kChained)
|
||||
if (std::strcmp(k->name, p) == 0) return 1;
|
||||
if (std::strcmp(k->name, p) == 0) return 2;
|
||||
/* The host-mailbox twins (host_twins, --p2p off) of the two-rank fused writes: the same
|
||||
* launcher and kernels as the rows they are generated from, so the same chained forms. Only
|
||||
* these two: the other collectives' twins have not been run chained through the mailbox. */
|
||||
static const char* const kChainedHostTwins[] = { "ar_hc_write_host", "ar_gather_hc_write_host" };
|
||||
for (const char* p : kChainedHostTwins)
|
||||
if (std::strcmp(k->name, p) == 0) return 1;
|
||||
if (std::strcmp(k->name, p) == 0) return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user