perf(agc): size the device staging pool from the device-local heap #1147
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1147"
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 alfalfa-star on 2026-10-07T14:18:06Z.
What
The buffer pool's device tier (the detiler's scratch buffers and the staging shadows of written guest buffers) kept at most 512 MiB by default. When a title's working set of these buffers is larger, the driver allocates and frees device memory continually. PPSA14632 had 70761 misses and 69828 evictions per 10 s with 485 of 512 MiB retained, and each one is a
vkAllocateMemoryorvkFreeMemory.APS5_STAGING_POOL_MIBstill sets it explicitly, and 0 still disables the tier.BufferPool::DeviceBudgettakes the memory properties and is public, so the rule can be tested.Tested
Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT (16 GiB).
agc_driver_graphics: newstagingPoolBudgetTests(an eighth of a 16 GiB device-local heap is 2 GiB, a 2 GiB heap gives the 512 MiB floor, a host-only heap does not count).ctest: 463 of 463 pass on currentmain.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T17:09:33Z.
Rebased onto current
main(be04d4aa). The new conventions check flagged the editedBufferPool.hppcomment about theAPS5_STAGING_POOL_MIBdefault. I deleted that comment instead of updating it; the default is described above.ctest: 463/463.Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T17:28:41Z.
The linux failure on be04d4aa is a timeout in
agc_driver_flat_store. The previous head passed linux, and the only change since then removes a comment, so it looks flaky. Could a maintainer re-run the failed job? I don't have the rights to.Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T17:51:54Z.
Follow-up on the
agc_driver_flat_storetimeout, with numbers instead of "looks flaky". On linux every PR runs it three times (--repeat until-fail:3), and the first run is always much slower than the other two, presumably lavapipe compiling its shaders with a cold cache:--parallel 4--parallel 4main's workflow added--parallel 4between the two #1147 runs, and this test already used half to two thirds of its 120 s timeout when run serially. So whether it fails depends on what else runs beside it, not on this PR. A re-run should pass most of the time. The root cause, the size of this test's shaders, is already being addressed in #1265, which reports the cold run going from 84.4 s to 27.0 s (measured on Intel ANV, not lavapipe). #1280 and #1282 change the same code. Edit: #1715 (merged) already runs this test withRUN_SERIAL, so a rebase onto currentmainpicks up that fix.Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T18:41:32Z.
Rebased onto
main6b56175a(6d1cf275), which includes #1715.agc_driver_flat_storenow passes when run alone, butagc_driver_buffer_formattimed out instead. Since #639 that test takes 93-108 s on lavapipe for every PR, not only this one (details in #1762). Could a maintainer re-run the linux job? Locally, 479/479 pass.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:22:52Z.
Review: CHANGES_REQUESTED
This conflicts with
mainsince commit28345b0ea(device size classes), and it isn't a mechanical rebase:BufferPool::DeviceTieredandCapacity(bytes, properties)are static and callDeviceBudget()to know whether the device tier is enabled. WithDeviceBudget(memory)there is noContextthere, so they can't compute the heap-derived value. Keep the environment check (APS5_STAGING_POOL_MIB=0disables the tier) in a static helper that doesn't need the heap, and use the heap-derived value only fordeviceTier.budgetin the constructor, soCapacityandtierForstay consistent.stagingPoolBudgetTestsand make sure it still covers the 16 GiB / 2 GiB / host-only-heap cases.agc_driver_buffer_formattimeout on lavapipe you already described (#1762), not this change; it should clear on a re-run after the rebase.Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-10T08:10:41Z.
Rebased onto current
main(after #1004's size classes) in3bb4494e, as you suggested:DeviceTierEnabled()(static, read once) holds the environment check: the tier is in use unlessAPS5_STAGING_POOL_MIBis set to 0.DeviceTiered, and through itCapacity,UsageandtierFor, use only that, so the size classes and the tier choice can't disagree.DeviceBudget(memory)is used only in the constructor, fordeviceTier.budget:APS5_STAGING_POOL_MIBwhen set, else max(512 MiB, largest device-local heap / 8).stagingPoolBudgetTestsis unchanged and still covers 16 GiB → 2 GiB, 2 GiB → 512 MiB and a host-only heap → 512 MiB.ctest: 638/638 on RADV (RX 9070 XT).Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T08:11:54Z.
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.
main)core/libs/prx/libSceAgcDriver/tests/Graphics.cppL8core/libs/prx/libSceAgcDriver/tests/Graphics.cppL8core/libs/prx/libSceAgcDriver/tests/Graphics.cppL8Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T09:28:27Z.
Review: APPROVED
Checked the rework against the size classes:
DeviceTiered/Capacityonly depend on the staticDeviceTierEnabled(), the heap-derived budget is used only in the constructor. Built and ranagc_driver_graphicson RADV; the newstagingPoolBudgetTestsdon't compile without the change. Merging.