AGC: the draw cache retains shader results outside its byte budget (GTA V, PPSA04264) #23485

Closed
opened 2026-11-19 04:37:49 +00:00 by lgqdaxia · 0 comments
lgqdaxia commented 2026-11-19 04:37:49 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by lgqdaxia on 2026-11-19T04:37:49Z.


What happens

After loading a GTA V Story save and leaving Michael standing in the same room, process private commit keeps increasing. With the default draw-cache budget, the cache reached 65,536 entries and reported zero byte-budget evictions. A run using a smaller draw-cache budget showed materially less host-heap growth in the same scene.

Title, test or build step

Grand Theft Auto V (PS5), PPSA04264 01.011.001, Story, Performance mode. A 38.4% manual save loads into Michael's front hall.

AnyPS5 commit

866864a5bc8ef8d90d28b5c3cd5a0c8e67ea4c90 for the game observations. The draw-cache budget A/B used the same revision with a local allocation sampler in libSceAgcDriver.

System

Windows 11 Pro build 26300, Intel Core i7-12700H, 32 GiB RAM, NVIDIA GeForce RTX 3080 Laptop GPU, NVIDIA driver 621.14, Vulkan 1.4.357, MinGW-w64 GCC 15.2.0.

Host report

AnyPS5 host report (format 1), selected fields
commit: 866864a5bc8e
[system]
os: Windows 10.0.26300
cpu: 12th Gen Intel(R) Core(TM) i7-12700H
cpu_threads: 20
memory_mib: 32472
[gpu]
device: NVIDIA GeForce RTX 3080 Laptop GPU
vulkan_api: 1.4.357
driver_info: 621.14
device_local_mib: 8016

Steps to reproduce

  1. Start the relinked game with a warm shader cache. Enter Story and load a manual save in Michael's home. The first run used APS5_HEAP_CACHE_MIB=512 and APS5_TRACE_MEMORY_BUDGET=1. Automatic screenshots were disabled.
  2. When Michael is controllable in the hall, record process private bytes as the starting point. Leave him in place with no further input for about six and a half minutes.
  3. To isolate the draw cache, repeat with APS5_PIPELINE_JOURNAL_THREADS=0, APS5_HEAP_CACHE_MIB=128, APS5_TEXTURE_CACHE_MIB=1536, and APS5_TRACE_DRAW_CACHE=1. Compare the default 256 MiB draw-cache budget with APS5_DRAW_CACHE_BYTES=67108864, keeping those settings and the room the same.

Log

Run Elapsed in the hall Private commit at start Private commit at sample Increase
Main, default draw budget 6 min 29 s 16.88 GiB 19.64 GiB 2.76 GiB
Main, background pipeline rebuild disabled 6 min 37 s 16.48 GiB 19.05 GiB 2.57 GiB
Draw-cache A/B, default 256 MiB 104 s 15.35 GiB 16.83 GiB 1.49 GiB
Draw-cache A/B, 64 MiB 103 s 15.53 GiB 16.34 GiB 0.81 GiB

The local memory guard ended the first run when system commit headroom fell to 3.94 GiB. In the draw-cache A/B, Windows heap snapshots showed about 1,101 MiB of growth with the default cap and 372 MiB with the smaller cap. The smaller cap caused byte-budget evictions with roughly 25,000–26,000 entries resident. The arms advanced about 808 and 990 presents, respectively, during those samples.

The draw-cache log recorded these ten-second windows.

256 MiB: [draw-cache] 10 s: ... 65536 entries, 4373 evicted (0 over the byte budget)
 64 MiB: [draw-cache] 10 s: ... 24731 entries, 5420 evicted (5420 over the byte budget)

What was checked

#9129 introduced a byte budget for the draw variants and documented the entry data it excludes. After #16234, a result copied and patched from a masked-memo donor bypasses the exact result memo. A cached draw variant can then keep that result and its descriptor data alive beyond its original use. The draw-cache byte estimate currently omits the retained result metadata. More entries can accumulate after #21467 raised the entry cap.

An ordinary cache eviction releases its reference to the shader result. Private commit covers the entire process. The draw-cache accounting explains part of the growth. Dedicated GPU memory was also growing, with sampled textures the largest category in the original Vulkan accounting.

In a longer replay with an earlier local accounting patch, the draw cache reported byte-budget evictions in all 21 ten-second windows between 6 min 39 s and 10 min 11 s. The number of resident draw entries varied between 24,073 and 30,028. During that interval the process still gained 598 MiB of private commit, Windows heap allocations gained 152 MiB and dedicated GPU memory gained 239 MiB. These accounting views may overlap. This report targets the draw-cache budget gap within the broader memory growth.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6482499513 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/23485). Originally posted by [lgqdaxia](https://github.com/lgqdaxia) on 2026-11-19T04:37:49Z. --- ### What happens After loading a GTA V Story save and leaving Michael standing in the same room, process private commit keeps increasing. With the default draw-cache budget, the cache reached 65,536 entries and reported zero byte-budget evictions. A run using a smaller draw-cache budget showed materially less host-heap growth in the same scene. ### Title, test or build step Grand Theft Auto V (PS5), `PPSA04264 01.011.001`, Story, Performance mode. A 38.4% manual save loads into Michael's front hall. ### AnyPS5 commit `866864a5bc8ef8d90d28b5c3cd5a0c8e67ea4c90` for the game observations. The draw-cache budget A/B used the same revision with a local allocation sampler in `libSceAgcDriver`. ### System Windows 11 Pro build 26300, Intel Core i7-12700H, 32 GiB RAM, NVIDIA GeForce RTX 3080 Laptop GPU, NVIDIA driver 621.14, Vulkan 1.4.357, MinGW-w64 GCC 15.2.0. ### Host report ```text AnyPS5 host report (format 1), selected fields commit: 866864a5bc8e [system] os: Windows 10.0.26300 cpu: 12th Gen Intel(R) Core(TM) i7-12700H cpu_threads: 20 memory_mib: 32472 [gpu] device: NVIDIA GeForce RTX 3080 Laptop GPU vulkan_api: 1.4.357 driver_info: 621.14 device_local_mib: 8016 ``` ### Steps to reproduce 1. Start the relinked game with a warm shader cache. Enter Story and load a manual save in Michael's home. The first run used `APS5_HEAP_CACHE_MIB=512` and `APS5_TRACE_MEMORY_BUDGET=1`. Automatic screenshots were disabled. 2. When Michael is controllable in the hall, record process private bytes as the starting point. Leave him in place with no further input for about six and a half minutes. 3. To isolate the draw cache, repeat with `APS5_PIPELINE_JOURNAL_THREADS=0`, `APS5_HEAP_CACHE_MIB=128`, `APS5_TEXTURE_CACHE_MIB=1536`, and `APS5_TRACE_DRAW_CACHE=1`. Compare the default 256 MiB draw-cache budget with `APS5_DRAW_CACHE_BYTES=67108864`, keeping those settings and the room the same. ### Log | Run | Elapsed in the hall | Private commit at start | Private commit at sample | Increase | | --- | ---: | ---: | ---: | ---: | | Main, default draw budget | 6 min 29 s | 16.88 GiB | 19.64 GiB | 2.76 GiB | | Main, background pipeline rebuild disabled | 6 min 37 s | 16.48 GiB | 19.05 GiB | 2.57 GiB | | Draw-cache A/B, default 256 MiB | 104 s | 15.35 GiB | 16.83 GiB | 1.49 GiB | | Draw-cache A/B, 64 MiB | 103 s | 15.53 GiB | 16.34 GiB | 0.81 GiB | The local memory guard ended the first run when system commit headroom fell to 3.94 GiB. In the draw-cache A/B, Windows heap snapshots showed about 1,101 MiB of growth with the default cap and 372 MiB with the smaller cap. The smaller cap caused byte-budget evictions with roughly 25,000–26,000 entries resident. The arms advanced about 808 and 990 presents, respectively, during those samples. The draw-cache log recorded these ten-second windows. ```text 256 MiB: [draw-cache] 10 s: ... 65536 entries, 4373 evicted (0 over the byte budget) 64 MiB: [draw-cache] 10 s: ... 24731 entries, 5420 evicted (5420 over the byte budget) ``` ### What was checked [#9129](https://github.com/boykopovar/AnyPS5/pull/9129) introduced a byte budget for the draw variants and documented the entry data it excludes. After [#16234](https://github.com/boykopovar/AnyPS5/pull/16234), a result copied and patched from a masked-memo donor bypasses the exact result memo. A cached draw variant can then keep that result and its descriptor data alive beyond its original use. The draw-cache byte estimate currently omits the retained result metadata. More entries can accumulate after [#21467](https://github.com/boykopovar/AnyPS5/pull/21467) raised the entry cap. An ordinary cache eviction releases its reference to the shader result. Private commit covers the entire process. The draw-cache accounting explains part of the growth. Dedicated GPU memory was also growing, with sampled textures the largest category in the original Vulkan accounting. In a longer replay with an earlier local accounting patch, the draw cache reported byte-budget evictions in all 21 ten-second windows between 6 min 39 s and 10 min 11 s. The number of resident draw entries varied between 24,073 and 30,028. During that interval the process still gained 598 MiB of private commit, Windows heap allocations gained 152 MiB and dedicated GPU memory gained 239 MiB. These accounting views may overlap. This report targets the draw-cache budget gap within the broader memory growth.
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#23485
No description provided.