Each code-object load synced the GPU's code caches before returning: on
the R9700, 9.8-10 ms per load and about 600 ms for the 60 loads of a new
LSE pass width. The prefill agent's profile of a cold 137-token prompt
put 1.3 s of its 1.7 s TTFT in this stack.
With a driver that serves CodeSync (build 258 on), a load now only marks
the connection's code pending. The doorbell hook syncs once before the
next doorbell of any of the connection's queues, outside the queue's
mutex. Every AQL packet reaches the GPU through that hook, and no packet
runs before its doorbell, so new code still never runs from stale
caches. A failed sync stays owed and fails that queue with the error.
The sync is CodeSync itself (selector 90), a kernel-ring cache invalidate
with no queue created, so it never needs a queue slot. Drivers before
258 keep the old per-load sync, because their fallback puts a packet in a
runtime queue, which from the doorbell path would land after the
application's own packet.
hsa-code-sync-coalesce-test, on a build 258 fake: eight loads cost no
sync; the next doorbell runs exactly one, ahead of that doorbell; a later
doorbell with nothing loaded runs none; one more load costs one more sync
at its doorbell; nothing is put in the application's queue. The existing
code-sync test still covers the old drivers' path.