agc: the storage image cache budget, heap-following since #7071, falls to its 512 MiB floor with heap budget still free (007 First Light, RTX 3080 10 GB) #10041

Open
opened 2026-10-23 05:45:31 +00:00 by SleglJan · 0 comments
SleglJan commented 2026-10-23 05:45:31 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-23T05:45:31Z.


What happens. In 007 First Light (PPSA11386) on an RTX 3080 10 GB, the storage image cache budget, which my #7071 made follow the heap's use, falls to its 512 MiB floor in early gameplay in 28 of the 56 runs below, 10-24 times in each of them (a lower bound: the [gpu] budget line prints only when a budget moves by more than a tenth, at most every 10 s). At those lines 338-1,204 MiB of the heap budget is still free (plain runs; the heap budget as the texture budgets see it, 250 or 500 MiB below the driver's where the diagnostic below is set). Of those 56, the 33 that collapsed (as defined below) reached frames 1,574-1,785 by their 1,500 s end, except one, which collapsed by the uncached rule only and reached 2,141; the 23 clean ones reached 2,101-2,279 (frames: presents plus dropped frames, from the [present] lines); the prompt scene after Bond's fall starts at about frame 1,600. #7071's own measurements already showed this budget at its floor after the level entry (present 1298), and its debt entry names re-creation at each use as the cost. This report is about how often that happens in gameplay, and what changes it.

The budget. StorageTextureBudget (ShaderResources.cpp, main 27c88a8d75) is 7/8 of the device-local heap budget B minus the heap's use other than the cached storage images, between a 512 MiB floor and a cap of B/4 (or TextureCacheBudget, 2,560 MiB on this card, if smaller); unchanged on current main 0db47b263d (2026-10-23). Since the use is sampled textures alive + cached storage + other use, cached storage plus other use stays near 7/8 B minus sampled alive whenever the formula binds, in every run; the runs differ in other use. In one run that fell, from frame 1,398 to 1,435 cached storage went from 1,460 to 572 MiB and other use from 3,869 to 4,717 MiB, while use stayed at 7,311-7,516 MiB. No counter tells whether that growth is storage images the cache let go that are still alive, memory retained for reuse, or other allocations that pushed the cache out. Two parts are measured:

  • With a local change of mine (not posted) that counts storage images the cache let go as storage until they are destroyed, their bytes were 0 MiB at 96 of 104 floor lines (at most 235 MiB at the rest); their 10 s peaks in gameplay were 428-1,592 MiB per run, as high in clean runs as in runs that fell.
  • The buffer pool's device tier (DeviceBudget in BufferPool.cpp, an eighth of the heap budget, 1,120 MiB here, with an image share of 280 MiB) held 0.8-1.1 GB at these lines in both kinds of run. With that tier off no run reached the floor (lowest budget 631, 712 and 2,106 MiB), though two of the three still collapsed by the uncached rule below.

The [gpu] lines at the same frame and headroom (diagnostic at -250 MiB), a run that fell against one that didn't, MiB, other use = use - sampled alive - cached storage:

run frame heap budget (as the texture budgets see it) use free sampled alive (cached) cached storage other use storage budget
fell 1435 8,398 7,475 923 2,186 (2,042) 572 4,717 512 (floor; formula 445)
stayed 1434 8,466 7,507 959 2,315 (2,048) 1,882 3,310 1,783
fell 1425 8,357 7,725 632 2,423 (2,039) 708 4,594 512 (floor; formula 295)
stayed 1429 8,461 7,107 1,354 2,012 (2,012) 1,941 3,154 2,115 (cap)

What we tried. Each run 1,500 s from launch; gameplay starts at 405-416 s. A run counts as collapsed when a [gpu] line at frame 1,400 or later shows the storage budget at its floor, or when the sampled-texture cache's 10 s lines from frame 1,650 counted textures used uncached 3 times in a row reaching frame 1,700, or 8 times in a row. Headroom is a local diagnostic that lowers the heap budget only the two texture budgets see (and #8672's ceiling where it is in the tree); real VRAM is unchanged; "default" means it is unset.

variant default headroom -250 MiB -500 MiB note
plain 5 of 5 9 of 14 1 of 2 all at the floor
my local change above 2 of 2 - 1 of 2 the -500 one by the uncached rule, lowest budget 650 MiB
#7870's image share off (APS5_IMAGE_POOL_MIB=0) - 2 of 3 - at the floor
device tier off (APS5_STAGING_POOL_MIB=0) - 2 of 3 - uncached rule only, lowest budget 631 and 712 MiB
#7833 at 79146e64f0 - 1 of 3 0 of 2 the one with device memory full
#7833 + my local change - - 1 of 2 device memory full
the rule before #7071, max(512 MiB, min(TextureCacheBudget, heapBudget / 4)) 1 of 3 1 of 3 - budget at its cap (about 2.1 GiB); the two that collapsed peaked at 9,903 and 9,906 of 10,240 MiB card use (nvidia-smi, all processes), 585 and 669 allocations recovered after VK_ERROR_OUT_OF_DEVICE_MEMORY, host placements on both paths
#8672 at 74b001a9cc 2 of 3 2 of 3 - at the floor; its reclaim line prints 54-1,047 times per run; the device tier's retained peak is 1,108-1,121 of 1,120 MiB, as in the plain runs (1,115-1,120)
#8672 + my local change 2 of 3 1 of 3 - at the floor

So the rule before #7071 kept the budget at its cap in all 6 runs and ran out of device memory in gameplay in 2 of them (it was changed because it did that at a level load). None of these changes prevents the collapse in every run.

78 runs from 2026-10-21 to 10-23; the table shows the 56 that ran to their end on these trees. Left out: 17 that stopped at frame 1,580, before the scene (7 plain, one of them fell; 3 with #7833; 7 with #9400, one fell), and 5 on this base plus #8608 and #8887 (one fell; the 3 at +250 MiB stayed clean). No run had an allocation failure that wasn't recovered. Level loads in all 78: no host placement, and recovered failures in 4 runs (1, 1, 1 and 3, the 3 in a run of the rule before #7071).

Earlier runs. On our bases from 2026-10-17 to 10-20, with #7071, 0 of 32 runs into this scene collapsed. Those scripts pressed the prompt and drove on, 22 of the 32 to frames 4,166-4,839; their lowest storage budget per run was 1,164-2,260 MiB and the heap budget about 8.8-9.0 GB. Our profiling script (perf sampling, longer stays in the scene) collapsed in 7 of 17 on the same bases. On 2026-10-21 the heap budget was 8,490-8,634 MiB in runs that fell and 8,779-8,868 MiB in clean ones. On 27c88a8d75 at -250 MiB, the two clean runs in the table above have other use of 3,154 and 3,258-3,310 MiB at frames 1,429-1,434, close to the old runs' 2.7-3.2 GB; the two that fell, 4,594 and 4,612-4,717 MiB at frames 1,425-1,435. Whether a change between those bases contributes is not bisected.

Setup. Linux 7.2.10 (CachyOS), RTX 3080 10 GB (one device-local heap), driver 615.78.08, Ryzen 9 7950X3D, 64 GB, Release builds, 3840x2160, warm shader cache from one seed, APS5_PROFILE_DRAW=1, APS5_TRACE_SUMMARY_EVERY=60. Base: main 27c88a8d75 plus three open PRs our 007 runs carry (#6868 at aa8f734907, #5372 at 0ccc15d0af, #6918 at 955e7c3c78), none of which touches the texture budgets or the buffer pool; plus the headroom diagnostic in every tree of the table and local logging in the trees with my local change; scripted input, and the title's two feedback-wait limits widened in its executable as described in #6172 (local only). #8672 was cherry-picked with one conflict in storageBudget() resolved by hand. The runs never press the prompt, so each stays in that scene until its end.

Open. What makes up the growth in other use is not measured: no counter splits the heap's use into the caches' own retained or still-referenced bytes and the rest. Such a split would let the budget tell its own leftovers from outside use; the rule before #7071 shows that a cap ignoring use ran out of device memory in 2 of 6 runs here.

Related: #7071 (mine), #7862 (the formula's sampled term, merged 2026-10-20), #7870 (the image share, merged 2026-10-20), #8672, #7833, #6194 (budget growth), #5961 and #6099 (storage images cycling through the cache in other titles), #5998 (retained storage images in the recorder budget), #8748 (device buffers placed in host memory kept for reuse).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5992621405 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/10041). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-23T05:45:31Z. --- **What happens.** In 007 First Light (PPSA11386) on an RTX 3080 10 GB, the storage image cache budget, which my #7071 made follow the heap's use, falls to its 512 MiB floor in early gameplay in 28 of the 56 runs below, 10-24 times in each of them (a lower bound: the `[gpu]` budget line prints only when a budget moves by more than a tenth, at most every 10 s). At those lines 338-1,204 MiB of the heap budget is still free (plain runs; the heap budget as the texture budgets see it, 250 or 500 MiB below the driver's where the diagnostic below is set). Of those 56, the 33 that collapsed (as defined below) reached frames 1,574-1,785 by their 1,500 s end, except one, which collapsed by the uncached rule only and reached 2,141; the 23 clean ones reached 2,101-2,279 (frames: presents plus dropped frames, from the `[present]` lines); the prompt scene after Bond's fall starts at about frame 1,600. #7071's own measurements already showed this budget at its floor after the level entry (present 1298), and its debt entry names re-creation at each use as the cost. This report is about how often that happens in gameplay, and what changes it. **The budget.** `StorageTextureBudget` (`ShaderResources.cpp`, `main` 27c88a8d75) is 7/8 of the device-local heap budget B minus the heap's use other than the cached storage images, between a 512 MiB floor and a cap of B/4 (or `TextureCacheBudget`, 2,560 MiB on this card, if smaller); unchanged on current `main` 0db47b263d (2026-10-23). Since the use is sampled textures alive + cached storage + other use, cached storage plus other use stays near 7/8 B minus sampled alive whenever the formula binds, in every run; the runs differ in other use. In one run that fell, from frame 1,398 to 1,435 cached storage went from 1,460 to 572 MiB and other use from 3,869 to 4,717 MiB, while use stayed at 7,311-7,516 MiB. No counter tells whether that growth is storage images the cache let go that are still alive, memory retained for reuse, or other allocations that pushed the cache out. Two parts are measured: - With a local change of mine (not posted) that counts storage images the cache let go as storage until they are destroyed, their bytes were 0 MiB at 96 of 104 floor lines (at most 235 MiB at the rest); their 10 s peaks in gameplay were 428-1,592 MiB per run, as high in clean runs as in runs that fell. - The buffer pool's device tier (`DeviceBudget` in `BufferPool.cpp`, an eighth of the heap budget, 1,120 MiB here, with an image share of 280 MiB) held 0.8-1.1 GB at these lines in both kinds of run. With that tier off no run reached the floor (lowest budget 631, 712 and 2,106 MiB), though two of the three still collapsed by the uncached rule below. The `[gpu]` lines at the same frame and headroom (diagnostic at -250 MiB), a run that fell against one that didn't, MiB, other use = use - sampled alive - cached storage: | run | frame | heap budget (as the texture budgets see it) | use | free | sampled alive (cached) | cached storage | other use | storage budget | |---|---|---|---|---|---|---|---|---| | fell | 1435 | 8,398 | 7,475 | 923 | 2,186 (2,042) | 572 | 4,717 | 512 (floor; formula 445) | | stayed | 1434 | 8,466 | 7,507 | 959 | 2,315 (2,048) | 1,882 | 3,310 | 1,783 | | fell | 1425 | 8,357 | 7,725 | 632 | 2,423 (2,039) | 708 | 4,594 | 512 (floor; formula 295) | | stayed | 1429 | 8,461 | 7,107 | 1,354 | 2,012 (2,012) | 1,941 | 3,154 | 2,115 (cap) | **What we tried.** Each run 1,500 s from launch; gameplay starts at 405-416 s. A run counts as collapsed when a `[gpu]` line at frame 1,400 or later shows the storage budget at its floor, or when the sampled-texture cache's 10 s lines from frame 1,650 counted textures used uncached 3 times in a row reaching frame 1,700, or 8 times in a row. Headroom is a local diagnostic that lowers the heap budget only the two texture budgets see (and #8672's ceiling where it is in the tree); real VRAM is unchanged; "default" means it is unset. | variant | default headroom | -250 MiB | -500 MiB | note | |---|---|---|---|---| | plain | 5 of 5 | 9 of 14 | 1 of 2 | all at the floor | | my local change above | 2 of 2 | - | 1 of 2 | the -500 one by the uncached rule, lowest budget 650 MiB | | #7870's image share off (`APS5_IMAGE_POOL_MIB=0`) | - | 2 of 3 | - | at the floor | | device tier off (`APS5_STAGING_POOL_MIB=0`) | - | 2 of 3 | - | uncached rule only, lowest budget 631 and 712 MiB | | #7833 at 79146e64f0 | - | 1 of 3 | 0 of 2 | the one with device memory full | | #7833 + my local change | - | - | 1 of 2 | device memory full | | the rule before #7071, `max(512 MiB, min(TextureCacheBudget, heapBudget / 4))` | 1 of 3 | 1 of 3 | - | budget at its cap (about 2.1 GiB); the two that collapsed peaked at 9,903 and 9,906 of 10,240 MiB card use (nvidia-smi, all processes), 585 and 669 allocations recovered after `VK_ERROR_OUT_OF_DEVICE_MEMORY`, host placements on both paths | | #8672 at 74b001a9cc | 2 of 3 | 2 of 3 | - | at the floor; its reclaim line prints 54-1,047 times per run; the device tier's retained peak is 1,108-1,121 of 1,120 MiB, as in the plain runs (1,115-1,120) | | #8672 + my local change | 2 of 3 | 1 of 3 | - | at the floor | So the rule before #7071 kept the budget at its cap in all 6 runs and ran out of device memory in gameplay in 2 of them (it was changed because it did that at a level load). None of these changes prevents the collapse in every run. 78 runs from 2026-10-21 to 10-23; the table shows the 56 that ran to their end on these trees. Left out: 17 that stopped at frame 1,580, before the scene (7 plain, one of them fell; 3 with #7833; 7 with #9400, one fell), and 5 on this base plus #8608 and #8887 (one fell; the 3 at +250 MiB stayed clean). No run had an allocation failure that wasn't recovered. Level loads in all 78: no host placement, and recovered failures in 4 runs (1, 1, 1 and 3, the 3 in a run of the rule before #7071). **Earlier runs.** On our bases from 2026-10-17 to 10-20, with #7071, 0 of 32 runs into this scene collapsed. Those scripts pressed the prompt and drove on, 22 of the 32 to frames 4,166-4,839; their lowest storage budget per run was 1,164-2,260 MiB and the heap budget about 8.8-9.0 GB. Our profiling script (perf sampling, longer stays in the scene) collapsed in 7 of 17 on the same bases. On 2026-10-21 the heap budget was 8,490-8,634 MiB in runs that fell and 8,779-8,868 MiB in clean ones. On 27c88a8d75 at -250 MiB, the two clean runs in the table above have other use of 3,154 and 3,258-3,310 MiB at frames 1,429-1,434, close to the old runs' 2.7-3.2 GB; the two that fell, 4,594 and 4,612-4,717 MiB at frames 1,425-1,435. Whether a change between those bases contributes is not bisected. **Setup.** Linux 7.2.10 (CachyOS), RTX 3080 10 GB (one device-local heap), driver 615.78.08, Ryzen 9 7950X3D, 64 GB, Release builds, 3840x2160, warm shader cache from one seed, `APS5_PROFILE_DRAW=1`, `APS5_TRACE_SUMMARY_EVERY=60`. Base: `main` 27c88a8d75 plus three open PRs our 007 runs carry (#6868 at aa8f734907, #5372 at 0ccc15d0af, #6918 at 955e7c3c78), none of which touches the texture budgets or the buffer pool; plus the headroom diagnostic in every tree of the table and local logging in the trees with my local change; scripted input, and the title's two feedback-wait limits widened in its executable as described in #6172 (local only). #8672 was cherry-picked with one conflict in `storageBudget()` resolved by hand. The runs never press the prompt, so each stays in that scene until its end. **Open.** What makes up the growth in other use is not measured: no counter splits the heap's use into the caches' own retained or still-referenced bytes and the rest. Such a split would let the budget tell its own leftovers from outside use; the rule before #7071 shows that a cap ignoring use ran out of device memory in 2 of 6 runs here. Related: #7071 (mine), #7862 (the formula's sampled term, merged 2026-10-20), #7870 (the image share, merged 2026-10-20), #8672, #7833, #6194 (budget growth), #5961 and #6099 (storage images cycling through the cache in other titles), #5998 (retained storage images in the recorder budget), #8748 (device buffers placed in host memory kept for reuse). AI-assisted: yes (Claude Code)
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#10041
No description provided.