Files
AnyPS5/docs/dev
ntamas94andClaude Opus 5.5 baa0ca3dfc fix(agc): store a small label behind copied write-backs at reap instead of draining
The first commit drained the device for every label recorded while any
copied writer was listed, including labels nowhere near it. CPU-copied
writers also occur in default runs, so that could cost a drain per label
in normal play.

While a copied writer is listed, a label of 8 bytes or less (every
RELEASE_MEM, the fence WRITE_DATAs) is now not recorded on the GPU at all.
A completion action of the open (or newest in-flight) batch stores it when
that batch is reaped (AfterCompletions with storedOnGpu false, reason 5).
Completions run in push order and batches finish front-first, so it lands
after every earlier write-back without a drain. The existing GPU store
plus completion re-store path would not keep this order: its GPU store is
visible to a polling title before the write-back runs, and its re-store
runs only over a write-back that overlapped the label itself.

Recorder::PendingCompletionStores counts the guest stores completions
still have to make (not end-of-pipe deliveries or write-backs). While it
is not zero, later small labels follow the same route even after every
writer was written back, so a later GPU label cannot become visible
before an earlier completion store or land under it at one address.
Stores over 8 bytes keep the GPU store and go behind the completions only
over a copied writer's range or a pending completion store of their own
range. Queue 0 reaps while it spins on REWIND, so a title polling such a
label there cannot wait forever. The debt entry lists what this still
leaves out of order (larger stores and GPU-made DMA_DATA copies away from
those ranges, and a nested sync from inside a write-back).

APS5_DRAIN_COMPLETION_LABELS=1 brings back the drain (reason 2); a second
ctest entry runs the test with it.

CopiedWriterLabelOrder now skips with a line naming
minStorageBufferOffsetAlignment when the device binds the record at
+0x1004 in place (alignment 4, AMD's driver and RADV) and nothing is
written back. Above 4 the write-back count still fails the test. A new
pass checks the order across batches: a later label to the address of a
pending completion store is not visible before it and is not overwritten
by it at the reap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 12:53:42 +02:00
..