fix(agc): retain import settle resources per device #7269

Merged
JJenkx merged 1 commit from upstream-pr/7269 into main 2026-10-17 23:18:06 +00:00
JJenkx commented 2026-10-17 20:47:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-17T20:47:45Z.


What

Switching between two live Vulkan devices overwrites the global import-settle buffer, memory and fence handles. Clearing imports can then release only the last device's resources. Keep settle resources per device and destroy only the cleared device's entry. The regression imports through A -> B -> A and checks both cleanup orders, plus repeated cleanup.

Overlap review: #6678 changes the same settle state for deferred Windows imports; its captured adoptSettleDevice still resets the original handles when switching devices. This fix does not require its deferred scheduling. #6457, #6479 and #6730 touch the adjacent state declaration; #6913 adds a separate test at the same insertion point. Additive/context conflicts need reconciliation if those land first; none is a dependency. The overlap tool also reports older branches that cannot be compared against current main, so this is not a claim that every stale proposal merges together.

Tested

Linux, Ryzen 9 7950X, Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1. New regression failed without the fix (10 failed assertions) and passed with it. Nine focused checks passed in 4.40 seconds with core validation enabled on the integration build: host-import unmap, parked-import unmap, retirement, sampled-storage views, CMASK, retire, sparse dma-buf, driver graphics and address-space teardown.

Native Infliction PPSA02688 on integration commit bfdd817a11abe21583643a695dc9093f72ffef02 reached the gameplay objective at 239.97 s, exited normally after 324.55 s, left no process and restored the kernel limit. Core validation reported zero VUIDs, including no previously observed leaked buffer/memory/fence teardown errors. This was the existing integration stack plus this fix; the main-based branch was not separately built or run. No performance gain or lighting improvement is claimed; the scene remains dark. The full Recorder suite retains a previously recorded pending-write assertion failure, so these are focused passes, not a full-suite pass.

Rebased onto 084bd39a085cf5a85a1dea19163184ba74ac1905; neither changed file changed upstream since the tested base. Conventions and diff checks pass. Game evidence: https://github.com/boykopovar/AnyPS5/discussions/6996#discussioncomment-19004057

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA02688 #6996 teardown validation; remaining lighting unresolved
  • GPUs tested: AMD RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4903797865 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7269). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-17T20:47:45Z. --- ### What Switching between two live Vulkan devices overwrites the global import-settle buffer, memory and fence handles. Clearing imports can then release only the last device's resources. Keep settle resources per device and destroy only the cleared device's entry. The regression imports through A -> B -> A and checks both cleanup orders, plus repeated cleanup. Overlap review: #6678 changes the same settle state for deferred Windows imports; its captured `adoptSettleDevice` still resets the original handles when switching devices. This fix does not require its deferred scheduling. #6457, #6479 and #6730 touch the adjacent state declaration; #6913 adds a separate test at the same insertion point. Additive/context conflicts need reconciliation if those land first; none is a dependency. The overlap tool also reports older branches that cannot be compared against current main, so this is not a claim that every stale proposal merges together. ### Tested Linux, Ryzen 9 7950X, Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1. New regression failed without the fix (10 failed assertions) and passed with it. Nine focused checks passed in 4.40 seconds with core validation enabled on the integration build: host-import unmap, parked-import unmap, retirement, sampled-storage views, CMASK, retire, sparse dma-buf, driver graphics and address-space teardown. Native Infliction PPSA02688 on integration commit `bfdd817a11abe21583643a695dc9093f72ffef02` reached the gameplay objective at 239.97 s, exited normally after 324.55 s, left no process and restored the kernel limit. Core validation reported zero VUIDs, including no previously observed leaked buffer/memory/fence teardown errors. This was the existing integration stack plus this fix; the main-based branch was not separately built or run. No performance gain or lighting improvement is claimed; the scene remains dark. The full Recorder suite retains a previously recorded pending-write assertion failure, so these are focused passes, not a full-suite pass. Rebased onto `084bd39a085cf5a85a1dea19163184ba74ac1905`; neither changed file changed upstream since the tested base. Conventions and diff checks pass. Game evidence: https://github.com/boykopovar/AnyPS5/discussions/6996#discussioncomment-19004057 <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: PPSA02688 #6996 teardown validation; remaining lighting unresolved <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: AMD RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Linux <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
github-actions[bot] commented 2026-10-17 21:04:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T21:04:45Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6457 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L162
PR 6479 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L162
PR 6678 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L162, L187-194, L681-691, L751-753, L2340-2348
PR 6730 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp L162

Some 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.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 1324 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 2434 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 4449 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 5372 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6177 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6222 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/HostImportSparseDmaBuf.cpp
PR 6292 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6320 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6447 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6548 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6786 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7154 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
PR 7201 core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
core/libs/prx/libSceAgcDriver/tests/HostImportSparseDmaBuf.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241037859 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7269#issuecomment-6241037859). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-17T21:04:45Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6457](https://www.github.com/boykopovar/AnyPS5/pull/6457) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L162](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L162) | | | | [PR 6479](https://www.github.com/boykopovar/AnyPS5/pull/6479) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L162](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L162) | | | | [PR 6678](https://www.github.com/boykopovar/AnyPS5/pull/6678) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L162](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L162), [L187-194](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L187-L194), [L681-691](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L681-L691), [L751-753](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L751-L753), [L2340-2348](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L2340-L2348) | | | | [PR 6730](https://www.github.com/boykopovar/AnyPS5/pull/6730) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` [L162](https://github.com/boykopovar/AnyPS5/blob/3cc1fc8f11b6514900db9c20477fca0041114ab2/core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp#L162) | | | Some 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. | Pull request | Shared files not compared | |---|---| | [PR 1191](https://www.github.com/boykopovar/AnyPS5/pull/1191) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 1324](https://www.github.com/boykopovar/AnyPS5/pull/1324) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 2434](https://www.github.com/boykopovar/AnyPS5/pull/2434) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 4449](https://www.github.com/boykopovar/AnyPS5/pull/4449) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 5372](https://www.github.com/boykopovar/AnyPS5/pull/5372) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6177](https://www.github.com/boykopovar/AnyPS5/pull/6177) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6197](https://www.github.com/boykopovar/AnyPS5/pull/6197) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/HostImportSparseDmaBuf.cpp` | | [PR 6292](https://www.github.com/boykopovar/AnyPS5/pull/6292) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6320](https://www.github.com/boykopovar/AnyPS5/pull/6320) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6615](https://www.github.com/boykopovar/AnyPS5/pull/6615) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6636](https://www.github.com/boykopovar/AnyPS5/pull/6636) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6786](https://www.github.com/boykopovar/AnyPS5/pull/6786) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 7154](https://www.github.com/boykopovar/AnyPS5/pull/7154) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/HostImportSparseDmaBuf.cpp` |
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7269
No description provided.