Skip to content

fix(agc): release unpublished descriptor cache objects - #7148

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-descriptor-cache-publication
Oct 17, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-descriptor-cache-publication

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

What

When a host allocation fails while DescriptorCache publishes a newly created Vulkan descriptor set layout or chain pool, the handle is lost and cache destruction cannot release the object. This retains Vulkan resources while the process is already short of host memory.

Destroy the layout if insertion into the layout map throws, and reserve the chain entry before creating its Vulkan pool. Allocation errors still propagate. Add a deterministic regression covering ordinary and update-after-bind layouts, first and growing pool chains, recovery, cache hits and destruction. The test compiles the production source into its executable so its allocation failure injector reaches that code on both platforms.

I checked the open PR inventories, including complete inventories for large changes, and compared the descriptor-cache changes in related PRs such as #6614 and #6567. They cover separate recycling behavior.

Tested

Final source: 256da9617cde64a2a649f2db98a0d2217415bd01, based on 47a266cf975f00f7fba94013467d03bfa5e355e9. Release, BUILD_TESTING=ON.

  • Windows (native host): Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0; AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, driver 32.0.16.1742. Full default build passed. Nine selected CPU tests passed, including the regression, graphics mocks, descriptor layout/reset tests, buffer-pool cases and patched_libraries. Four Vulkan tests passed: agc_descriptor_pool_recycling, agc_driver_buffer_descriptor_runtime, agc_driver_image_table, agc_driver_oversized_descriptor_sets. Device logs confirmed the NVIDIA GPU; Vulkan was required and the application shader cache disabled. The recycling test exercised 3,301 sets. No failures or skips in these 13 tests.
  • Linux (VirtualBox): Ubuntu 24.04.5 LTS, kernel 7.0.0-38-generic, GCC 13.3.0, VirtualBox 7.2.20 r175154 on the Windows host above; 4 vCPUs, 8 GiB RAM. Graphics: not exercised. Built the AGC/runtime and the relevant test targets. Eight selected CPU tests passed with no failures or skips. All 2,762 final source blobs matched the commit above, including after the negative control was restored.
  • Conventions, whitespace and Windows test registration checks passed: 942 test executables, all registered.

Before / after — Linux (VirtualBox)

agc_descriptor_cache_failure, one run of all six scenarios per version, in the same VM and Release configuration. The negative control used the production file from base 47a266cf975f00f7fba94013467d03bfa5e355e9 with the regression fixture retained; the restored fix matched the final source above. The initial Windows baseline also reproduced all six leaks.

Metric Before (base) After (fix)
Unowned descriptor set layouts after cache destruction, 2 scenarios 2 0
Unowned descriptor pools after cache destruction, 4 scenarios 4 0

The regression injects host allocation failures; it does not exhaust system memory or measure game performance.

Reproduce the focused regression after configuring the full build:

cmake --build build --target agc_descriptor_cache_failure_tests
ctest --test-dir build -R '^agc_descriptor_cache_failure$' --output-on-failure

For the Windows Vulkan selection, set ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_GPU=RTX 4070 Ti SUPER before running the four named tests.

Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox validation. Native/bare-metal Linux was not tested. Native Linux GPU validation: not tested. No retail title or homebrew was run. Full hosted platform CI requires collaborator dispatch; local results above are separate from hosted checks.

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 in technical debt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER; NVIDIA driver 32.0.16.1742; Windows 11 Pro 10.0.26300
  • AI-assisted: yes (Codex)

@github-actions github-actions Bot added build agc libSceAgc* labels Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

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 1341 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4339 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4650 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4891 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5426 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5499 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5958 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6130 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6146 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6176 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6177 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6194 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6259 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6320 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6373 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6414 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6492 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6535 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6601 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6647 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6718 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6747 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6783 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6887 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6946 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6947 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6959 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6965 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6973 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6987 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6989 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6995 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7002 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7154 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7258 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp

@oneandonlydean
oneandonlydean merged commit e0fcdb5 into boykopovar:main Oct 17, 2026
9 checks passed
@Ondra97
Ondra97 deleted the codex/fix-descriptor-cache-publication branch October 19, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants