fix(agc): keep a settled import compared while a storage image overlaps it #7476
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7476"
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 EagleBearerYS on 2026-10-18T08:52:50Z.
What
A regression from our #6678. On Windows, a storage image can lose its GPU results when the 64 KiB block under it returns to the write watch, not only split a render pass.
How it happens (
main3de84fa106):GuestMemory::Rewatchstamps every block as a CPU store (GuestMemory.cpp:1325-1340).StorageTexture::AnyPendingOverlaps,GuestBufferMemory.cpp:1064).Texture.cpp:2176) and then imports its block (Texture.cpp:2253). A recorded draw marks its targets pending only once it is recorded (Draw.cpp:1574), and the settle is polled at the import lookups in between (GuestBufferMemory.cpp:1396,3004). So the stamp can land after the image's generation and before its results are pending.Texture.cpp:1927-1934), drops them (1963-1965) and uploads the guest bytes again (1997). It prints:Where it showed: thuanquang bisected
agc_driver_address_passesfailing on an RX 6700 XT to #6678 (#7414). On an RTX 3070,main3de84fa106fails it 3 of 3 runs, "2 address-based draws, 2 began a pass, 0 continued one", with the line above, and passes 3 of 3 withAPS5_NO_DEFERRED_SETTLES=1. In that test both draws render the same pixels, so only the pass count shows the loss.The change:
StorageTexture::AnyLiveOverlaps). Imports with no image over them still return to the write watch.[buffers]profile line counts the imports kept compared.ARCHITECTURE.mdand thelibSceAgcDriverdebt entry say so.What it leaves as it is:
CollectWritesreturns 0 outside the watch, so the drop rule never applied to them.Rewatchdoes nothing.Related: #7414
Tested
An RTX 3070 Laptop GPU, Windows 11, NVIDIA 617.42 (
VK_LOADER_DRIVERS_SELECT='*nv*', one device):rewatchSettledImportsback as onmain(the test,AnyLiveOverlapsand the counter kept),agc_import_settle_storage_imagefails 3 of 3 runs: "(i) the refresh after the image's GPU results dropped 16384 of 16384 texels: the import's return to the write watch stamped its block as a CPU store after the image took its generation".agc_driver_address_passesandagc_driver_address_passes_targets_split, #6678'sagc_import_settle_deferred,agc_import_settle_deferred_other_family,agc_import_settle_first_useandagc_import_settle_retire,agc_import_watch,agc_import_watch_other_family,agc_write_tracking,agc_storage_cpu_snapshot,agc_host_import_retireandagc_driver_host_import_windows.agc_driver_address_passespasses with deferred settles on.An RTX 5070 Ti, Windows 11 Pro 26200, NVIDIA 617.42, run by Scramblrrrr on their integration tree 8e0bd2cc64 with this PR's
3ea0be6488merged in,ANYPS5_REQUIRE_VULKAN=1(comment):rewatchSettledImportsback as on their tree,agc_import_settle_storage_imagefails: 1 import back in the watch, 0 kept compared, 16384 of 16384 texels lost;NVIDIA GeForce RTX 2060 and GTX 1650 (driver 32.0.16.1088) and Intel UHD Graphics 770 (32.0.101.6129), Windows 11, run by jacob6769 with this PR's code changes on
main9caecfd2d5(its docs left out), WinLibs GCC 15.2.0, Release,ANYPS5_REQUIRE_VULKAN=1(comment).agc_driver_address_passes, 40 runs per cell:mainmain+ #7414main+ this PRagc_import_settle_storage_imagepasses 10 of 10 on both, and the tenagc_import_*and address-pass tests pass on each.agc_import_settle_*test skips, the new one included.GitHub's Linux (lavapipe, Mesa 25.2.8) and Windows runners (verify run): both build, and libc and libkernel pass on both. The new test is registered only on Windows, where GitHub's runner has no Vulkan device, so it skips there.
Windows, the full CI build (fork Build): 1469 of 1469 tests pass, the new one skipping, and
check_skipspasses.Linux, a run that mirrors CI's Linux job (a cloud machine, Ubuntu 24.04, GCC 13.3, Mesa lavapipe 25.2.8 with LLVM 20.1.2):
main3de84fa106and this branch have the same 1,437 tests, with no status changes. The 5 failures on both are that machine's IPv6 tests. One of the branch's two full runs also failedguest_avplayer, which doesn't link the AGC driver; it passed in the other run and in 20 of 20 reruns.agc_import_watch,agc_driver_address_passesandagc_driver_address_passes_targets_splitpass 20 of 20 runs each.New test,
agc_import_settle_storage_image(Windows with a GPU): an image whose first upload imports its 64 KiB block waits for the import's settle read, is cleared to red on the GPU, then refreshed and stored. Every texel must be red, and the import must have stayed compared. On the old code the refresh drops the clear.Not tested: a title; AMD hardware; the settle path on Intel, where its tests skip.
Checklist
main3de84fa106; no other open PR implements the same functions. Overlaps (git merge-treewith each PR merged intomaincb1d6e5bd6), both in docs, in adjacent lines where both sides stay:docs/dev/ARCHITECTURE.md: #6763 (draw inputs copied on NVIDIA's Windows driver instead of bound in place from a host import) adds a bullet just before the write-watch bullet this PR extends.docs/dev/debt/libSceAgcDriver.md: #7432 (pending results saved when a fresh write collect fails) edits the "Pending storage-image results over memory outside the write watch" entry, the line before the host-pointer imports entry this PR edits.NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T09:11:55Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/ARCHITECTURE.mdL113-114docs/dev/debt/libSceAgcDriver.mdL84-85docs/dev/debt/libSceAgcDriver.mdL84-86Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/ARCHITECTURE.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ARCHITECTURE.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ARCHITECTURE.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/ARCHITECTURE.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/ARCHITECTURE.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/GuestBufferMemory.hppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-18T10:20:17Z.
I am preparing a Windows/RTX 5070 Ti (617.42) cross-test of
3ea0be648on our pinned 007 integration c872fab89 (base maine5c2b3c32plus the public shared-table/resource stack). Current title logs contain the pending-GPU-results/CPU-blocks diagnostic, but I am not attributing each occurrence to this race without the synthetic check. I will first run the new regression and the import/watch/address-pass controls, then report title rendering and counters separately. No duplicate fix from me. A separate opt-in wave64 trial is active now, so no builds or GPU tests will overlap it. AI-assisted: Codex.Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-18T10:38:34Z.
Windows cross-test of #7476 head
3ea0be648on integration 8e0bd2cc640e8cbc9efb2f92d73ccaa7f589abac (pushed codex/first-light-oct18-current), RTX 5070 Ti / NVIDIA 617.42, Windows 11 Pro 26200: all 14 targeted import/watch/address-pass controls passed, 7.51 s, zero skips, ANYPS5_REQUIRE_VULKAN=1. With only rewatchSettledImports restored to the integration parent, the unchanged new agc_import_settle_storage_image fails in 0.42 s: 1 back in the watch / 0 kept compared, 16384 of 16384 texels lost. The restored fix then passes the broader 65-control set in 28.84 s, zero skips, including the new regression, shader memory, image tables, relocation, storage ordering, depth dispatch and HDR.Qualification: my first post-negative restore preserved an older file timestamp, so Ninja reused the negative object and that intermediate run still failed. I corrected the timestamp, verified GuestBufferMemory.cpp was compiled again, and obtained the final 65/65 result above. This was a local build-state error, not a claimed source regression. No game was running during builds/native checks.
Source merged cleanly; two documentation conflicts were resolved preserving our existing draw-input/store-range notes and this PR's live-image-overlap wording. Matched patched modules are now staged for the title cross-test; no title rendering/FPS result yet. Prior baseline and wave trial each contain eight pending-results/CPU-blocks diagnostics, but I have not attributed those occurrences to this race. Raw title data stays local. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by jacob6769 on 2026-10-18T10:58:03Z.
Cross-test of 3ea0be648's code changes (docs left out, they conflict on main
9caecfd2d) on older NVIDIA GPUs and on Intel. Windows 11, WinLibs GCC 15.2.0 Release,ANYPS5_GPUselects the device,ANYPS5_REQUIRE_VULKAN=1.agc_driver_address_passes, 40 runs per cell:On these Turing GPUs the failure is intermittent, with the same two lines and the pending-results/CPU-blocks line before them, so a 3-run check can pass by chance; with this PR it passed every run.
agc_import_settle_storage_imagepassed 10 of 10 on both NVIDIA GPUs, and the tenagc_import_*and address-pass controls passed on each. On the Intel GPU everyagc_import_settle_*test, the new one included, reports a skip, which fits main never failing there.AI-assisted: Claude.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T11:04:57Z.
@jacob6769 thank you for 40 runs per cell on three GPUs: that's what shows an intermittent failure a 3-run check can miss, and it's now in the description. One note for anyone applying it the same way: the PR merges cleanly as a branch, and only its debt-file hunk fails as a patch on
main9caecfd2d5, because #7271 and #5390 changed the lines around it indocs/dev/debt/libSceAgcDriver.mdafter this branch's base.