perf(agc): recycle descriptor pools after their last set is released #1333
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1333"
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 TibixDev on 2026-10-07T23:45:17Z.
What
Recycle descriptor pools after their last live set is released. Skip full pools and terminate if a pool reset fails. Set owners keep their existing GPU lifetime; no GPU wait is added.
Rebased on
66b8abd8. Merged #1065 already fixes the RADV overrun; its padding is retained. This PR adds pool recycling. A long-lived set delays reuse of the rest of its pool.Tested
Fedora 44 Release: graphics and reset-failure tests pass. RX 6600 and llvmpipe pass the 3,301-set lifecycle test with core and synchronization validation.
An isolated comparison against upstream including #1065 measured 139→31 ns per allocation/release pair for batches, 139→33 ns with one retained set, and 51→30 ns for a rolling 64-set collection. Pool counts were 3→3, 3→4, and 1→2. These are CPU component timings, not title frame times; peak title memory is unmeasured.
The Windows failure test now installs the guest runtime handler. MinGW compiles the test source. The local full Windows link is blocked by unrelated libc SjLj symbols; Windows CI is pending.
Checklist
main; merged #1065 checked and retained.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T03:26:19Z.
DescriptorCache::Freeprints and retires the pool whenvkResetDescriptorPoolfails. Failures stay explicit here; please make it fatal like thestd::terminate()checks above it. This also replaces #1065's workaround for the same RADV overrun, so only one of the two will go in.Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T04:14:41Z.
Reset failure now terminates. The new isolated test fails on the previous code and passes with this change.
Rebased on current
main(a9ba39c9). Graphics tests pass. The 3,301-set lifecycle test also passes on llvmpipe and RX 6600 with core and synchronization validation enabled. Windows was not tested.This still has no dependency on #1065.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T06:37:25Z.
Windows CI fails on the new test:
The
std::set_terminatehandler indescriptorPoolResetFailureTestdoesn't catch the terminate on Windows, so the process fast-fails instead of exiting with your code. Please make the test check the exit status in a way that works on both platforms.Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T06:41:20Z.
Rebased on
7a178e22, which includes merged #1065. Its padding stays in place. This PR now needs to be judged as a pool-recycling optimization; it is no longer needed to supply that crash fix.The Windows test installed a host
std::set_terminatehandler, butstd::terminateenters guest libc. The test now installs the guest handler with the guest ABI. A reset error remains fatal.I compared the production
DescriptorCachemethods and declarations from upstream with this PR alone. Fedora 44, GCC 16-O3 -DNDEBUG, Ryzen 5 5600 pinned to CPU 3, RX 6600 with host RADV. Six processes per variant in ABBA order; each process warms up 20 cycles and measures seven batches of 200 cycles. Each cycle performs 1,100 allocations and releases using 32-storage-buffer layouts. No GPU work or descriptor updates are timed.Median CPU time per allocation/release pair, ns:
batchreleases all sets after each cycle.heldretains one extra set throughout.rollingreplaces entries in a 64-set live collection. Pool counts were 3→3, 3→4, and 1→2 respectively. Recycling reduces CPU time in these cases but retains more pool storage when sets overlap. Peak title memory and frame-time gains remain unmeasured.Linux graphics and reset-failure tests pass. The 3,301-set lifecycle test passes on RX 6600 and llvmpipe with core and synchronization validation. The test source compiles with MinGW; the local full Windows link is blocked by unrelated SjLj symbols in libc. Windows CI is pending.
Updated to
66b8abd8after #1427 added the PM4 failure test. Both failure tests remain registered; graphics and descriptor reset-failure tests pass again. The measured pool implementation is unchanged.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:22:05Z.
Conflicts with #1266, which added dedicated pools for oversized sets to
DescriptorCache::AllocateandFree; please rebase and keep that path.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T23:04:36Z.
Review: CHANGES_REQUESTED
This conflicts with
maininShaderResources.hpp,ShaderResources.cpp,tests/Graphics.cppandTechnicalDebt.md(#1266 reworkedDescriptorCache::Allocate/Free).AllocateandFree; the recycling should apply to the chain pools only, or explicitly to both with a test for each.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T09:07:28Z.
Review: APPROVED
Rebased onto current
mainand kept #1266's dedicated pools (destroyed inFree; recycling applies only to the chain pools, both the regular and the update-after-bind chain). Added on your branch:descriptorCacheTests: an oversized set allocated and freed between regular sets leaves the chain pool's reset count untouched; the pool resets only once the last regular set is freed.Freepath (vkResetDescriptorPoolinstead ofvkFreeDescriptorSets);agc_descriptor_pool_recycling(Recorder, 3,301 sets) registered in ctest.Checked: libSceAgcDriver build + ctest (379) green;
agc_driver_graphicsandagc_descriptor_pool_reset_failurefail without the change. Merging once CI is green.