Skip to content

fix(agc): keep small device buffers in the small pool tier - #7056

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
danielcadev:fix/small-device-buffer-retention
Oct 17, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
danielcadev:fix/small-device-buffer-retention

Conversation

@danielcadev

@danielcadev danielcadev commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What

Small device-local buffers currently share the device tier with large scratch allocations. Releasing two buffers that together exceed that tier's byte budget evicts a previously retained 256-byte buffer, so the next small request allocates again.

Route device allocations with a capacity below 1 MiB to the existing small tier. Keep the shared-pool mode and disabled-staging mode unchanged, along with existing byte/slot budgets, memory-property keys, allocation lifetimes and exact Vulkan buffer sizes.

Add a regression through DeviceBuffer that forces large-buffer eviction, checks reuse of the small allocation and verifies final object cleanup. Separate processes cover shared pooling and disabled staging because the configuration is cached per process.

Related: #4472 changes VRAM-pressure retention; this PR changes size-based tier selection and has no dependency on it. The broader Linux/Yōtei investigation is tracked in discussion #2884. No title FPS or RAM improvement is claimed for this isolated change.

Overlap review: #6882 and #7057 address slab-allocation cleanup and failed memory binding, respectively. The retention fixture and its default-suite call have been moved away from their insertion points; git merge-tree now combines this branch cleanly with their reviewed heads. #6943 still overlaps the command-line test dispatcher (main), not the production tier selection. Its selector needs to be reconciled when either branch lands; there is no production dependency on #6943. The conflicting-base BufferPool deltas in #5987 and #6553 were also inspected: they change allocation fallback/placement, not tierFor.

Tested

Branch base: ef674f5af3e4d0fe44fda10e46d36ead2c262c0e (main). The focused tests, complete runtime build and native smoke test used main f05fc7d953d30160cb05411875b2824fd10acc15 plus this correction; the subsequent rebase only adds upstream #7055, which changes the LoadExec test cleanup, with no production changes. Fedora 44 x86-64, GCC 16.2.1, Release, default ANYPS5_ENABLE_SPIRV_TOOLS=OFF.

  • agc_buffer_pool, agc_buffer_pool_small_device_shared and agc_buffer_pool_small_device_no_staging: passed.
  • Negative control: restore only the original tierFor condition, rebuild and run APS5_STAGING_POOL_MIB=256 agc_buffer_pool_tests --small-device-retention. It exits 1 with both retention/reallocation assertions failing. Restore the correction and rebuild for the final passing run.
  • agc_device_memory_fallback: passed.
  • agc_driver_pooled_buffer_range: passed on AMD Radeon RX 9060 XT 16 GB, locally modified Mesa 26.2.3 RADV, Fedora Linux. This real-GPU compatibility test checks exact buffer sizes and robust reads beyond the requested range; the new eviction regression itself uses the existing mock Vulkan allocator.
  • After relocating the fixture and default-suite call, rebuilt agc_buffer_pool_tests; all three buffer-pool CTests passed again.
  • tools/check_conventions.py: passed with the proposed title/body.
  • tools/tests/test_test_registration.py: 27 tests passed.
  • Built all system libraries (libs) and the relinker, reconverted PPSA26344 01.512.000 and checked imports: no unresolved imports. A separate cold-AnyPS5-cache native run ended in cgroup OOM after about 122 s at the 12 GiB RAM cap (1.22 GiB swap peak). No wolf/tree capture or title performance benefit was established; this is not a paired pool comparison. The original runtime was preserved.

Validation is scoped to buffer allocation and retention. The full test suite and Windows were not run.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 9060 XT 16 GB; locally modified Mesa 26.2.3 RADV; Fedora 44 Linux x86-64 (pooled_buffer_range compatibility test)
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

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 6943 core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp L605-606

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 4472 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp
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 5987 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6176 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6259 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6320 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6373 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6503 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6535 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6553 core/libs/prx/libSceAgcDriver/Graphics/src/BufferPool.cpp
core/libs/prx/libSceAgcDriver/tests/BufferPool.cpp
PR 6683 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6718 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6747 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6937 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6946 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6947 core/libs/prx/libSceAgcDriver/CMakeLists.txt

@danielcadev
danielcadev force-pushed the fix/small-device-buffer-retention branch from 506c015 to 27ded2c Compare October 17, 2026 09:40
@oneandonlydean
oneandonlydean merged commit aa959e3 into boykopovar:main Oct 17, 2026
2 checks passed
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