fix(agc): keep buffer owners when a staged address space dissolves #10304
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10304"
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 Ondra97 on 2026-10-23T16:55:42Z.
What
A writable descriptor can create a staging candidate inside a cached address space, then a later writable descriptor crosses that space's registered edge and dissolves it.
resolveOverlaysinitialized the discard mask to true for every region when the address space was absent, so it erased the retained base and ordinary buffers along with the redundant overlay candidates. Looking up a descriptor then threwAGC graphics: guest buffer has no GPU owner.Initialize the mask to false and mark only overlay members for removal after dissolution. Extend the existing staging regression with an in-space write, a crossing write and a separate ordinary read. It asserts dissolution, executes GPU storage writes, reads back the ordinary buffer, and checks that only the two requested byte ranges changed.
The PR also includes
failedJoinDissolvedOverlayTests, contributed by Yunus Shaikh (EagleBearerYS) in f507598e81, cherry-picked with authorship preserved. It forces a joined host import to fail atvkAllocateMemory, restores the two separate imports, then creates a staged write followed by a write across their boundary. The mock-device test checks descriptor ownership and that the written word reaches guest memory; it runs without a physical Vulkan device.Tested
Latest local validation (October 29, 2026): main
3a2b91981651569163768854a1fcdc7193b6667b, candidate31f895cb59adf55532cd818ad491b7dcaef676f5. The baseline build used the same two regression sources as the candidate andGuestBufferMemory.cpptaken byte-for-byte from main (Git blob64de3d8c8d7566fa7e1faf3cf362d476106ee748). The candidate includes main through a merge, without rewriting the original PR history.Windows 11 Pro build 26300, Ryzen 9 7900X, 32 GiB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.01; WinLibs MinGW-w64 GCC 15.2.0 r7, Release. Both runs used the same machine, GPU and test configuration, disabled shader caching and required Vulkan. Loader logs identify the RTX 4070 Ti SUPER and show the Khronos validation layer (manifest API 1.4.335) inserted at instance and device creation in all five real-GPU tests. Neither log contains a missing-layer warning, a
VUID-diagnostic or a synchronization hazard.agc_driver_graphics(includes the failed-join mock regression)agc_bda_stagingOne run of the six-test selection per build. The four neighboring tests are
agc_read_written_staging,agc_driver_bda_reads_shadowed_results,agc_driver_bda_reads_shadowed_results_per_buildandagc_unit_shadow_completion_store. The mock log records the intendedvkAllocateMemory (-2)failure requested by a join. The candidate's real-GPU staging case also confirms dissolution, preserved owners and correct guest bytes.The full Windows Release build and
patched_librariespass on the candidate.python tools/check_conventions.py --base origin/mainand whitespace checks pass. The full CTest suite, current-head Linux build and title runs were not performed locally.tools/pr_overlap.pyinspected 1,380 other open PRs; 90 shared files or exports with this branch. I manually checked the relevant changes in the 37 PRs whose conflicts prevented an automatic comparison. None changesresolveOverlaysor duplicates the failed-join overlay regression. #6185 and #6186 edit earlier copy-back assertions inbdaStagingTests, outside this PR's added dissolution case; no dependency is required.Reproduction with the supported Windows toolchain and dependencies from BUILD.md:
For the baseline, use the candidate test sources with the main version of
GuestBufferMemory.cpp; restore the candidate version before rebuilding for the fixed run. The validation layer must be discoverable; my runs supplied its existing installation throughVK_LAYER_PATH. No title was rerun for this update.Earlier validation of the original patch (
e0d6e062a969d723a868d50741863a9aceadb6ae):Windows 11 Pro (build 26300), Ryzen 9 7900X, 32 GiB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, NVIDIA 617.42; Release, GCC 15.2.0.
4be3da2c6fb68f79953ff78978c83e06de6033b9plus the same regression:agc_bda_stagingfails with the missing-owner exception; four neighboring GPU tests pass.e0d6e062a969d723a868d50741863a9aceadb6ae: all five pass, zero skips. Cases:agc_bda_staging,agc_read_written_staging,agc_driver_bda_reads_shadowed_results,agc_driver_bda_reads_shadowed_results_per_build,agc_unit_shadow_completion_store.VK_LAYER_KHRONOS_validation. Loader logs confirm the validation layer at instance and device creation. Neither run reports a VUID.patched_librariespass.tools/check_conventions.py --base origin/mainand whitespace checks pass.0x211204d400, on an earlier local diagnostic integration (main2b3baacdplus #7446 and capture diagnostics). A fresh 20-minute game run of this isolated fix on4be3da2cpassed the intro into a black loading phase without the owner exception, then closed normally with exit code 0 after diagnostic collection. Bounded thread/lock profiling was used during that run. Progress beyond loading remains unconfirmed. That PRAGMATA run makes no gameplay or performance claim.Independent validation reported by contributors (their runs, with setup and limits in the linked comments):
JJenkx, Arch Linux/RADV RX 6650 XT: the identical agc_bda_staging regression failed on pinned main and passed with this PR. agc_read_written_staging passed on both. Three other named tests skipped on both because this device reports watched host memory written during import/read; those paths remain untested on that GPU. Khronos validation was loaded in all ten logs, with no reported VUIDs. This is focused test evidence, without #8091 or a title run.
zaidhawk, Persona 3 Reload PPSA10872: on Windows/RTX 5090, four main runs that reached the end of the opening animation stopped with the missing-owner error; two runs with this PR reached the title screen and attract scene. Other runs stopped earlier on a separate pending storage-image error.
Lindamea1, Monster Hunter Wilds PPSA24191: on Linux/RTX 5090, the owner error occurred in two main runs and was absent in eight runs including this PR. Only two of those eight progressed past the earlier main failure point; six included additional stencil replay changes. Three of five GPU tests skipped on both main and the candidate on this device.
johnmaia, Epic Mickey: Rebrushed PPSA15657: on Linux/RADV RX 7600, two main runs with #8091 stopped on the missing-owner error before gameplay; two runs with #8091 and this PR reached the level without that abort. The #8091 dependency and different workloads prevent attributing a speed change to this PR.
QRMOE, Resident Evil Requiem PPSA31246 01.200.000: on Windows 11 Home 26200/Radeon RX 9070 XT, main
29ce6d87ebwith #10935 stopped on the missing-owner error during first-boot loading. Seven later boots with this PR had no owner error and reached the intro, then stopped on other issues. First-boot and saved-settings paths differ, so this is not a same-path A/B; no validation layer was used. One run hit the native multisample-depth publication refusal; with #9950 too, runs stopped onVK_ERROR_DEVICE_LOST, whose cause remains unverified. Gameplay was not reached.EagleBearerYS, Linux and Windows hosted runners: the contributed mock regression fails with the main implementation in both baseline repetitions on each runner and passes with the fix in five repetitions. The CI run uses main
319621ba2e578bd053b0baba2877fe70520e0737plus the PR and test. Linux: 104 pass, 7 skip; Windows: 40 pass, 86 skip (no Vulkan device). These are contributor results. Resident Evil Village PPSA01556 encountered the same failure sequence in their modified-main runs, but they have not tested that title with this PR.The full CTest suite was not run.
Checklist
main; no other open PR implements the same functionsNotImplemented_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 MarcZX10 on 2026-10-24T21:17:05Z.
Review: CHANGES_REQUESTED
The production fix is narrowly scoped: when the cached address space has already dissolved, only overlay members are now dropped; retained base regions remain available. The added regression checks the in-space write, the crossing write, a separate ordinary read, and untouched bytes. The reported Windows and RADV validation runs, with their skip limits stated, are useful evidence.
The integration runs are based on
4be3da2, 7,557 commits behind currentmain. Since then, bothGuestBufferMemory.cppand the AGC recorder tests have changed on main (including host-import settling/joining and staging-test updates). The hosted product tests are skipped, so please refresh onto currentmainand rerunagc_bda_stagingplus the neighboring staging/readback cases on the Windows/NVIDIA setup where the original failure reproduced. Require Vulkan and validation, and report any skips explicitly. A local rerun is not available here because this environment has no Vulkan device.