AGC: a storage image the CPU polls is never stored back, so a title that waits for it deadlocks (Ratchet & Clank: Rift Apart, frame 456) #3272
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-11T04:49:07Z.
Ratchet & Clank: Rift Apart freezes on a black screen around frame 455 on every run, right after the intro logos. GPU usage is 0%. AnyPS5's queue threads are all idle, and the game's own watchdog prints
ProcessReprojection timed out after 100ms on RenderFrameIndex 456.The cause is that a compute shader writes its result into a linear storage image, and the game's main thread then polls that memory with plain CPU reads until the last float stops being
-1.0. AnyPS5 keeps storage-image results on the GPU until guest memory is read through the driver. The game reads it directly, and the flip-time store is opt-in (APS5_STORE_AT_FLIP), so the result never reaches guest memory. The main thread waits forever, and the rest of the frame waits on the main thread.APS5_EAGER_WRITEBACK=1changes the outcome: the game takes a path it never took before (a new compute shader appears) and then stops earlier, on an unrelated shader-recompiler gap. So I could not confirm frame 456 passes with it. The mechanism below is from a core dump and the code.A possible direction: store pending storage results that overlap a range when a label or end-of-pipe write that follows them completes. That is the point where the console guarantees the GPU's earlier writes are visible to the CPU. Or read-protect pages with pending results, the way the write watch does for stores. I have not implemented either.
Details and logs
Title: Ratchet & Clank: Rift Apart (PPSA01474, content 01.005.003)
Where it stops: ~2.5 min in, frame 455/456, 3 of 3 runs (441 once with
APS5_TRACE_GPU, which slows it).AnyPS5
f1ae427b(upstreammain961b25festill has the same flush logic). CachyOS (Linux 7.2), RTX 4090, driver 615.78, i9-14900K, relinked with--to-intel.Local patches needed to get this far (not pushed): guest thread stacks in the guest arena (ChakraCore OOM),
sceKernelMunmapreturning 0 for unmapped ranges, PR #3158 plus fixed 8 MiB host-import windows,APS5_AMM_BASE_HINTfor #3146, and a size cap on per-draw input snapshots (one draw input here is 3 GB).What the core shows
Driver::runqueue threads are incondition_variable::waitwith nothing pending. There are noWAIT_REG_MEM … timed outor dropped-label lines.game+0xde1890: it calls its watchdog (labelProcessReprojection) untilfloat[r15 + r12*4 - 4] != -1.0f.r15 = 0x114d640000,r12 = 0x14400. The awaited float at0x114d690ffcis0xbf800000, and the floats before it are 0.StorageTexture address=0x114d640000 384x216 mips=1 … tile=0 format=22 vk=100, i.e. linear R32F, and 384×216 = 0x14400 floats.perf record -e mem:<addr>/4:w) shows the cycle 1→3→4→5→1 once per frame. At the freeze the worker sets 1 and the main thread never releases it.Code path (main
961b25fe)GuestMemory.hpp: "The graphics layer keeps the results of storage images on the GPU until guest memory is read; it registers a hook that stores every pending result overlapping a range, which every read and store through this interface calls first."FlushGpuWritescallers are all driver-side reads (copies, display buffers, shader fetches, buffer views). Nothing covers a guest CPU load.VulkanDevice.cpp:2219:FlushAllPending("flip")only runs withAPS5_STORE_AT_FLIP=1. Even with it, this title polls before the flip, so it would still wait.Local experiment
With
APS5_EAGER_WRITEBACK=1the run is faster overall, but at frame 437 it aborts in a compute shader the earlier runs never dispatched:That is a separate gap (same class as #2062 / #1817).
What I don't know: which label the console uses to order this result before the CPU read. I did not trace the dispatch's own release packet.
Related: #3146, #3158.
Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T08:07:11Z.
A fix with a test is in #3334 (closed by the intake bot, so it can be reopened or carried). When a queue worker runs out of work, it stores the pending storage-image results and submits the stores. With it, Ratchet gets past this wait without
APS5_EAGER_WRITEBACKin 3 of 3 runs and stops later at #3274. The intro logos also run faster than with eager write-back.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T16:40:21Z.
I opened Marc PR #3777 with an independently authored queue-idle write-back path and a focused execution regression. The test builds and passes locally on Linux (GCC 12.2, Release); the PR body records the title run report from the earlier issue work separately, since I did not run the game.