perf(agc): size the storage and sampled texture caches to the device #1059
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1059"
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 Celegans12 on 2026-10-07T06:24:39Z.
What
The storage image and sampled texture caches each evict least recently used entries past a fixed 2 GiB, and a sampled view of a storage image counts that image again. In the PPSA26344 open world a 16,386-entry image table is remade every frame (about 16,400 textures, 5 s); its textures take up to about 5 GiB, which the cache never keeps.
TextureCacheBudget).SampledTextureBudget): whatVK_EXT_memory_budgetleaves on that heap after the memory used outside sampled textures and cached storage images, the storage budget and an eighth of the budget, read at most once a second, at least 2 GiB; else the storage rule. NonzeroAPS5_TEXTURE_CACHE_MIBsets both. Moves over 10% are logged, at most every 10 s.SampledTextureMemory) is every snapshot's allocation, cached or still bound after eviction. A view of a cached storage image counts 0 and leaves with its image.StorageTexture::memoryBytes, and #293 and #1184 add a clear toClearCachedTextures. With #1484, whichever lands second adds the blocks' free bytes to the sampled memory. #1619 adds depth copies in the same lines; whichever lands second counts a copy's image, since views count 0 here.Details
With #1484 the budget settled near 2.1 GiB, since the blocks' free part counted as outside use. The 2.27 M snapshots were of 22,512 textures; the median one was made in each of the last 69 frames.
Tested
main6b56175a: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)VK_DRIVER_FILES): 475/475 pass;agc_driver_flat_storeis left out there because it takes several minutes on Windows llvmpipeagc_driver_sampled_cache_budget_memory(a reported heap budget): a texture still held after it left the cache counts as sampled memory; fails with only the cache's bytes counted.agc_driver_sampled_cache_budget: snapshots count their image's allocation, not their guest bytes, and leave in LRU order; views count 0 and leave with their image.agc_driver_graphics: mocked-heap budgets and the 10% / 10 s report rule (does not link on main).VK_EXT_memory_budgetfrom 9.2 GiB at boot to 4.0-5.0 GiB in the world, where the device-local heap uses 14.4-16.0 of its 15.0 GiB; a frame makes about 2,900 textures instead of 16,600; novkAllocateMemoryfailure.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T19:36:08Z.
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/Graphics/src/ShaderResources.cppL442, L609-611