fix(agc): release the texture caches when a device allocation runs out of memory #6174

Merged
ee6aba54 merged 6 commits from upstream-pr/6174 into main 2026-10-17 21:24:07 +00:00
ee6aba54 commented 2026-10-15 00:29:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-15T00:29:27Z.


What

A device allocation that fails with VK_ERROR_OUT_OF_DEVICE_MEMORY (or OUT_OF_HOST_MEMORY) now releases the texture caches before it is retried: BufferPool::AllocateMemory trims its own idle tiers first, then calls a reclaim hook that Graphics::ReleaseTextureCaches serves, and retries. The hook evicts sampled textures oldest first and storage images without pending results oldest first. Storage images with pending results stay cached, because storing their results needs a staging buffer from the heap that just ran out. A failure inside the release stops it and is reported; the outer allocation reports the recovery ([bufferpool] ... recovered: allocation= reclaimed= released= ...).

Texture and storage image memory is allocated through the pool's recovery path as well, so an image allocation that runs out of memory gets the same trim, release and retry.

The staging pool's device tier is sized from the device's reported memory budget (VK_EXT_memory_budget) when the extension is present: the largest device-local heap counts with at most its reported budget, then #5893's rule applies (a sixty-fourth on system memory with a 128 MiB floor, an eighth otherwise with a 512 MiB floor). APS5_STAGING_POOL_MIB still overrides it.

Tested

Linux, Ubuntu 24.04, NVIDIA GeForce RTX 5080 (driver 595.99.02). PPSA15304 ran out of device memory after 460 s in the section after the first drop with the storage cache budget alone (#5483); with this change five runs of 900 to 1000 s without budget variables showed no OUT_OF_DEVICE_MEMORY, the recovery line fired 45 to 49 times per 900 s with sampled and storage images released, and a 25 min run of the merged working branch (current main with these and its other commits) showed no allocation failure either. ctest -R agc_ passes (565 tests) including the new CacheReclaimRecovery pool test with a mock hook and the extended StorageCacheBudget execution test (the release takes clean storage images and keeps the ones with pending results).

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none (#5987 changes the same allocation lines in Texture.cpp; its host placement can follow this PR as the step after the pool's reclaim and retry)
  • Unblocks: PPSA15304 (no Game bring-up discussion yet)
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 595.99.02, Ubuntu 24.04 (Linux)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4866397274 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174). Originally posted by [ee6aba54](https://github.com/ee6aba54) on 2026-10-15T00:29:27Z. --- ### What A device allocation that fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY` (or `OUT_OF_HOST_MEMORY`) now releases the texture caches before it is retried: `BufferPool::AllocateMemory` trims its own idle tiers first, then calls a reclaim hook that `Graphics::ReleaseTextureCaches` serves, and retries. The hook evicts sampled textures oldest first and storage images without pending results oldest first. Storage images with pending results stay cached, because storing their results needs a staging buffer from the heap that just ran out. A failure inside the release stops it and is reported; the outer allocation reports the recovery (`[bufferpool] ... recovered: allocation= reclaimed= released= ...`). Texture and storage image memory is allocated through the pool's recovery path as well, so an image allocation that runs out of memory gets the same trim, release and retry. The staging pool's device tier is sized from the device's reported memory budget (`VK_EXT_memory_budget`) when the extension is present: the largest device-local heap counts with at most its reported budget, then #5893's rule applies (a sixty-fourth on system memory with a 128 MiB floor, an eighth otherwise with a 512 MiB floor). `APS5_STAGING_POOL_MIB` still overrides it. ### Tested Linux, Ubuntu 24.04, NVIDIA GeForce RTX 5080 (driver 595.99.02). PPSA15304 ran out of device memory after 460 s in the section after the first drop with the storage cache budget alone (#5483); with this change five runs of 900 to 1000 s without budget variables showed no `OUT_OF_DEVICE_MEMORY`, the recovery line fired 45 to 49 times per 900 s with sampled and storage images released, and a 25 min run of the merged working branch (current `main` with these and its other commits) showed no allocation failure either. `ctest -R agc_` passes (565 tests) including the new `CacheReclaimRecovery` pool test with a mock hook and the extended `StorageCacheBudget` execution test (the release takes clean storage images and keeps the ones with pending results). ### Checklist - [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 - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#5987 changes the same allocation lines in `Texture.cpp`; its host placement can follow this PR as the step after the pool's reclaim and retry) - [x] Unblocks: PPSA15304 (no Game bring-up discussion yet) - [x] GPUs tested: NVIDIA GeForce RTX 5080, driver 595.99.02, Ubuntu 24.04 (Linux) - [x] AI-assisted: yes
ee6aba54 commented 2026-10-15 01:00:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-15T01:00:58Z.


Overlaps noted. #5987 goes first: it falls back to a host memory type once the pool's retry failed, while this PR adds the texture cache release before that retry, so after #5987 the texture and storage image allocations here will go through Context::AllocateDeviceMemory. #5893 changes DeviceBudget as well. I will rebase onto both once they are in; Depends on is updated.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6181938463 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6181938463). Originally posted by [ee6aba54](https://github.com/ee6aba54) on 2026-10-15T01:00:58Z. --- Overlaps noted. #5987 goes first: it falls back to a host memory type once the pool's retry failed, while this PR adds the texture cache release before that retry, so after #5987 the texture and storage image allocations here will go through `Context::AllocateDeviceMemory`. #5893 changes `DeviceBudget` as well. I will rebase onto both once they are in; `Depends on` is updated.
ee6aba54 commented 2026-10-15 09:51:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-15T09:51:55Z.


Rebased onto main now that #5893 is in. The only conflict was BufferPool::DeviceBudget: the largest device-local heap now counts with at most its reported budget, and #5893's rule is applied to that (a sixty-fourth on system memory with a 128 MiB floor, an eighth otherwise with a 512 MiB floor). stagingPoolBudgetTests keeps #5893's cases and the reported-budget cases. ctest -R agc_ passes on Linux with an RTX 5080 (576 tests, 4 skipped), and check_conventions passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6189314239 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6189314239). Originally posted by [ee6aba54](https://github.com/ee6aba54) on 2026-10-15T09:51:55Z. --- Rebased onto main now that #5893 is in. The only conflict was `BufferPool::DeviceBudget`: the largest device-local heap now counts with at most its reported budget, and #5893's rule is applied to that (a sixty-fourth on system memory with a 128 MiB floor, an eighth otherwise with a 512 MiB floor). `stagingPoolBudgetTests` keeps #5893's cases and the reported-budget cases. `ctest -R agc_` passes on Linux with an RTX 5080 (576 tests, 4 skipped), and check_conventions passes.
github-actions[bot] commented 2026-10-15 10:12:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T10:12:56Z.


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 5987 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp L67
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L6, L295, L586, L1150
PR 5998 core/libs/prx/libSceAgcDriver/tests/execution/StorageCacheBudget.cpp L54-55, L70-71
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L295-296
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L5-6
PR 7119 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp L39, L72-73
core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp L596

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 1368 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 2434 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp
PR 4650 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4891 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5431 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5441 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5500 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6146 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6177 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6194 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6222 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6259 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6297 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6320 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6373 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6414 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6492 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6535 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6553 core/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp
PR 6563 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6647 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6718 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6783 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6887 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 6946 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6965 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 6973 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6987 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6989 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6995 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7154 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7201 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7258 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6189683013 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6189683013). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T10:12:56Z. --- <!-- 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 5987](https://www.github.com/boykopovar/AnyPS5/pull/5987) | `core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp` [L67](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp#L67)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` [L6](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L6), [L295](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L295), [L586](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L586), [L1150](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L1150) | | | | [PR 5998](https://www.github.com/boykopovar/AnyPS5/pull/5998) | `core/libs/prx/libSceAgcDriver/tests/execution/StorageCacheBudget.cpp` [L54-55](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/tests/execution/StorageCacheBudget.cpp#L54-L55), [L70-71](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/tests/execution/StorageCacheBudget.cpp#L70-L71) | | | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` [L295-296](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L295-L296) | | | | [PR 6615](https://www.github.com/boykopovar/AnyPS5/pull/6615) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` [L5-6](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L5-L6) | | | | [PR 7119](https://www.github.com/boykopovar/AnyPS5/pull/7119) | `core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp` [L39](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp#L39), [L72-73](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp#L72-L73)<br>`core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp` [L596](https://github.com/boykopovar/AnyPS5/blob/6447ed1ed7fd11c7eef60df336e8d66fac271188/core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp#L596) | | | 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 1368](https://www.github.com/boykopovar/AnyPS5/pull/1368) | `core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 2434](https://www.github.com/boykopovar/AnyPS5/pull/2434) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 4072](https://www.github.com/boykopovar/AnyPS5/pull/4072) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 4472](https://www.github.com/boykopovar/AnyPS5/pull/4472) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4891](https://www.github.com/boykopovar/AnyPS5/pull/4891) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 5431](https://www.github.com/boykopovar/AnyPS5/pull/5431) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5609](https://www.github.com/boykopovar/AnyPS5/pull/5609) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6146](https://www.github.com/boykopovar/AnyPS5/pull/6146) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6177](https://www.github.com/boykopovar/AnyPS5/pull/6177) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6194](https://www.github.com/boykopovar/AnyPS5/pull/6194) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6197](https://www.github.com/boykopovar/AnyPS5/pull/6197) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6259](https://www.github.com/boykopovar/AnyPS5/pull/6259) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 6297](https://www.github.com/boykopovar/AnyPS5/pull/6297) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6320](https://www.github.com/boykopovar/AnyPS5/pull/6320) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6373](https://www.github.com/boykopovar/AnyPS5/pull/6373) | `core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6414](https://www.github.com/boykopovar/AnyPS5/pull/6414) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6492](https://www.github.com/boykopovar/AnyPS5/pull/6492) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6535](https://www.github.com/boykopovar/AnyPS5/pull/6535) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6539](https://www.github.com/boykopovar/AnyPS5/pull/6539) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6553](https://www.github.com/boykopovar/AnyPS5/pull/6553) | `core/libs/prx/libSceAgcDriver/Graphics/include/BufferPool.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp` | | [PR 6563](https://www.github.com/boykopovar/AnyPS5/pull/6563) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6636](https://www.github.com/boykopovar/AnyPS5/pull/6636) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6647](https://www.github.com/boykopovar/AnyPS5/pull/6647) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6718](https://www.github.com/boykopovar/AnyPS5/pull/6718) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6783](https://www.github.com/boykopovar/AnyPS5/pull/6783) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6887](https://www.github.com/boykopovar/AnyPS5/pull/6887) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6965](https://www.github.com/boykopovar/AnyPS5/pull/6965) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` | | [PR 6973](https://www.github.com/boykopovar/AnyPS5/pull/6973) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6987](https://www.github.com/boykopovar/AnyPS5/pull/6987) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6989](https://www.github.com/boykopovar/AnyPS5/pull/6989) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6995](https://www.github.com/boykopovar/AnyPS5/pull/6995) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7002](https://www.github.com/boykopovar/AnyPS5/pull/7002) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7154](https://www.github.com/boykopovar/AnyPS5/pull/7154) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 7256](https://www.github.com/boykopovar/AnyPS5/pull/7256) | `core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7258](https://www.github.com/boykopovar/AnyPS5/pull/7258) | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` |
ee6aba54 commented 2026-10-15 14:09:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-15T14:09:13Z.


The overlap with #5998 is the Store helper in tests/execution/StorageCacheBudget.cpp. This PR adds a flush parameter, so a test can keep an image dirty, and #5998 moves the dispatch into Record under the GPU mutex. The two changes are compatible: whichever lands second takes both in a short rebase. There is no dependency either way. @MarcZX100 for visibility.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6194087673 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6194087673). Originally posted by [ee6aba54](https://github.com/ee6aba54) on 2026-10-15T14:09:13Z. --- The overlap with #5998 is the `Store` helper in `tests/execution/StorageCacheBudget.cpp`. This PR adds a `flush` parameter, so a test can keep an image dirty, and #5998 moves the dispatch into `Record` under the GPU mutex. The two changes are compatible: whichever lands second takes both in a short rebase. There is no dependency either way. @MarcZX100 for visibility.
Pipodi commented 2026-10-15 17:36:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-15T17:36:16Z.


@ee6aba54 I tried this on Ghost of Yōtei (PPSA26344) in our run162: RTX 4090 (24 GB), driver 617.42, Windows 11, main 0dab493f5 + #5815 #5781 #6227 #5405 #6402 + this PR, warm shader cache.

The first recovery worked: a 685 KiB texture allocation failed, the pool trim freed 2.24 GB, and the retry succeeded. By the wolf scene, device memory had spilled into the shared host heap (memory type 0, 15.9 GB) until that was full too. From then on the release itself failed 798 times:

[gpu] texture cache release stopped: vkAllocateMemory device buffer 4 MiB memoryType=0 ... Vulkan result -2

The release seems to need a 4 MiB buffer, presumably the write-back staging for a dirty storage image, from the same heap that just ran out. So it frees nothing at the point where it's needed. The run aborted at frame ~824 with VK_ERROR_OUT_OF_DEVICE_MEMORY.

Suggestion: once an allocation has failed, the release shouldn't allocate. It could drop what needs no write-back first (sampled entries nobody else holds, clean storage images), or keep the write-back staging buffer reserved up front.

In our case most of the memory wasn't in the texture caches at all. Resource-cache entries kept dropped sampled textures alive, and #6492 fixes that. With #6492 the same scene stays under the device budget, so the release path never runs there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6198345470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6198345470). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-15T17:36:16Z. --- @ee6aba54 I tried this on Ghost of Yōtei (PPSA26344) in our run162: RTX 4090 (24 GB), driver 617.42, Windows 11, main 0dab493f5 + #5815 #5781 #6227 #5405 #6402 + this PR, warm shader cache. The first recovery worked: a 685 KiB texture allocation failed, the pool trim freed 2.24 GB, and the retry succeeded. By the wolf scene, device memory had spilled into the shared host heap (memory type 0, 15.9 GB) until that was full too. From then on the release itself failed 798 times: ``` [gpu] texture cache release stopped: vkAllocateMemory device buffer 4 MiB memoryType=0 ... Vulkan result -2 ``` The release seems to need a 4 MiB buffer, presumably the write-back staging for a dirty storage image, from the same heap that just ran out. So it frees nothing at the point where it's needed. The run aborted at frame ~824 with `VK_ERROR_OUT_OF_DEVICE_MEMORY`. Suggestion: once an allocation has failed, the release shouldn't allocate. It could drop what needs no write-back first (sampled entries nobody else holds, clean storage images), or keep the write-back staging buffer reserved up front. In our case most of the memory wasn't in the texture caches at all. Resource-cache entries kept dropped sampled textures alive, and #6492 fixes that. With #6492 the same scene stays under the device budget, so the release path never runs there.
ee6aba54 commented 2026-10-15 18:31:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-15T18:31:52Z.


@Pipodi Thanks, that is a real defect in the release path, fixed in d6fe6551b.

Storing a storage image's pending results needs a staging buffer, and under that pressure it comes from the heap whose allocation just failed. The release took dirty images once the clean ones did not cover the request, so it failed on that 4 MiB buffer. There was a second effect: StorageTexture::Flush clears the pending state before it stores, so each failed store also dropped that image's results.

The release now takes only what needs no allocation: sampled entries and storage images without pending results. Images with pending results stay cached and are counted in the release line (..., N with pending results kept). The StorageCacheBudget execution test now requires that a release of everything keeps the dirty image, and that a release takes it once its results are stored. Without the change it fails with "a release of everything took the image with pending results".

I did not add a reserved write-back buffer. A buffer large enough for the largest surface would hold that memory for the whole session, and #6492 removes the cause in your scene.

Tested on Linux (RTX 5080, 595.99.02): ctest -R ^agc passes (574 tests, 4 skipped as before). The PPSA26344 case is not reproduced here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6199411563 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6199411563). Originally posted by [ee6aba54](https://github.com/ee6aba54) on 2026-10-15T18:31:52Z. --- @Pipodi Thanks, that is a real defect in the release path, fixed in d6fe6551b. Storing a storage image's pending results needs a staging buffer, and under that pressure it comes from the heap whose allocation just failed. The release took dirty images once the clean ones did not cover the request, so it failed on that 4 MiB buffer. There was a second effect: `StorageTexture::Flush` clears the pending state before it stores, so each failed store also dropped that image's results. The release now takes only what needs no allocation: sampled entries and storage images without pending results. Images with pending results stay cached and are counted in the release line (`..., N with pending results kept`). The `StorageCacheBudget` execution test now requires that a release of everything keeps the dirty image, and that a release takes it once its results are stored. Without the change it fails with "a release of everything took the image with pending results". I did not add a reserved write-back buffer. A buffer large enough for the largest surface would hold that memory for the whole session, and #6492 removes the cause in your scene. Tested on Linux (RTX 5080, 595.99.02): `ctest -R ^agc` passes (574 tests, 4 skipped as before). The PPSA26344 case is not reproduced here.
savvaniss commented 2026-10-17 13:10:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-17T13:10:15Z.


Windows data: the new agc_buffer_pool cases fail on Windows with both an Intel UHD 770 and an AMD RX 9070 XT.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. "Without" means this PR's test files on main c9e6c45de, with none of its other changes.

This head d6fe6551b merged into main c9e6c45de: 20 tests (agc_buffer_pool, agc_driver_graphics and the tests built from tests/Graphics.cpp, agc_driver_storage_cache_budget), ×3. 19 pass on both GPUs. agc_buffer_pool fails every run on both:

FAIL: the cache release did not permit recovery: AGC graphics: vkAllocateMemory device buffer: allocation=4194304 memoryType=0 reclaimed=2097152 released=0 initialResult=-2 attempts=2: Vulkan result -2
FAIL: cache release recovery leaked a resource
FAIL: the cache release alone did not permit recovery: AGC graphics: vkAllocateMemory device buffer: allocation=4194304 memoryType=0 reclaimed=0 released=0 initialResult=-2 attempts=1: Vulkan result -2
FAIL: cache release recovery with an empty pool leaked a resource

Every [bufferpool] ... recovered: line before them shows released=0. agc_driver_storage_cache_budget passes on both GPUs. There is no without-run: this PR's test files don't compile against main.

Full CTest (--parallel 4) on main c9e6c45de with seven open GPU PRs merged (#6258, #6657, #6324, #6246, #6174, #6360, #6598): UHD 770 1381 of 1389, RX 9070 XT 1383 of 1389. main alone passes 1378 of 1385 and 1381 of 1385. The merge adds only two failures: agc_buffer_pool (#6174, both GPUs) and agc_driver_indirect_dispatch_limit (#6360, RX 9070 XT).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234270354 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6234270354). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-17T13:10:15Z. --- Windows data: the new `agc_buffer_pool` cases fail on Windows with both an Intel UHD 770 and an AMD RX 9070 XT. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, `ANYPS5_NO_SHADER_CACHE=1`, serial CTest. Intel UHD Graphics 770 (`8086:a780`), driver 32.0.101.7088. AMD Radeon RX 9070 XT (`1002:7550`), driver 32.0.31041.1004, with `VkCache` emptied first. "Without" means this PR's test files on `main` `c9e6c45de`, with none of its other changes. This head `d6fe6551b` merged into `main` `c9e6c45de`: 20 tests (`agc_buffer_pool`, `agc_driver_graphics` and the tests built from `tests/Graphics.cpp`, `agc_driver_storage_cache_budget`), ×3. 19 pass on both GPUs. `agc_buffer_pool` fails every run on both: ``` FAIL: the cache release did not permit recovery: AGC graphics: vkAllocateMemory device buffer: allocation=4194304 memoryType=0 reclaimed=2097152 released=0 initialResult=-2 attempts=2: Vulkan result -2 FAIL: cache release recovery leaked a resource FAIL: the cache release alone did not permit recovery: AGC graphics: vkAllocateMemory device buffer: allocation=4194304 memoryType=0 reclaimed=0 released=0 initialResult=-2 attempts=1: Vulkan result -2 FAIL: cache release recovery with an empty pool leaked a resource ``` Every `[bufferpool] ... recovered:` line before them shows `released=0`. `agc_driver_storage_cache_budget` passes on both GPUs. There is no without-run: this PR's test files don't compile against `main`. Full CTest (`--parallel 4`) on `main` `c9e6c45de` with seven open GPU PRs merged (#6258, #6657, #6324, #6246, #6174, #6360, #6598): UHD 770 1381 of 1389, RX 9070 XT 1383 of 1389. `main` alone passes 1378 of 1385 and 1381 of 1385. The merge adds only two failures: `agc_buffer_pool` (#6174, both GPUs) and `agc_driver_indirect_dispatch_limit` (#6360, RX 9070 XT). AI-assisted: yes (Claude Code)
ee6aba54 commented 2026-10-17 14:37:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-17T14:37:45Z.


@savvaniss Thanks, that pinned it down. agc_buffer_pool_tests compiles Graphics/src/BufferPool.cpp into the test executable and also links libSceAgcDriver. The test registered its mock with BufferPool::SetCacheReclaim, which stored it in a function-local static. On Windows the executable and the DLL each have their own copy of that static: the test set the executable's copy, while DeviceBuffer (in the DLL) allocated through the DLL's copy, which stayed null. That is why every line shows released=0. On Linux the executable's definitions interpose the library's, so the test passed there.

0f1564cc2 removes the static: the release callback is now a Context field (cacheReclaim), set in VulkanDevice::buildContext and read by the pool when it is constructed, the same way the test already injects memoryProperties2. The test sets it on its mock context.

Tested on Linux with this head merged into main 47a266cf9: the agc_buffer_pool tests, agc_driver_graphics and agc_driver_storage_cache_budget pass, and all 654 agc tests pass except 3 that skip on this machine. I could not run it on Windows; a rerun of agc_buffer_pool there would confirm it.

Ubuntu 24.04, kernel 7.0.0, NVIDIA GeForce RTX 5080, driver 595.99.02, Release build.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235178532 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6235178532). Originally posted by [ee6aba54](https://github.com/ee6aba54) on 2026-10-17T14:37:45Z. --- @savvaniss Thanks, that pinned it down. `agc_buffer_pool_tests` compiles `Graphics/src/BufferPool.cpp` into the test executable and also links `libSceAgcDriver`. The test registered its mock with `BufferPool::SetCacheReclaim`, which stored it in a function-local static. On Windows the executable and the DLL each have their own copy of that static: the test set the executable's copy, while `DeviceBuffer` (in the DLL) allocated through the DLL's copy, which stayed null. That is why every line shows `released=0`. On Linux the executable's definitions interpose the library's, so the test passed there. `0f1564cc2` removes the static: the release callback is now a `Context` field (`cacheReclaim`), set in `VulkanDevice::buildContext` and read by the pool when it is constructed, the same way the test already injects `memoryProperties2`. The test sets it on its mock context. Tested on Linux with this head merged into `main` `47a266cf9`: the `agc_buffer_pool` tests, `agc_driver_graphics` and `agc_driver_storage_cache_budget` pass, and all 654 `agc` tests pass except 3 that skip on this machine. I could not run it on Windows; a rerun of `agc_buffer_pool` there would confirm it. Ubuntu 24.04, kernel 7.0.0, NVIDIA GeForce RTX 5080, driver 595.99.02, Release build. AI-assisted: yes
savvaniss commented 2026-10-17 17:15:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-17T17:15:25Z.


Windows confirmation for 0f1564cc2: agc_buffer_pool now passes on an Intel UHD 770 and on an AMD RX 9070 XT.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. Both heads are merged into the same main, 66702f1cf.

Head, ×3 UHD 770 RX 9070 XT
d6fe6551b (previous): agc_buffer_pool fails as before, released=0 fails, same
0f1564cc2: 20 tests: the three agc_buffer_pool tests, those built from tests/Graphics.cpp, agc_driver_graphics and agc_driver_storage_cache_budget 20 of 20 pass 20 of 20 pass

Full CTest (--parallel 4) with 0f1564cc2 merged fails the same tests as main 66702f1cf alone on this machine, none of them in code this PR touches:

  • UHD 770: the five image-table tests (#6647) and agc_driver_sample_multisample_target (#6957).
  • RX 9070 XT: agc_driver_quad_pixel_mask (#6255) and agc_driver_layered_volume_vertex_no_gpl (#4768).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6237387955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6237387955). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-17T17:15:25Z. --- Windows confirmation for `0f1564cc2`: `agc_buffer_pool` now passes on an Intel UHD 770 and on an AMD RX 9070 XT. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, `ANYPS5_NO_SHADER_CACHE=1`, serial CTest. Intel UHD Graphics 770 (`8086:a780`), driver 32.0.101.7088. AMD Radeon RX 9070 XT (`1002:7550`), driver 32.0.31041.1004, with `VkCache` emptied first. Both heads are merged into the same `main`, `66702f1cf`. | Head, ×3 | UHD 770 | RX 9070 XT | |---|---|---| | `d6fe6551b` (previous): `agc_buffer_pool` | fails as before, `released=0` | fails, same | | `0f1564cc2`: 20 tests: the three `agc_buffer_pool` tests, those built from `tests/Graphics.cpp`, `agc_driver_graphics` and `agc_driver_storage_cache_budget` | 20 of 20 pass | 20 of 20 pass | Full CTest (`--parallel 4`) with `0f1564cc2` merged fails the same tests as `main` `66702f1cf` alone on this machine, none of them in code this PR touches: - UHD 770: the five image-table tests (#6647) and `agc_driver_sample_multisample_target` (#6957). - RX 9070 XT: `agc_driver_quad_pixel_mask` (#6255) and `agc_driver_layered_volume_vertex_no_gpl` (#4768). AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-17 17:34:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T17:34:09Z.


Thanks for running the Windows regression on both Intel UHD 770 and RX 9070 XT, including the previous head as a control. The 3/3 failures before and 20/20 passes on the fix head confirm the DLL-local callback diagnosis and the Context-owned callback correction across both vendors. The full-suite failures you listed are outside this change and match the unchanged-main baseline.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6237730305 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6237730305). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T17:34:09Z. --- Thanks for running the Windows regression on both Intel UHD 770 and RX 9070 XT, including the previous head as a control. The 3/3 failures before and 20/20 passes on the fix head confirm the DLL-local callback diagnosis and the `Context`-owned callback correction across both vendors. The full-suite failures you listed are outside this change and match the unchanged-main baseline. AI-assisted: yes
milescoviello commented 2026-10-17 21:15:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T21:15:46Z.


A data point from a second title: Forspoken (PPSA03984). Linux 6.8, RTX 4070 Ti 12 GB (NVIDIA 595.99.02), Release, warm shader and pipeline caches, scripted pad input, APS5_PROFILE_DRAW=1 for the per-10 s present lines. The heap budget reported by VK_EXT_memory_budget was about 9.65 GB.

Base is main 82cad6b5fc with #6917 (df26342075). On main alone the title is slower and doesn't reach this point within 120 s. Given 240 s, main stopped at 192 s on an unrelated refusal (Rect-list SPIR-V: custom per-vertex interpolation is unsupported) without a -2. The other build adds this PR's head 0f1564cc20 (84da3ffe3f). Two interleaved rounds, 150 s each:

Build Run 1 Run 2
base aborts at 129 s: vkAllocateMemory texture: Vulkan result -2; 374 presents aborts at 114 s, same line; 247 presents
base + this PR runs to the 150 s limit, 480 presents, no -2; 3 [bufferpool] ... recovered lines runs to the 150 s limit, 488 presents, no -2; 6 recovery lines

Earlier runs of the same base without this PR stopped the same way at 85 s and 110 s, on vkAllocateMemory storage texture: Vulkan result -2.

The recovery lines from the second run with this PR:

[bufferpool] vkAllocateMemory storage texture recovered: allocation=12374016 reclaimed=1727180800 released=0 initialResult=-2 attempts=2
[bufferpool] vkAllocateMemory storage texture recovered: allocation=12374016 reclaimed=754925312 released=0 initialResult=-2 attempts=2
[bufferpool] vkAllocateMemory device buffer recovered: allocation=11534336 reclaimed=0 released=280935424 initialResult=-2 attempts=2
[bufferpool] vkAllocateMemory storage texture recovered: allocation=12374016 reclaimed=328131328 released=0 initialResult=-2 attempts=2
[bufferpool] vkAllocateMemory device buffer recovered: allocation=12582912 reclaimed=87286272 released=0 initialResult=-2 attempts=2
[bufferpool] vkAllocateMemory device buffer recovered: allocation=12582912 reclaimed=0 released=293568512 initialResult=-2 attempts=2

Most recoveries came from trimming the pool's idle tiers (reclaimed); the texture caches had to be released in three of the nine. The first recovery came 90 to 100 s in. In the 10 s intervals after it there were 37 to 44 presents (run 1) and 32 to 43 (run 2), against 22 to 48 in the minute before, so I saw no stall from the releases. I only ran 150 s, so this says nothing about longer sessions.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241222566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6174#issuecomment-6241222566). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-17T21:15:46Z. --- A data point from a second title: Forspoken (PPSA03984). Linux 6.8, RTX 4070 Ti 12 GB (NVIDIA 595.99.02), Release, warm shader and pipeline caches, scripted pad input, `APS5_PROFILE_DRAW=1` for the per-10 s present lines. The heap budget reported by `VK_EXT_memory_budget` was about 9.65 GB. Base is `main` 82cad6b5fc with #6917 (df26342075). On `main` alone the title is slower and doesn't reach this point within 120 s. Given 240 s, `main` stopped at 192 s on an unrelated refusal (`Rect-list SPIR-V: custom per-vertex interpolation is unsupported`) without a `-2`. The other build adds this PR's head 0f1564cc20 (84da3ffe3f). Two interleaved rounds, 150 s each: | Build | Run 1 | Run 2 | |---|---|---| | base | aborts at 129 s: `vkAllocateMemory texture: Vulkan result -2`; 374 presents | aborts at 114 s, same line; 247 presents | | base + this PR | runs to the 150 s limit, 480 presents, no `-2`; 3 `[bufferpool] ... recovered` lines | runs to the 150 s limit, 488 presents, no `-2`; 6 recovery lines | Earlier runs of the same base without this PR stopped the same way at 85 s and 110 s, on `vkAllocateMemory storage texture: Vulkan result -2`. The recovery lines from the second run with this PR: ``` [bufferpool] vkAllocateMemory storage texture recovered: allocation=12374016 reclaimed=1727180800 released=0 initialResult=-2 attempts=2 [bufferpool] vkAllocateMemory storage texture recovered: allocation=12374016 reclaimed=754925312 released=0 initialResult=-2 attempts=2 [bufferpool] vkAllocateMemory device buffer recovered: allocation=11534336 reclaimed=0 released=280935424 initialResult=-2 attempts=2 [bufferpool] vkAllocateMemory storage texture recovered: allocation=12374016 reclaimed=328131328 released=0 initialResult=-2 attempts=2 [bufferpool] vkAllocateMemory device buffer recovered: allocation=12582912 reclaimed=87286272 released=0 initialResult=-2 attempts=2 [bufferpool] vkAllocateMemory device buffer recovered: allocation=12582912 reclaimed=0 released=293568512 initialResult=-2 attempts=2 ``` Most recoveries came from trimming the pool's idle tiers (`reclaimed`); the texture caches had to be released in three of the nine. The first recovery came 90 to 100 s in. In the 10 s intervals after it there were 37 to 44 presents (run 1) and 32 to 43 (run 2), against 22 to 48 in the minute before, so I saw no stall from the releases. I only ran 150 s, so this says nothing about longer sessions. AI-assisted: yes (Claude Code)
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!6174
No description provided.