fix(agc): discard device buffers after memory binding fails #7057
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7057"
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-17T09:20:54Z.
What
A failed
vkBindBufferMemoryleftDeviceBufferwith both handles, so constructor cleanup returned the unbound buffer to the reuse pool. A same-size retry then reused it without another bind call, potentially passing an unusable buffer into GPU work.Track completed construction, as
Bufferalready does, and retain only successfully bound device buffers. Failed construction destroys its buffer and frees its memory. Fresh allocations, same-size pool hits and resized pooled buffers remain reusable after successful construction.The CPU mock and native Vulkan regressions inject
VK_ERROR_OUT_OF_HOST_MEMORYandVK_ERROR_OUT_OF_DEVICE_MEMORY, check cleanup, make three same-size retries per error and verify normal pool reuse. The native fixture also verifies 256-byte GPU copy/readback data for every valid retry. Invalid baseline retries are detected before submission; physical memory is not exhausted.Tested
Current base:
c9e6c45de9ccccc4f714e153252a8fa48efbf367. Current head:785c1079794662177df7d5e85530b353e8df0948. Release; SPIRV-Tools and Tracy disabled. Full application/library builds usedBUILD_TESTING=OFF; focused tests usedBUILD_TESTING=ON.The branch contains only the two PR commits. Their added/deleted lines are identical to the original commits;
range-diffchanges only the surrounding testmain(argc, argv)context introduced by #7056. The carried #6882 merge is removed, and both #6882 and #7056 are already in the base. The binding regression remains separate from cache-pressure regressions.Windows (native host)
AMD Ryzen 9 7900X, 32 GB RAM, NVIDIA GeForce RTX 4070 Ti SUPER, driver 617.42 / 32.0.16.1742, Windows 11 Pro 10.0.26300; WinLibs GCC 15.2.0.
Full application/library build passed:
After enabling
BUILD_TESTINGand building the 20 selected test executables, 22/22 tests passed, 0 failed, 0 skipped, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andANYPS5_GPU=NVIDIA GeForce RTX 4070 Ti SUPER:The native pooled fixture selected NVIDIA (
vendor=0x10de,device=0x2705). Both error cases retained 0 bytes and produced 0 invalid retries, in both the CPU mock and native fixture. All six native retries verified GPU copy/readback data. Two bind attempts per error case (one injected failure, one success) also verify normal reuse. The suite includes #7056's separate/shared pool and zero-staging controls.Original controlled regression comparison (before rebase)
The previously recorded comparison used baseline
bb4fada71465029432b6ef85d7a3f4c8502827f9(mainadb0e7a8cb68232f457c788afa90e53648c0f15fplus #6882, with the new regressions) and fixed head801f6e44592eb394252cc87347efc54cb84ffd0a, on the Windows hardware above. Each binding-error case requests a 3 MiB buffer and makes three same-size retries. These are the original before/after measurements; the current-head checks are reported above.Linux (VirtualBox)
Ubuntu 24.04.5 LTS, kernel 7.0.0-38-generic, GCC 13.3.0, 4 vCPU and 8 GiB assigned RAM; VirtualBox 7.2.20r175154 on the Windows host above. Graphics: not exercised.
Full application/library build passed with
cmake --build build --target all libs --parallel 2. After enablingBUILD_TESTING, the six selected CPU executables and the native pooled-buffer fixture compiled successfully. 8/8 CPU tests passed, 0 failed, 0 skipped:Both binding-error cases retained 0 bytes, returned 0 invalid retries and made exactly two bind attempts. The small-device shared-pool and zero-staging controls also passed.
All 2,756 source files and 13,298 dependency files were verified against Git blobs, including dependency symlinks, for the current head. The native Vulkan fixture was compiled without running Linux graphics tests.
Conventions, test registration, whitespace and main-sync checks passed. Full hosted platform builds require a maintainer's manual workflow dispatch.
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 run, FPS improvement or other GPU-vendor result is claimed.
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 github-actions[bot] on 2026-10-17T09:29:23Z.
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.
core/libs/prx/libSceAgcDriver/tests/BufferPool.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Resources.cppcore/libs/prx/libSceAgcDriver/tests/BufferPool.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Resources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Resources.cppcore/libs/prx/libSceAgcDriver/tests/execution/PooledBufferRange.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Resources.cppcore/libs/prx/libSceAgcDriver/tests/BufferPool.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Resources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Resources.cppcore/libs/prx/libSceAgcDriver/tests/BufferPool.cppImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T11:58:56Z.
Thanks @Ondra97. #6882 and #7056 have both merged into main, and GitHub now reports this PR as conflicting with main (most likely in BufferPool.cpp, which #7056 also changed). Could you rebase onto current main and drop the carried #6882 merge, as you did for #7065? Once the new head is up, we'll check the two PR commits are unchanged and run full CI on it.
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-17T12:18:46Z.
Thanks @oneandonlydean. I rebased onto
c9e6c45de9and pushed785c107979, dropping the carried #6882 merge. Only the two PR commits remain, with identical added/deleted lines;range-diffonly differs in the surroundingmain(argc, argv)context from #7056. GitHub now reports CLEAN/MERGEABLE.Local validation on this head passed; environment details and commands are in the updated PR description:
No local test failures or skips.
Linux graphics/Vulkan tests: NOT RUN — intentionally excluded from VirtualBox validation. Native/bare-metal Linux was not tested. Native Linux GPU validation: not tested.
Automatic checks passed; full hosted Windows/Linux builds are still policy-skipped. The new head is ready for the full CI run you mentioned.
AI-assisted: yes — Codex