AGC: per-draw input snapshots copy multi-GB buffers on the CPU for every draw (Ratchet & Clank: Rift Apart stalls at frame ~380) #3338
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T08:06:32Z.
Ratchet & Clank: Rift Apart stalls on a black screen around frame 380, right after its intro logos. The GPU is idle, and AnyPS5's GPU thread is busy the whole time inside one
memcpy.The copy is the per-draw input snapshot from
9f1c680b("preserve per-draw input buffer contents until gpu completion"). At this point the title binds storage buffers that are gigabytes long, the largest a 3 GB range. Whenever a snapshot can't be reused,PrepareDrawBindingscopies the whole range into a new buffer before the draw, about 36 GB of copying every 5 seconds here. The draws never reach the GPU, the game's frame fences never signal, and it waits forever.Capping the snapshot size fixes it locally. Inputs above 64 MiB skip the snapshot and are bound in place, as they were before that commit, and the title then gets past this point. That brings back the risk the snapshot exists for (the CPU rewriting the buffer before the GPU reads it), but only for very large inputs, which in practice are streaming heaps or bindless pools, not per-draw constants. A better fix might snapshot only the bytes the draw can read, or rely on the write watch for large ranges. I haven't tried either.
Details
Title: Ratchet & Clank: Rift Apart (PPSA01474, content 01.005.003)
Where it stops: ~2 min in, frame ~380, 2 of 2 runs measured before the cap. CachyOS (Linux 7.2), RTX 4090, driver 615.78, GCC Release. AnyPS5
f1ae427bplus local fixes (see #3272), with the code path unchanged onmain1be0a7ce.What the stall shows
D3D11ResourceT::WaitForResource,SkinningBuffer::CycleFrame); GPU utilisation is 0%.perfon the AnyPS5 GPU thread: 100% in libcmemcpy, called fromShaderResources::PrepareDrawBindings. The call site is thestd::memcpy(buffer->Bytes().data(), reinterpret_cast<const void*>(begin), bytes)afterReusableDrawSnapshotreturns null.0x118f800000+0xbc200000(3 GB) and0x1171258040+0xe7fffc0(232 MiB), bound by over 130,000 draws in the following minute.Local workaround
placed before the snapshot lookup in
PrepareDrawBindings, so the item keeps its in-place descriptor. With it the title passes frame 380, and the remaining copies are under 1 GB per 5 s.input_preservationandagc_recorder_kept_bytesstill pass. I can open it as a PR if a size threshold is acceptable.Related: #3272 (the next stop, a few frames later; fix in #3334).
Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T09:51:21Z.
Fixed in #3412 (branch pushkarreddyy:feat/agc-draw-snapshot-cap).
3c3992c5c) with zero convention errors.Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T09:57:21Z.
Thank you @Tamalero for the precise diagnosis and profiling analysis! PR #3412 (
pushkarreddyy:feat/agc-draw-snapshot-cap) is open on latestmain(3c3992c5c) implementing the 64 MiB snapshot threshold withAPS5_DRAW_SNAPSHOT_MAX_MIBoverride. Calling on @adriadam10 and @oneandonlydean for review.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:27:08Z.
Closing: #3412 caps draw-input snapshots at 64 MiB (
APS5_DRAW_SNAPSHOT_MAX_MIB). Reopen if PPSA01474 still stalls there on current main.