Repository navigation
Conversation
Each sampled texture the texture cache keeps copies its guest bytes into a new, zero-filled snapshot vector, and evicting the entry frees it. A title that keeps re-creating large textures commits and zero-fills that memory again for every one. APS5_TEXTURE_SNAPSHOT_POOL_MIB=<n> keeps up to n MiB of the snapshot allocations of evicted entries (64 KiB and larger, the largest dropped first when over the limit) and gives a new snapshot the smallest kept one that is at least as large and at most twice its size. 0, the default, keeps the previous behaviour. APS5_TEXTURE_CACHE_REPORT=1 prints the texture-cache counters every ten seconds without draw profiling, now with the snapshots made and reused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This pull request is labeled |
|
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.
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.
|
|
AMD data point: RTX 3080 (NVIDIA 617.42) and AMD Radeon RDNA 2 iGPU ( AI-assisted: yes (Claude Code). |
|
Thanks. A small point on how the pool is bounded:
Keying |
A reused snapshot keeps the capacity it was allocated with when it is resized down, but the pool filed spare buffers under their size, so the "at most twice the request" rule held for the size only and could compound: a buffer allocated for a 32 MiB texture could serve 16 MiB, then 8 MiB, and end up holding a 64 KiB texture with 32 MiB committed. Spare buffers are now filed under their capacity, so the rule bounds the memory a reused snapshot holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Good catch, thanks. Fixed in 48a3109: spare buffers are filed under their capacity, so the "at most twice the request" rule bounds the memory a reused snapshot holds and can't compound. For the perf label I'll capture a |
|
Measured, and I don't think this earns its place on current Demon's Souls (PPSA01341 01.007.000), Windows 11, RTX 4070 (610.88), 1920x1080,
The large churn this was written against came from a texture cache that kept evicting on an older fork; current |
What
Each sampled texture the texture cache keeps copies its guest bytes into a new, zero-filled snapshot vector, and evicting the entry frees it. A title that keeps re-creating large textures commits and zero-fills that memory again for every one.
APS5_TEXTURE_SNAPSHOT_POOL_MIB=<n>keeps up to n MiB of the snapshot allocations of evicted entries (64 KiB and larger; the largest are dropped first when over the limit) and gives a new snapshot the smallest kept one that is at least as large and at most twice its size. Unset or 0 keeps the current behaviour.APS5_TEXTURE_CACHE_REPORT=1prints the texture-cache counters every ten seconds without draw profiling, now with the snapshots made and reused, so the pool can be checked in a run.Both are documented in
docs/dev/ENVIRONMENT.md.Related: #6982 releases the snapshot of a large write-tracked texture after its upload. The two do not conflict, but with both merged a released snapshot is freed there and never reaches this pool, so the pool would only reuse snapshots still held when their entry is evicted.
Tested
Windows 11 (10.0.26200), winlibs GCC 15.2, Release build of this branch on
mainat 1d41645.partially_resident|snapshot|texture_cachepass, including the newagc_driver_partially_resident_snapshot_pool, which runs the partially resident snapshot test withAPS5_TEXTURE_SNAPSHOT_POOL_MIB=64andAPS5_TEXTURE_CACHE_REPORT=1.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1(ctest -V) onmainand on this branch: 9 tests onmainand 10 on this branch (the new one included) pass, with noVUID-line and nowas not found but was requested by env var VK_INSTANCE_LAYERSin either log (VK_LOADER_DEBUG=layershowsVK_LAYER_KHRONOS_validationfrom Vulkan SDK 1.4.363.0 inserted).main, and no performance trace has been captured yet. On an older fork build, in a Demon's Souls (PPSA01341) level, these snapshot vectors were about half of the process's fresh commits (about 18 GB per 30 s), and with a pool 99% of new snapshots reused a kept allocation.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)🤖 Generated with Claude Code