fix(agc): preserve storage image dependencies during ahead dispatch capture #4724
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4724"
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 Scramblrrrr on 2026-10-12T19:48:20Z.
What
A compute shader can write indirect dispatch arguments through a storage image. Ahead capture currently records only guest-buffer write ranges, so it can resolve the later CPU/thread-dimension indirect dispatch before that image writer executes and reuse stale counts.
The synthetic regression starts with 1x2x2 arguments, writes X=3 through an R32 storage image, and counts the following dispatch's invocations. The pre-fix CPU path dispatched 4 instead of 12 groups. The GPU indirect path already passes.
Include written direct GuestImages/StorageImage surface ranges, including their DCC metadata, in the existing ahead dependency scan. Proven read-only image elements are excluded. The existing overlap check then leaves the dependent dispatch for normal ordered execution instead of parking stale arguments. This does not add runtime image-table store support.
Unbound storage slots are skipped before descriptor decoding, matching the storage binder. The fixture also stores to an unbound slot alongside the real surface; decoding that slot first would terminate the ahead queue with a null-base error.
The fixture is entirely synthetic; no title shader, capture or assets are included. Related #4586 tracks CP packet writes in the same ahead walk; this change covers shader storage-image writes through appendWrittenRanges and has no dependency on that PR. No 007 performance or title-stop claim is made.
Tested
Windows 11, GCC 15.2, NVIDIA RTX 5070 Ti, Release, SPIRV-Tools OFF; head
22b4d43f42on main88107b7de6.2f4cc8983restores that base's WrittenBuffers.cpp while leaving the fixture and registration unchanged: the CPU image case fails with 1x2x2/counter 4; the GPU image and buffer cases pass. Restore/rebuild passes all three.964bf62f; both image-indirect variants fail with guest texture descriptor has a null base address. Restore/rebuild passes all three controls.Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T21:57:20Z.
Acknowledged the #4662 overlap. The reported CMakeLists.txt hunk registers independent native fixtures: this PR's storage-image ahead-dependency check and #4662's GPU-mapping-on-fiber check. The production fixes are in different paths, and neither requires the other. When combining the test-registration hunks, both entries must be retained. Current GitHub mergeability is MERGEABLE. This comment is scope/registration analysis, not a claim of a combined game or native test. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T22:44:27Z.
Windows/RTX5070Ti/GCC15.2 runtime-port cross-test e5b9cd193 (https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-host-write-image-ahead), on our experimental007 runtime-table stack plus revised shared-host-write tracking. Fixture source matches this PR; production adapts surface-span lookup to that stack's existing API. No title data is part of the fixture.
Native image-indirect CPU/thread-dimensions, image-indirect GPU control and buffer-indirect control3/3 PASS1.82s. Production-only negative restores WrittenBuffers.cpp from preceding09f0f6394, fixtures/CMake unchanged: thread-dimensions FAIL, counter4 instead of12; GPU image and buffer controls PASS. Restored/touched/rebuilt positive3/3 PASS1.31s; no skips. Source clean. This is not a current-main-only/full-suite test.
Only patched graphics650B9EAD4A1AD5DE5A29323FA4430EABE20A82DBDD11CD0FAE6A47C582AD18FA now staged; revised libcA1AE7842 unchanged. Normal warm-cache/cache16 game run starting, no sampler/profile or concurrent builds/native tests. No007 rendering/crash/FPS claim yet. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T22:55:19Z.
Image-ordering runtime port e5b9cd193/graphics650B9EAD/libcA1AE7842/cache16 ended intentionally22:54:41.830UTC, ~3m03 after Resume22:51:38.445, not a crash. Final frame1982/~0.19FPS, bright shape over black; same incomplete scene. Last private22.817GB/free4.700GB. Four bounded working-set trims during the full run (including startup); FPS is not a clean benchmark. Runtime image-table deferred write-backs remain unsupported. No clear007 rendering/FPS improvement from #4724 in this single run; native ordering red/green proof remains separate.
Prepared existing #4535 652cb0b author-preserved port on this stack, codex/first-light-deferred-shared-tracking head4135e2871, preserving newer #4661 host-write correction, per4KiB settlement and local alias mappings. Details on #4535. Native build started only after game ended; nothing from that branch staged yet. Still leaving runtime-table stores/reference-texture work to SleglJan; branch heads unchanged at last check.
AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-13T05:54:46Z.
Rebased and pushed
964bf62f05on main88107b7de6. Preserved the new GPU-map-on-fiber library link alongside our thread-dimensions test registration. Windows Release / GCC15.2 / RTX5070Ti, Vulkan required: CPU image-indirect, GPU image-indirect, buffer-written indirect 3/3 PASS 2.76 s, no skips. Scoped conventions/diff checks pass; source clean. Only test-registration conflict resolved; production behavior unchanged. Earlier negative evidence remains labeled with its original base in the description. Nothing from this current-main build was staged into 007. AI-assisted (Codex).Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-13T14:52:37Z.
Review finding from a stack carrying this change (pre-rebase 6b6abed5e, same loop; Linux, GCC 16.2.1, RTX 3080, NVIDIA 615.71.09; 007 First Light), line numbers from head
964bf62f0.Mechanism: the loop this PR adds to
appendWrittenRanges(WrittenBuffers.cpp27-37) decodes every written storage element withDecodeTextureResource, whose null-base check throwsguest texture descriptor has a null base address(GuestTextureResource.cpp:58). The binder treats such an element as an unbound slot and binds no guest surface for it (ShaderResources.cpp:3343:words[0] == 0u && (words[1] & 0xffu) == 0u), so a dispatch with an unbound storage slot is valid on main; when the ahead resolver (queues other than 0) reaches it, this loop throws on its compiled result. Theresource.baseAddress != 0test on line 34 never sees a zero, since the decode throws first. The call atDispatchAhead.cpp:173sits after thetryaround the aheaddispatch(...)(155-158) and nothing on the way out catches it, so the queue worker'scatch (...)reports it (QueueWorker.cpp:218-221);ReportFailurehands it to the video output, and the presenter ends the process with[videoout] presentation failed: AGC graphics: guest texture descriptor has a null base address, without thecompute shader 0x...:prefix the dispatch catches add, which is how it was traced here. Two runs on our stack ended this way.Fix: apply the binder's rule before the decode, or
IsNullTextureResourcefrom #4779 if that lands first (it also treats TYPE=0 as null, on which this loop would otherwise throwunsupported image type 0). On our stack the same decode in #1201'sDrawWriteRangesis covered by a unit test (a two-elementStorageImagebinding, one zeroed and one real descriptor: throws before, one range after);appendWrittenRangesbeing a private static ofDriver, this PR's fixture could add an unbound slot to its dispatch instead.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-13T15:23:44Z.
Thanks for tracing this. I reproduced the mismatch in source: the storage binder checks the null base before decode, while appendWrittenRanges decodes first. I have prepared the matching pre-decode null-base guard and extended this PR's existing ahead image-indirect fixture to issue a store to an unbound slot alongside the real surface. I will validate the new fixture against the old production loop, then restore/rebuild positives before pushing. #4779 remains open; this correction follows the existing binder rule and does not assume its broader TYPE=0 handling. Nothing from this revision is staged into the running game yet.
AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-13T15:29:50Z.
Fixed and pushed
22b4d43f42. appendWrittenRanges now applies the binder's null-base rule before DecodeTextureResource. The synthetic shader stores to a null slot and the real argument image; both CPU/thread-dimension and GPU variants still finish with the expected 3x2x2 arguments /12 invocations.Windows Release /GCC15.2/RTX5070Ti, Vulkan required: restored final3/3 controls PASS1.22s, no skips. Production-only negative retains extended fixture and restores WrittenBuffers.cpp from964bf62f: both image-indirect variants FAIL with guest texture descriptor has a null base address. This reproduces the review finding independently of title data. Source/conventions/diff clean, description updated. #4779's broader TYPE=0 rule remains a separate open change. Not yet staged into007.
Thanks for the precise trace. AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:32:34Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed