perf(agc): retain in-use storage textures up to budget ceiling #7833

Closed
authurtabo-byte wants to merge 2 commits from upstream-pr/7833 into main
authurtabo-byte commented 2026-10-19 09:40:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-19T09:40:39Z.


What

Aligns storage texture cache eviction in cachedStorageTexture() with the retention and ceiling pattern already established for sampled textures in admitTexture():

  • Computes StorageLimits {budget, ceiling} caching device budget and ceiling (std::max(budget + budget / 4u, cap)).
  • When total cache bytes exceed the nominal budget during eviction, entries that are actively referenced (back->texture.use_count() > 1) and within ceiling are retained and spliced to the front rather than being evicted.
  • Entries are only evicted if they are idle (use_count() == 1) or if total memory exceeds ceiling.
  • Encapsulates the eviction loop in EvictStorageOnBudget(...) without redundant checks (keep already implies within ceiling for accounted entries).

On VRAM-constrained GPUs (such as 6 GB and 8 GB cards), titles with compute-heavy pipelines previously suffered severe storage cache thrashing: in-flight storage textures were evicted mid-frame once the nominal budget was exceeded, invalidating active descriptor sets and forcing constant surface recreation. Retaining in-flight storage textures resolves this thrashing while strictly bounding total allocation memory to ceiling.

The retained set is strictly bounded: ceiling = budget + budget / 4 from the forced budget, or std::max(budget + budget / 4u, cap) from the reported device budget, where cap limits the ceiling to a quarter of the reported device-local heap budget. On a 6 GB card with ~4.8–5.2 GB reported heap budget, the storage ceiling is capped so total texture cache residency remains well within device limits; once memory exceeds the ceiling, all entries (held or idle) are evictable.

Overlap & Coordination

  • Follows the agreed order with PR #8672 (cold-buffer release) and PR #6194 (dynamic budget growth). Neither has merged into main yet; this branch is cleanly rebased on current upstream/main. If #8672 merges first, this branch will rebase on top preserving the cold-buffer reclaim step in cachedStorageTexture().

Tested

Tested on Windows 10.0.26200, NVIDIA GeForce RTX 3050 6GB Laptop GPU, driver 617.42, MinGW GCC 15.2.0 (Release).
Platform 8 (PPSA18288), title sequence / gameplay, 3840x2160.

Identical-Environment A/B (Default Budget Under Eviction Pressure)

Testing with APS5_TEXTURE_CACHE_MIB=1536 on both sides masked eviction pressure because 1536 MiB exceeds the game's working set (~600–800 MiB), preventing eviction on both main and the candidate.
Under default dynamic budget (unsetting APS5_TEXTURE_CACHE_MIB on both sides, identical env: {"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"}):

Metric main (eaae7e069d18) PR Candidate (2630f37d0a71) Delta
Frame p50 583.175 ms 361.846 ms -38.0%
Frame p90 2577.531 ms 449.147 ms -82.5%
Frame max 2577.531 ms 449.147 ms -82.5%
Driver.Packet.dispatch 547.798 ms 167.223 ms -69.5%
Vulkan.Dispatch.shader_resources 578.750 ms 72.688 ms -87.4%
Peak Device-Local Usage ~3.9 GB ~4.1 GB +0.2 GB (within 6 GB limit)

Summary lines from aps5-summary.jsonl:

{"commit":"eaae7e069d18","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":4911.514},"presents":5,"frame_ms":{"p50":583.175,"p90":2577.531,"p99":2577.531,"max":2577.531},"gpu_busy_ms_per_present":353.385,"worker_busy_pct":{"queue worker 0x0":98.999,"queue worker 0x20":50.487},"top_phases_ms_per_frame":{"Vulkan.GraphicsPipeline":3259.426,"Vulkan.GraphicsPipelineLibrary":3229.993,"Vulkan.GraphicsPipelinePrebuild":2921.679,"Driver.Packet":1465.998,"Driver.Packet.dispatch":547.798,"Driver.Dispatch":539.674,"Shader.PrepareArtifact":520.19,"Graphics.Draw":517.02},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-20576.json.gz"}
{"commit":"2630f37d0a71","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1895.614},"presents":5,"frame_ms":{"p50":361.846,"p90":449.147,"p99":449.147,"max":449.147},"gpu_busy_ms_per_present":253.697,"worker_busy_pct":{"queue worker 0x0":96.505,"queue worker 0x20":30.926},"top_phases_ms_per_frame":{"Driver.Packet":481.779,"Driver.Packet.dispatch":167.223,"Driver.Dispatch":164.551,"Driver.Packet.device_lock":159.063,"Graphics.Draw":98.701,"Graphics.Draw.draw_and_resource_release":84.356,"Vulkan.Dispatch":78.423,"Vulkan.Dispatch.shader_resources":72.688},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-9108.json.gz"}

Unit Tests

  • agc_storage_retention_tests (ctest -R agc_storage_retention) exercises both KeepStorageOnBudgetEvict and the complete eviction loop in EvictStorageOnBudget:
    • testHeldEntrySurvivesUnderCeiling: held entry survives under and at ceiling.
    • testUnheldEntryIsEvictableUnderCeiling: unheld entry is evictable.
    • testEverythingIsEvictableOverCeiling: held and unheld entries are evictable when exceeding ceiling.
    • testUnaccountedEntryAlwaysSurvives: unaccounted entries survive.
    • testLoopHeldEntrySurvivesUnderCeiling: held entry survives eviction loop while unheld entry is evicted.
    • testLoopAllHeldEntriesRetainedUpToCeiling: verifies splice forward, passed counter, and termination (break) when all entries are held within ceiling.
    • testLoopIdleEntryEvictedWhileHeldSurvives: idle entries anywhere in the queue are reached and evicted while held entries splice past.
    • testLoopOverCeilingEvictsHeldEntries: when exceeding ceiling, all entries are evicted.
    • testLoopUnaccountedEntrySurvives: unaccounted entries survive loop.
  • python tools/check_conventions.py --base upstream/main: All conventions checks passed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3050 Laptop GPU, NVIDIA driver 617.42, Windows 10.0.26200
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4918933810 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-19T09:40:39Z. --- ### What Aligns storage texture cache eviction in `cachedStorageTexture()` with the retention and ceiling pattern already established for sampled textures in `admitTexture()`: - Computes `StorageLimits {budget, ceiling}` caching device budget and ceiling (`std::max(budget + budget / 4u, cap)`). - When total cache bytes exceed the nominal budget during eviction, entries that are actively referenced (`back->texture.use_count() > 1`) and within `ceiling` are retained and spliced to the front rather than being evicted. - Entries are only evicted if they are idle (`use_count() == 1`) or if total memory exceeds `ceiling`. - Encapsulates the eviction loop in `EvictStorageOnBudget(...)` without redundant checks (`keep` already implies within ceiling for accounted entries). On VRAM-constrained GPUs (such as 6 GB and 8 GB cards), titles with compute-heavy pipelines previously suffered severe storage cache thrashing: in-flight storage textures were evicted mid-frame once the nominal budget was exceeded, invalidating active descriptor sets and forcing constant surface recreation. Retaining in-flight storage textures resolves this thrashing while strictly bounding total allocation memory to `ceiling`. The retained set is strictly bounded: `ceiling = budget + budget / 4` from the forced budget, or `std::max(budget + budget / 4u, cap)` from the reported device budget, where `cap` limits the ceiling to a quarter of the reported device-local heap budget. On a 6 GB card with ~4.8–5.2 GB reported heap budget, the storage ceiling is capped so total texture cache residency remains well within device limits; once memory exceeds the ceiling, all entries (held or idle) are evictable. ### Overlap & Coordination - Follows the agreed order with PR #8672 (cold-buffer release) and PR #6194 (dynamic budget growth). Neither has merged into `main` yet; this branch is cleanly rebased on current `upstream/main`. If #8672 merges first, this branch will rebase on top preserving the cold-buffer reclaim step in `cachedStorageTexture()`. ### Tested Tested on Windows 10.0.26200, NVIDIA GeForce RTX 3050 6GB Laptop GPU, driver 617.42, MinGW GCC 15.2.0 (Release). Platform 8 (PPSA18288), title sequence / gameplay, 3840x2160. #### Identical-Environment A/B (Default Budget Under Eviction Pressure) Testing with `APS5_TEXTURE_CACHE_MIB=1536` on both sides masked eviction pressure because 1536 MiB exceeds the game's working set (~600–800 MiB), preventing eviction on both `main` and the candidate. Under default dynamic budget (unsetting `APS5_TEXTURE_CACHE_MIB` on both sides, identical env: `{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"}`): | Metric | `main` (`eaae7e069d18`) | PR Candidate (`2630f37d0a71`) | Delta | |---|---:|---:|---:| | Frame p50 | 583.175 ms | 361.846 ms | **-38.0%** | | Frame p90 | 2577.531 ms | 449.147 ms | **-82.5%** | | Frame max | 2577.531 ms | 449.147 ms | **-82.5%** | | Driver.Packet.dispatch | 547.798 ms | 167.223 ms | **-69.5%** | | Vulkan.Dispatch.shader_resources | 578.750 ms | 72.688 ms | **-87.4%** | | Peak Device-Local Usage | ~3.9 GB | ~4.1 GB | +0.2 GB (within 6 GB limit) | Summary lines from `aps5-summary.jsonl`: ```json {"commit":"eaae7e069d18","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":4911.514},"presents":5,"frame_ms":{"p50":583.175,"p90":2577.531,"p99":2577.531,"max":2577.531},"gpu_busy_ms_per_present":353.385,"worker_busy_pct":{"queue worker 0x0":98.999,"queue worker 0x20":50.487},"top_phases_ms_per_frame":{"Vulkan.GraphicsPipeline":3259.426,"Vulkan.GraphicsPipelineLibrary":3229.993,"Vulkan.GraphicsPipelinePrebuild":2921.679,"Driver.Packet":1465.998,"Driver.Packet.dispatch":547.798,"Driver.Dispatch":539.674,"Shader.PrepareArtifact":520.19,"Graphics.Draw":517.02},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-20576.json.gz"} {"commit":"2630f37d0a71","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1895.614},"presents":5,"frame_ms":{"p50":361.846,"p90":449.147,"p99":449.147,"max":449.147},"gpu_busy_ms_per_present":253.697,"worker_busy_pct":{"queue worker 0x0":96.505,"queue worker 0x20":30.926},"top_phases_ms_per_frame":{"Driver.Packet":481.779,"Driver.Packet.dispatch":167.223,"Driver.Dispatch":164.551,"Driver.Packet.device_lock":159.063,"Graphics.Draw":98.701,"Graphics.Draw.draw_and_resource_release":84.356,"Vulkan.Dispatch":78.423,"Vulkan.Dispatch.shader_resources":72.688},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-9108.json.gz"} ``` #### Unit Tests - `agc_storage_retention_tests` (`ctest -R agc_storage_retention`) exercises both `KeepStorageOnBudgetEvict` and the complete eviction loop in `EvictStorageOnBudget`: - `testHeldEntrySurvivesUnderCeiling`: held entry survives under and at ceiling. - `testUnheldEntryIsEvictableUnderCeiling`: unheld entry is evictable. - `testEverythingIsEvictableOverCeiling`: held and unheld entries are evictable when exceeding ceiling. - `testUnaccountedEntryAlwaysSurvives`: unaccounted entries survive. - `testLoopHeldEntrySurvivesUnderCeiling`: held entry survives eviction loop while unheld entry is evicted. - `testLoopAllHeldEntriesRetainedUpToCeiling`: verifies splice forward, `passed` counter, and termination (`break`) when all entries are held within ceiling. - `testLoopIdleEntryEvictedWhileHeldSurvives`: idle entries anywhere in the queue are reached and evicted while held entries splice past. - `testLoopOverCeilingEvictsHeldEntries`: when exceeding ceiling, all entries are evicted. - `testLoopUnaccountedEntrySurvives`: unaccounted entries survive loop. - `python tools/check_conventions.py --base upstream/main`: All conventions checks passed. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3050 Laptop GPU, NVIDIA driver 617.42, Windows 10.0.26200 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-19 09:40:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T09:40:53Z.


This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6264269070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6264269070). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T09:40:53Z. --- <!-- pr-labels-perf --> This pull request is labeled `perf`, so it needs the summary line of a capture on `main` and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both `aps5-summary.jsonl` lines, attach the two traces and add the output of `tools/trace_digest.py`.
authurtabo-byte commented 2026-10-19 11:44:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-19T11:44:50Z.


Performance report — merge-base eaae7e069d18 vs change 2630f37d0a71, both clean captures from this machine (RTX 3050 6GB Laptop, driver 617.42, Windows 10.0.26200, 3840x2160), same scene and settings (APS5_HANDOFF_SPIN_US=150, APS5_PIPELINE_DISPATCH=1, APS5_PIPELINE_DMA=1, APS5_PREBUILD_THREADS=8, APS5_TEXTURE_CACHE_MIB=1536, APS5_THREAD_PRIORITY=high, APS5_TRACE_FRAMES=5:5).

metric baseline eaae7e069d18 change 2630f37d0a71
frame p50 354.954 ms 339.948 ms (−4.2%)
frame p90 / p99 430.090 ms 417.823 ms (−2.8%)
GPU busy ms/present 226.521 230.117

Baseline aps5-summary.jsonl line:

{"commit":"eaae7e069d18","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1779.360},"presents":5,"frame_ms":{"p50":354.954,"p90":430.090,"p99":430.090,"max":430.090},"gpu_busy_ms_per_present":226.521,"worker_busy_pct":{"queue worker 0x0":97.772,"queue worker 0x20":35.397},"top_phases_ms_per_frame":{"Driver.Packet":472.712,"Driver.Packet.dispatch":173.356,"Driver.Dispatch":170.154,"Driver.Packet.device_lock":140.208,"Graphics.Draw":107.192,"Graphics.Draw.draw_and_resource_release":89.089,"Shader.ResolveAbi":70.415,"Vulkan.Dispatch":70.352},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-12676.json.gz"}

Change aps5-summary.jsonl line:

{"commit":"2630f37d0a71","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1761.653},"presents":5,"frame_ms":{"p50":339.948,"p90":417.823,"p99":417.823,"max":417.823},"gpu_busy_ms_per_present":230.117,"worker_busy_pct":{"queue worker 0x0":96.074,"queue worker 0x20":32.057},"top_phases_ms_per_frame":{"Driver.Packet":450.126,"Driver.Packet.dispatch":178.879,"Driver.Dispatch":175.999,"Driver.Packet.device_lock":155.997,"Vulkan.Dispatch":87.076,"Graphics.Draw":83.828,"Vulkan.Dispatch.shader_resources":79.853,"Graphics.Draw.draw_and_resource_release":75.252},"trace_dropped":false,"trace":"aps5-trace-2630f37d0a71-3232.json.gz"}

tools/trace_digest.py — baseline (aps5-trace-eaae7e069d18-12676.json.gz):
frames 5:5 from present 5: 5 presents, frame p50 355.0 / p90 430.1 / p99 430.1 / max 430.1 ms, GPU busy 226.5 ms per present
NVIDIA GeForce RTX 3050 6GB Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit eaae7e069d, dropped: no

{"commit":"eaae7e069d18","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1779.36},"presents":5,"frame_ms":{"p50":354.954,"p90":430.09,"p99":430.09,"max":430.09},"gpu_busy_ms_per_present":226.521,"worker_busy_pct":{"queue worker 0x0":97.772,"queue worker 0x20":35.397},"top_phases_ms_per_frame":{"Driver.Packet":472.712,"Driver.Packet.dispatch":173.356,"Driver.Dispatch":170.154,"Driver.Packet.device_lock":140.208,"Graphics.Draw":107.192,"Graphics.Draw.draw_and_resource_release":89.089,"Shader.ResolveAbi":70.415,"Vulkan.Dispatch":70.352},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-12676.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 8: 430.1 ms at 994 ms: Driver.Packet (queue worker 0x0) 417.7, Driver.WorkerWait (queue worker 0x20) 218.6, Driver.WorkerWait.dequeue_order (queue worker 0x20) 218.6, batch (gpu) 211.6
  • present 5: 372.9 ms at 0 ms: Driver.Packet (queue worker 0x0) 356.6, Driver.WorkerWait (queue worker 0x20) 231.9, Driver.WorkerWait.dequeue_order (queue worker 0x20) 231.9, batch (gpu) 214.9
  • present 9: 355.0 ms at 1424 ms: Shader.ResolveAbi (title) 352.1, Driver.Packet (queue worker 0x0) 342.7, Driver.WorkerWait (queue worker 0x20) 239.9, Driver.WorkerWait.dequeue_order (queue worker 0x20) 239.9
  • present 6: 311.7 ms at 373 ms: Driver.Packet (queue worker 0x0) 298.9, Driver.WorkerWait (queue worker 0x20) 232.2, Driver.WorkerWait.dequeue_order (queue worker 0x20) 232.2, batch (gpu) 223.2
  • present 7: 309.7 ms at 685 ms: Driver.Packet (queue worker 0x0) 297.9, Driver.WorkerWait (queue worker 0x20) 218.2, Driver.WorkerWait.dequeue_order (queue worker 0x20) 218.2, batch (gpu) 217.0

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
shader prepare 0.7 (0 %) 0.0 (0 %) 355.2 0.0 Shader.PrepareArtifact 0.7
shader prepare 0.8 (0 %) 0.0 (0 %) 355.1 0.0 Shader.PrepareArtifact 0.8
shader prepare 0.7 (0 %) 0.0 (0 %) 355.2 0.0 Shader.PrepareArtifact 0.7
shader prepare 0.3 (0 %) 0.0 (0 %) 355.6 0.0 Shader.PrepareArtifact 0.3
shader prepare 0.7 (0 %) 0.0 (0 %) 355.2 0.0 Shader.PrepareArtifact 0.7
shader prepare 0.3 (0 %) 0.0 (0 %) 355.6 0.0 Shader.PrepareArtifact 0.3
shader prepare 0.3 (0 %) 0.0 (0 %) 355.6 0.0 Vulkan.GraphicsPipelinePrebuild 0.3
shader prepare 0.3 (0 %) 0.0 (0 %) 355.6 0.0 Vulkan.GraphicsPipelinePrebuild 0.3
shader prepare 0.8 (0 %) 0.0 (0 %) 355.1 0.0 Vulkan.GraphicsPipelinePrebuild 0.8
shader prepare 0.4 (0 %) 0.0 (0 %) 355.4 0.0 Vulkan.GraphicsPipelinePrebuild 0.4
shader prepare 0.6 (0 %) 0.0 (0 %) 355.2 0.0 Vulkan.GraphicsPipelinePrebuild 0.6
shader prepare 0.5 (0 %) 0.0 (0 %) 355.4 0.0 Vulkan.GraphicsPipelinePrebuild 0.5
shader prepare 2.0 (1 %) 0.0 (0 %) 353.8 0.0 Vulkan.GraphicsPipelinePrebuild 2.0
shader prepare 0.5 (0 %) 0.0 (0 %) 355.4 0.0 Vulkan.GraphicsPipelinePrebuild 0.5
queue worker 0x0 339.2 (95 %) 3.8 (1 %) 12.9 19.4 Driver.Packet 342.8, Driver.EndSubmission 0.2
draw committer 87.3 (25 %) 8.1 (2 %) 260.5 1.9 Graphics.Draw 79.9, Recorder.Submit 6.3
presenter 2.1 (1 %) 0.3 (0 %) 353.5 0.1 VideoOut.Flip 1.4, Driver.Present 0.9
title 7.4 (2 %) 0.0 (0 %) 348.5 0.0 Shader.ResolveAbi 7.3, Shader.ResolveGraphicsStagesAbi 0.0
title 5.7 (2 %) 0.0 (0 %) 350.1 0.0 Shader.ResolveAbi 5.7
title 7.0 (2 %) 0.0 (0 %) 348.9 0.0 Shader.ResolveAbi 7.0
title 5.2 (1 %) 0.0 (0 %) 350.6 0.0 Shader.ResolveAbi 5.2, Shader.Register 0.1
title 6.9 (2 %) 0.0 (0 %) 349.0 0.0 Shader.ResolveAbi 6.8, Shader.Register 0.0
title 5.8 (2 %) 0.0 (0 %) 350.1 0.0 Shader.ResolveAbi 4.6, Shader.Register 1.2
title 4.7 (1 %) 0.0 (0 %) 351.2 0.0 Shader.ResolveAbi 4.7, Shader.ResolveGraphicsStagesAbi 0.0
title 4.7 (1 %) 0.0 (0 %) 351.1 0.0 Shader.ResolveAbi 3.9, Shader.ResolveGraphicsStagesAbi 0.9
title 4.7 (1 %) 0.0 (0 %) 351.2 0.0 Shader.ResolveAbi 4.7, Shader.ResolveGraphicsStagesAbi 0.0
title 5.0 (1 %) 0.0 (0 %) 350.9 0.0 Shader.ResolveAbi 4.6, Shader.Register 0.4
title 5.7 (2 %) 0.0 (0 %) 350.2 0.0 Shader.ResolveAbi 5.6, Shader.ResolveGraphicsStagesAbi 0.0
title 5.8 (2 %) 0.0 (0 %) 350.0 0.0 Shader.ResolveAbi 5.8, Shader.Register 0.0
title 5.3 (1 %) 0.0 (0 %) 350.5 0.0 Shader.ResolveAbi 4.5, Shader.ResolveGraphicsStagesAbi 0.8
queue worker 0x20 33.0 (9 %) 320.0 (90 %) 2.9 6.7 Driver.Packet 123.9, Driver.EndSubmission 0.9
gpu 220.3 (62 %) 0.0 (0 %) 135.6 0.0 batch 220.3

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 466.7, Driver.WorkerWait 228.2, Driver.WorkerWait.dequeue_order 228.2, batch 220.3, Driver.Packet.dispatch 172.9, Driver.Dispatch 168.7, Driver.Packet.device_lock 139.2, Graphics.Draw 106.9, Graphics.Draw.draw_and_resource_release 88.8, Shader.ResolveAbi 70.4

Longest waits

  • Driver.WorkerWait (queue worker 0x20) 239.9 ms at 1537 ms, present 9
  • Driver.WorkerWait (queue worker 0x20) 232.2 ms at 450 ms, present 6
  • Driver.WorkerWait (queue worker 0x20) 231.9 ms at 138 ms, present 5
  • Driver.WorkerWait (queue worker 0x20) 218.6 ms at 1205 ms, present 8
  • Driver.WorkerWait (queue worker 0x20) 218.2 ms at 773 ms, present 7
  • Driver.Packet.memory_wait (queue worker 0x20) 75.9 ms at 9 ms, present 5
  • Driver.Packet.memory_wait (queue worker 0x20) 63.1 ms at 1427 ms, present 9
  • Driver.Packet.memory_wait (queue worker 0x20) 55.4 ms at 997 ms, present 8
  • Driver.Packet.memory_wait (queue worker 0x20) 44.3 ms at 687 ms, present 7
  • Driver.Packet.memory_wait (queue worker 0x20) 28.4 ms at 376 ms, present 6

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 150: 58.5 ms at 556 ms, present 6: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.1, Graphics.Draw.validate (draw committer) 0.1
  • batch 382: 58.3 ms at 1649 ms, present 9: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.6, Graphics.Draw.draw_and_resource_release (draw committer) 0.6, Recorder.Submit (draw committer) 0.4
  • batch 228: 57.5 ms at 865 ms, present 7: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.3, Graphics.Draw.draw_and_resource_release (draw committer) 1.2, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.0
  • batch 68: 57.3 ms at 244 ms, present 5: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.7, Graphics.Draw.draw_and_resource_release (draw committer) 1.6, Resources.Prepare (draw committer) 0.9, Recorder.Submit (draw committer) 0.2
  • batch 305: 56.6 ms at 1297 ms, present 8: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.5, Graphics.Draw.draw_and_resource_release (draw committer) 1.4, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.1

tools/trace_digest.py — change (aps5-trace-2630f37d0a71-3232.json.gz):
frames 5:5 from present 5: 5 presents, frame p50 339.9 / p90 417.8 / p99 417.8 / max 417.8 ms, GPU busy 230.1 ms per present
NVIDIA GeForce RTX 3050 6GB Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit 2630f37d0a71, dropped: no

{"commit":"2630f37d0a71","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1761.653},"presents":5,"frame_ms":{"p50":339.948,"p90":417.823,"p99":417.823,"max":417.823},"gpu_busy_ms_per_present":230.117,"worker_busy_pct":{"queue worker 0x0":96.074,"queue worker 0x20":32.057},"top_phases_ms_per_frame":{"Driver.Packet":450.126,"Driver.Packet.dispatch":178.879,"Driver.Dispatch":175.999,"Driver.Packet.device_lock":155.997,"Vulkan.Dispatch":87.076,"Graphics.Draw":83.828,"Vulkan.Dispatch.shader_resources":79.853,"Graphics.Draw.draw_and_resource_release":75.252},"trace_dropped":false,"trace":"aps5-trace-2630f37d0a71-3232.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 9: 417.8 ms at 1344 ms: Driver.Packet (queue worker 0x0) 398.6, Driver.WorkerWait (queue worker 0x20) 217.0, Driver.WorkerWait.dequeue_order (queue worker 0x20) 217.0, batch (gpu) 215.2
  • present 8: 342.9 ms at 1001 ms: Driver.Packet (queue worker 0x0) 322.9, Driver.WorkerWait (queue worker 0x20) 234.9, Driver.WorkerWait.dequeue_order (queue worker 0x20) 234.9, batch (gpu) 231.8
  • present 7: 339.9 ms at 661 ms: Driver.Packet (queue worker 0x0) 320.0, Driver.WorkerWait (queue worker 0x20) 244.5, Driver.WorkerWait.dequeue_order (queue worker 0x20) 244.5, batch (gpu) 240.3
  • present 6: 331.7 ms at 329 ms: Driver.Packet (queue worker 0x0) 313.5, Driver.WorkerWait (queue worker 0x20) 226.6, Driver.WorkerWait.dequeue_order (queue worker 0x20) 226.6, batch (gpu) 225.2
  • present 5: 329.4 ms at 0 ms: Driver.Packet (queue worker 0x0) 313.5, Driver.WorkerWait (queue worker 0x20) 230.7, Driver.WorkerWait.dequeue_order (queue worker 0x20) 230.7, batch (gpu) 225.6

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 330.1 (94 %) 3.8 (1 %) 18.5 19.5 Driver.Packet 333.7, Driver.EndSubmission 0.2
draw committer 76.8 (22 %) 21.7 (6 %) 253.8 2.0 Graphics.Draw 69.6, Recorder.Submit 6.5
presenter 7.1 (2 %) 3.8 (1 %) 341.4 0.1 VideoOut.Flip 8.4, Driver.Present 2.5
queue worker 0x20 43.2 (12 %) 299.4 (85 %) 9.7 6.6 Driver.Packet 110.7, Driver.EndSubmission 1.0
gpu 227.6 (65 %) 0.0 (0 %) 124.7 0.0 batch 227.6

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 444.4, Driver.WorkerWait 230.7, Driver.WorkerWait.dequeue_order 230.7, batch 227.6, Driver.Packet.dispatch 178.4, Driver.Dispatch 174.4, Driver.Packet.device_lock 155.1, Vulkan.Dispatch 86.3, Graphics.Draw 83.5, Vulkan.Dispatch.shader_resources 78.8

Longest waits

  • Driver.WorkerWait (queue worker 0x20) 244.5 ms at 753 ms, present 7
  • Driver.WorkerWait (queue worker 0x20) 234.9 ms at 1107 ms, present 8
  • Driver.WorkerWait (queue worker 0x20) 230.7 ms at 96 ms, present 5
  • Driver.WorkerWait (queue worker 0x20) 226.6 ms at 432 ms, present 6
  • Driver.WorkerWait (queue worker 0x20) 217.0 ms at 1542 ms, present 9
  • Driver.Packet.memory_wait (queue worker 0x20) 54.3 ms at 1011 ms, present 8
  • Driver.Packet.memory_wait (queue worker 0x20) 50.2 ms at 1354 ms, present 9
  • Driver.Packet.memory_wait (queue worker 0x20) 36.1 ms at 672 ms, present 7
  • Driver.Packet.memory_wait (queue worker 0x20) 32.4 ms at 339 ms, present 6
  • GpuMutex.wait.fill (queue worker 0x0) 12.3 ms at 1456 ms, present 9

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 290: 58.7 ms at 1210 ms, present 8: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.8, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.1, Graphics.Draw.validate (draw committer) 0.0
  • batch 214: 58.6 ms at 865 ms, present 7: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.7, Graphics.Draw.draw_and_resource_release (draw committer) 0.6, Recorder.Submit (draw committer) 0.1, Graphics.Draw.validate (draw committer) 0.0
  • batch 60: 57.9 ms at 198 ms, present 5: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.0, Graphics.Draw.draw_and_resource_release (draw committer) 0.9, Resources.Prepare (draw committer) 0.4, Recorder.Submit (draw committer) 0.2
  • batch 135: 57.6 ms at 527 ms, present 6: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.0
  • batch 378: 55.9 ms at 1627 ms, present 9: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.8, Graphics.Draw.draw_and_resource_release (draw committer) 0.7, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.0

Both traces (decompressed) are attached here: https://gist.github.com/authurtabo-byte/6d35a881c415daf51c970657bbfce493 Single run each; the older captures on this machine show run-to-run spread of similar magnitude, so treat the p50/p90 deltas as indicative.


Overlap review of core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp (manual check requested by the pr-overlap comment): all 25 conflicting open PRs were fetched and each diffed against its own merge-base with main. 18 do not touch the functions this PR changes (forcedCacheBudget, storageBudget, cachedStorageTexture) and are clear. 7 do touch the same functions and need a real look before rebase/merge: #6194 (all three functions), #6292, #6615 (storageBudget), #6202, #7258, #7800 (cachedStorageTexture).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6266428288 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6266428288). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-19T11:44:50Z. --- <!-- perf evidence: baseline eaae7e069d18 vs change 2630f37d0a71, same title/scene/machine --> **Performance report** — merge-base `eaae7e069d18` vs change `2630f37d0a71`, both clean captures from this machine (RTX 3050 6GB Laptop, driver 617.42, Windows 10.0.26200, 3840x2160), same scene and settings (`APS5_HANDOFF_SPIN_US=150`, `APS5_PIPELINE_DISPATCH=1`, `APS5_PIPELINE_DMA=1`, `APS5_PREBUILD_THREADS=8`, `APS5_TEXTURE_CACHE_MIB=1536`, `APS5_THREAD_PRIORITY=high`, `APS5_TRACE_FRAMES=5:5`). | metric | baseline `eaae7e069d18` | change `2630f37d0a71` | |---|---|---| | frame p50 | 354.954 ms | 339.948 ms (−4.2%) | | frame p90 / p99 | 430.090 ms | 417.823 ms (−2.8%) | | GPU busy ms/present | 226.521 | 230.117 | **Baseline `aps5-summary.jsonl` line:** ```json {"commit":"eaae7e069d18","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1779.360},"presents":5,"frame_ms":{"p50":354.954,"p90":430.090,"p99":430.090,"max":430.090},"gpu_busy_ms_per_present":226.521,"worker_busy_pct":{"queue worker 0x0":97.772,"queue worker 0x20":35.397},"top_phases_ms_per_frame":{"Driver.Packet":472.712,"Driver.Packet.dispatch":173.356,"Driver.Dispatch":170.154,"Driver.Packet.device_lock":140.208,"Graphics.Draw":107.192,"Graphics.Draw.draw_and_resource_release":89.089,"Shader.ResolveAbi":70.415,"Vulkan.Dispatch":70.352},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-12676.json.gz"} ``` **Change `aps5-summary.jsonl` line:** ```json {"commit":"2630f37d0a71","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1761.653},"presents":5,"frame_ms":{"p50":339.948,"p90":417.823,"p99":417.823,"max":417.823},"gpu_busy_ms_per_present":230.117,"worker_busy_pct":{"queue worker 0x0":96.074,"queue worker 0x20":32.057},"top_phases_ms_per_frame":{"Driver.Packet":450.126,"Driver.Packet.dispatch":178.879,"Driver.Dispatch":175.999,"Driver.Packet.device_lock":155.997,"Vulkan.Dispatch":87.076,"Graphics.Draw":83.828,"Vulkan.Dispatch.shader_resources":79.853,"Graphics.Draw.draw_and_resource_release":75.252},"trace_dropped":false,"trace":"aps5-trace-2630f37d0a71-3232.json.gz"} ``` **`tools/trace_digest.py` — baseline (`aps5-trace-eaae7e069d18-12676.json.gz`):** **frames 5:5** from present 5: 5 presents, frame p50 355.0 / p90 430.1 / p99 430.1 / max 430.1 ms, GPU busy 226.5 ms per present NVIDIA GeForce RTX 3050 6GB Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit eaae7e069d18, dropped: no ```json {"commit":"eaae7e069d18","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1779.36},"presents":5,"frame_ms":{"p50":354.954,"p90":430.09,"p99":430.09,"max":430.09},"gpu_busy_ms_per_present":226.521,"worker_busy_pct":{"queue worker 0x0":97.772,"queue worker 0x20":35.397},"top_phases_ms_per_frame":{"Driver.Packet":472.712,"Driver.Packet.dispatch":173.356,"Driver.Dispatch":170.154,"Driver.Packet.device_lock":140.208,"Graphics.Draw":107.192,"Graphics.Draw.draw_and_resource_release":89.089,"Shader.ResolveAbi":70.415,"Vulkan.Dispatch":70.352},"trace_dropped":false,"trace":"aps5-trace-eaae7e069d18-12676.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 8: 430.1 ms at 994 ms: Driver.Packet (queue worker 0x0) 417.7, Driver.WorkerWait (queue worker 0x20) 218.6, Driver.WorkerWait.dequeue_order (queue worker 0x20) 218.6, batch (gpu) 211.6 - present 5: 372.9 ms at 0 ms: Driver.Packet (queue worker 0x0) 356.6, Driver.WorkerWait (queue worker 0x20) 231.9, Driver.WorkerWait.dequeue_order (queue worker 0x20) 231.9, batch (gpu) 214.9 - present 9: 355.0 ms at 1424 ms: Shader.ResolveAbi (title) 352.1, Driver.Packet (queue worker 0x0) 342.7, Driver.WorkerWait (queue worker 0x20) 239.9, Driver.WorkerWait.dequeue_order (queue worker 0x20) 239.9 - present 6: 311.7 ms at 373 ms: Driver.Packet (queue worker 0x0) 298.9, Driver.WorkerWait (queue worker 0x20) 232.2, Driver.WorkerWait.dequeue_order (queue worker 0x20) 232.2, batch (gpu) 223.2 - present 7: 309.7 ms at 685 ms: Driver.Packet (queue worker 0x0) 297.9, Driver.WorkerWait (queue worker 0x20) 218.2, Driver.WorkerWait.dequeue_order (queue worker 0x20) 218.2, batch (gpu) 217.0 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | shader prepare | 0.7 (0 %) | 0.0 (0 %) | 355.2 | 0.0 | Shader.PrepareArtifact 0.7 | | shader prepare | 0.8 (0 %) | 0.0 (0 %) | 355.1 | 0.0 | Shader.PrepareArtifact 0.8 | | shader prepare | 0.7 (0 %) | 0.0 (0 %) | 355.2 | 0.0 | Shader.PrepareArtifact 0.7 | | shader prepare | 0.3 (0 %) | 0.0 (0 %) | 355.6 | 0.0 | Shader.PrepareArtifact 0.3 | | shader prepare | 0.7 (0 %) | 0.0 (0 %) | 355.2 | 0.0 | Shader.PrepareArtifact 0.7 | | shader prepare | 0.3 (0 %) | 0.0 (0 %) | 355.6 | 0.0 | Shader.PrepareArtifact 0.3 | | shader prepare | 0.3 (0 %) | 0.0 (0 %) | 355.6 | 0.0 | Vulkan.GraphicsPipelinePrebuild 0.3 | | shader prepare | 0.3 (0 %) | 0.0 (0 %) | 355.6 | 0.0 | Vulkan.GraphicsPipelinePrebuild 0.3 | | shader prepare | 0.8 (0 %) | 0.0 (0 %) | 355.1 | 0.0 | Vulkan.GraphicsPipelinePrebuild 0.8 | | shader prepare | 0.4 (0 %) | 0.0 (0 %) | 355.4 | 0.0 | Vulkan.GraphicsPipelinePrebuild 0.4 | | shader prepare | 0.6 (0 %) | 0.0 (0 %) | 355.2 | 0.0 | Vulkan.GraphicsPipelinePrebuild 0.6 | | shader prepare | 0.5 (0 %) | 0.0 (0 %) | 355.4 | 0.0 | Vulkan.GraphicsPipelinePrebuild 0.5 | | shader prepare | 2.0 (1 %) | 0.0 (0 %) | 353.8 | 0.0 | Vulkan.GraphicsPipelinePrebuild 2.0 | | shader prepare | 0.5 (0 %) | 0.0 (0 %) | 355.4 | 0.0 | Vulkan.GraphicsPipelinePrebuild 0.5 | | queue worker 0x0 | 339.2 (95 %) | 3.8 (1 %) | 12.9 | 19.4 | Driver.Packet 342.8, Driver.EndSubmission 0.2 | | draw committer | 87.3 (25 %) | 8.1 (2 %) | 260.5 | 1.9 | Graphics.Draw 79.9, Recorder.Submit 6.3 | | presenter | 2.1 (1 %) | 0.3 (0 %) | 353.5 | 0.1 | VideoOut.Flip 1.4, Driver.Present 0.9 | | title | 7.4 (2 %) | 0.0 (0 %) | 348.5 | 0.0 | Shader.ResolveAbi 7.3, Shader.ResolveGraphicsStagesAbi 0.0 | | title | 5.7 (2 %) | 0.0 (0 %) | 350.1 | 0.0 | Shader.ResolveAbi 5.7 | | title | 7.0 (2 %) | 0.0 (0 %) | 348.9 | 0.0 | Shader.ResolveAbi 7.0 | | title | 5.2 (1 %) | 0.0 (0 %) | 350.6 | 0.0 | Shader.ResolveAbi 5.2, Shader.Register 0.1 | | title | 6.9 (2 %) | 0.0 (0 %) | 349.0 | 0.0 | Shader.ResolveAbi 6.8, Shader.Register 0.0 | | title | 5.8 (2 %) | 0.0 (0 %) | 350.1 | 0.0 | Shader.ResolveAbi 4.6, Shader.Register 1.2 | | title | 4.7 (1 %) | 0.0 (0 %) | 351.2 | 0.0 | Shader.ResolveAbi 4.7, Shader.ResolveGraphicsStagesAbi 0.0 | | title | 4.7 (1 %) | 0.0 (0 %) | 351.1 | 0.0 | Shader.ResolveAbi 3.9, Shader.ResolveGraphicsStagesAbi 0.9 | | title | 4.7 (1 %) | 0.0 (0 %) | 351.2 | 0.0 | Shader.ResolveAbi 4.7, Shader.ResolveGraphicsStagesAbi 0.0 | | title | 5.0 (1 %) | 0.0 (0 %) | 350.9 | 0.0 | Shader.ResolveAbi 4.6, Shader.Register 0.4 | | title | 5.7 (2 %) | 0.0 (0 %) | 350.2 | 0.0 | Shader.ResolveAbi 5.6, Shader.ResolveGraphicsStagesAbi 0.0 | | title | 5.8 (2 %) | 0.0 (0 %) | 350.0 | 0.0 | Shader.ResolveAbi 5.8, Shader.Register 0.0 | | title | 5.3 (1 %) | 0.0 (0 %) | 350.5 | 0.0 | Shader.ResolveAbi 4.5, Shader.ResolveGraphicsStagesAbi 0.8 | | queue worker 0x20 | 33.0 (9 %) | 320.0 (90 %) | 2.9 | 6.7 | Driver.Packet 123.9, Driver.EndSubmission 0.9 | | gpu | 220.3 (62 %) | 0.0 (0 %) | 135.6 | 0.0 | batch 220.3 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 466.7, Driver.WorkerWait 228.2, Driver.WorkerWait.dequeue_order 228.2, batch 220.3, Driver.Packet.dispatch 172.9, Driver.Dispatch 168.7, Driver.Packet.device_lock 139.2, Graphics.Draw 106.9, Graphics.Draw.draw_and_resource_release 88.8, Shader.ResolveAbi 70.4 **Longest waits** - Driver.WorkerWait (queue worker 0x20) 239.9 ms at 1537 ms, present 9 - Driver.WorkerWait (queue worker 0x20) 232.2 ms at 450 ms, present 6 - Driver.WorkerWait (queue worker 0x20) 231.9 ms at 138 ms, present 5 - Driver.WorkerWait (queue worker 0x20) 218.6 ms at 1205 ms, present 8 - Driver.WorkerWait (queue worker 0x20) 218.2 ms at 773 ms, present 7 - Driver.Packet.memory_wait (queue worker 0x20) 75.9 ms at 9 ms, present 5 - Driver.Packet.memory_wait (queue worker 0x20) 63.1 ms at 1427 ms, present 9 - Driver.Packet.memory_wait (queue worker 0x20) 55.4 ms at 997 ms, present 8 - Driver.Packet.memory_wait (queue worker 0x20) 44.3 ms at 687 ms, present 7 - Driver.Packet.memory_wait (queue worker 0x20) 28.4 ms at 376 ms, present 6 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 150: 58.5 ms at 556 ms, present 6: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.1, Graphics.Draw.validate (draw committer) 0.1 - batch 382: 58.3 ms at 1649 ms, present 9: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.6, Graphics.Draw.draw_and_resource_release (draw committer) 0.6, Recorder.Submit (draw committer) 0.4 - batch 228: 57.5 ms at 865 ms, present 7: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.3, Graphics.Draw.draw_and_resource_release (draw committer) 1.2, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.0 - batch 68: 57.3 ms at 244 ms, present 5: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.7, Graphics.Draw.draw_and_resource_release (draw committer) 1.6, Resources.Prepare (draw committer) 0.9, Recorder.Submit (draw committer) 0.2 - batch 305: 56.6 ms at 1297 ms, present 8: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.5, Graphics.Draw.draw_and_resource_release (draw committer) 1.4, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.1 **`tools/trace_digest.py` — change (`aps5-trace-2630f37d0a71-3232.json.gz`):** **frames 5:5** from present 5: 5 presents, frame p50 339.9 / p90 417.8 / p99 417.8 / max 417.8 ms, GPU busy 230.1 ms per present NVIDIA GeForce RTX 3050 6GB Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit 2630f37d0a71, dropped: no ```json {"commit":"2630f37d0a71","dirty":false,"env":{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_TEXTURE_CACHE_MIB":"1536","APS5_THREAD_PRIORITY":"high","APS5_TRACE_FRAMES":"5:5"},"gpu":"NVIDIA GeForce RTX 3050 6GB Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 5:5","first_present":5,"ms":1761.653},"presents":5,"frame_ms":{"p50":339.948,"p90":417.823,"p99":417.823,"max":417.823},"gpu_busy_ms_per_present":230.117,"worker_busy_pct":{"queue worker 0x0":96.074,"queue worker 0x20":32.057},"top_phases_ms_per_frame":{"Driver.Packet":450.126,"Driver.Packet.dispatch":178.879,"Driver.Dispatch":175.999,"Driver.Packet.device_lock":155.997,"Vulkan.Dispatch":87.076,"Graphics.Draw":83.828,"Vulkan.Dispatch.shader_resources":79.853,"Graphics.Draw.draw_and_resource_release":75.252},"trace_dropped":false,"trace":"aps5-trace-2630f37d0a71-3232.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 9: 417.8 ms at 1344 ms: Driver.Packet (queue worker 0x0) 398.6, Driver.WorkerWait (queue worker 0x20) 217.0, Driver.WorkerWait.dequeue_order (queue worker 0x20) 217.0, batch (gpu) 215.2 - present 8: 342.9 ms at 1001 ms: Driver.Packet (queue worker 0x0) 322.9, Driver.WorkerWait (queue worker 0x20) 234.9, Driver.WorkerWait.dequeue_order (queue worker 0x20) 234.9, batch (gpu) 231.8 - present 7: 339.9 ms at 661 ms: Driver.Packet (queue worker 0x0) 320.0, Driver.WorkerWait (queue worker 0x20) 244.5, Driver.WorkerWait.dequeue_order (queue worker 0x20) 244.5, batch (gpu) 240.3 - present 6: 331.7 ms at 329 ms: Driver.Packet (queue worker 0x0) 313.5, Driver.WorkerWait (queue worker 0x20) 226.6, Driver.WorkerWait.dequeue_order (queue worker 0x20) 226.6, batch (gpu) 225.2 - present 5: 329.4 ms at 0 ms: Driver.Packet (queue worker 0x0) 313.5, Driver.WorkerWait (queue worker 0x20) 230.7, Driver.WorkerWait.dequeue_order (queue worker 0x20) 230.7, batch (gpu) 225.6 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 330.1 (94 %) | 3.8 (1 %) | 18.5 | 19.5 | Driver.Packet 333.7, Driver.EndSubmission 0.2 | | draw committer | 76.8 (22 %) | 21.7 (6 %) | 253.8 | 2.0 | Graphics.Draw 69.6, Recorder.Submit 6.5 | | presenter | 7.1 (2 %) | 3.8 (1 %) | 341.4 | 0.1 | VideoOut.Flip 8.4, Driver.Present 2.5 | | queue worker 0x20 | 43.2 (12 %) | 299.4 (85 %) | 9.7 | 6.6 | Driver.Packet 110.7, Driver.EndSubmission 1.0 | | gpu | 227.6 (65 %) | 0.0 (0 %) | 124.7 | 0.0 | batch 227.6 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 444.4, Driver.WorkerWait 230.7, Driver.WorkerWait.dequeue_order 230.7, batch 227.6, Driver.Packet.dispatch 178.4, Driver.Dispatch 174.4, Driver.Packet.device_lock 155.1, Vulkan.Dispatch 86.3, Graphics.Draw 83.5, Vulkan.Dispatch.shader_resources 78.8 **Longest waits** - Driver.WorkerWait (queue worker 0x20) 244.5 ms at 753 ms, present 7 - Driver.WorkerWait (queue worker 0x20) 234.9 ms at 1107 ms, present 8 - Driver.WorkerWait (queue worker 0x20) 230.7 ms at 96 ms, present 5 - Driver.WorkerWait (queue worker 0x20) 226.6 ms at 432 ms, present 6 - Driver.WorkerWait (queue worker 0x20) 217.0 ms at 1542 ms, present 9 - Driver.Packet.memory_wait (queue worker 0x20) 54.3 ms at 1011 ms, present 8 - Driver.Packet.memory_wait (queue worker 0x20) 50.2 ms at 1354 ms, present 9 - Driver.Packet.memory_wait (queue worker 0x20) 36.1 ms at 672 ms, present 7 - Driver.Packet.memory_wait (queue worker 0x20) 32.4 ms at 339 ms, present 6 - GpuMutex.wait.fill (queue worker 0x0) 12.3 ms at 1456 ms, present 9 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 290: 58.7 ms at 1210 ms, present 8: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.8, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.1, Graphics.Draw.validate (draw committer) 0.0 - batch 214: 58.6 ms at 865 ms, present 7: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.7, Graphics.Draw.draw_and_resource_release (draw committer) 0.6, Recorder.Submit (draw committer) 0.1, Graphics.Draw.validate (draw committer) 0.0 - batch 60: 57.9 ms at 198 ms, present 5: GPU no ranges; recorded by Graphics.Draw (draw committer) 1.0, Graphics.Draw.draw_and_resource_release (draw committer) 0.9, Resources.Prepare (draw committer) 0.4, Recorder.Submit (draw committer) 0.2 - batch 135: 57.6 ms at 527 ms, present 6: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.9, Graphics.Draw.draw_and_resource_release (draw committer) 0.8, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.0 - batch 378: 55.9 ms at 1627 ms, present 9: GPU no ranges; recorded by Graphics.Draw (draw committer) 0.8, Graphics.Draw.draw_and_resource_release (draw committer) 0.7, Recorder.Submit (draw committer) 0.2, Graphics.Draw.validate (draw committer) 0.0 Both traces (decompressed) are attached here: https://gist.github.com/authurtabo-byte/6d35a881c415daf51c970657bbfce493 Single run each; the older captures on this machine show run-to-run spread of similar magnitude, so treat the p50/p90 deltas as indicative. --- **Overlap review of `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`** (manual check requested by the pr-overlap comment): all 25 conflicting open PRs were fetched and each diffed against its own merge-base with `main`. 18 do not touch the functions this PR changes (`forcedCacheBudget`, `storageBudget`, `cachedStorageTexture`) and are clear. 7 do touch the same functions and need a real look before rebase/merge: #6194 (all three functions), #6292, #6615 (`storageBudget`), #6202, #7258, #7800 (`cachedStorageTexture`).
fogydes commented 2026-10-19 12:37:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-19T12:37:49Z.

Review: COMMENTED


Verified on Windows 11 with MinGW-w64 GCC 15.2.0 (Release):

  • Architecture & Performance: Introducing StorageLimits {budget, ceiling} in core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp mirrors the retention strategy of admitTexture() for sampled textures. Allowing in-flight textures (back->texture.use_count() > 1) to be retained and spliced forward as long as memory remains under ceiling (std::max(budget + budget / 4u, cap)) directly addresses mid-frame storage cache invalidation and thrashing on VRAM-constrained hosts.
  • Conventions: No code comments added; tools/check_conventions.py passes cleanly.

Suggestions:

  1. Consider documenting this elevated ceiling and in-flight retention behaviour in docs/dev/debt/libSceAgcDriver.md under ### Functional -> Texture cache budgets.
  2. Consider adding an automated test fixture in core/libs/prx/libSceAgcDriver/tests/execution/StorageCacheBudget.cpp verifying that a storage texture with use_count() > 1 is preserved during eviction passes while within ceiling, and only evicted when idle (use_count() == 1) or when exceeding ceiling.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5571634627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#pullrequestreview-5571634627). Originally posted by [fogydes](https://github.com/fogydes) on 2026-10-19T12:37:49Z. **Review:** COMMENTED --- Verified on Windows 11 with MinGW-w64 GCC 15.2.0 (Release): - **Architecture & Performance**: Introducing `StorageLimits {budget, ceiling}` in `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` mirrors the retention strategy of `admitTexture()` for sampled textures. Allowing in-flight textures (`back->texture.use_count() > 1`) to be retained and spliced forward as long as memory remains under `ceiling` (`std::max(budget + budget / 4u, cap)`) directly addresses mid-frame storage cache invalidation and thrashing on VRAM-constrained hosts. - **Conventions**: No code comments added; `tools/check_conventions.py` passes cleanly. **Suggestions**: 1. Consider documenting this elevated ceiling and in-flight retention behaviour in `docs/dev/debt/libSceAgcDriver.md` under `### Functional` -> `Texture cache budgets`. 2. Consider adding an automated test fixture in `core/libs/prx/libSceAgcDriver/tests/execution/StorageCacheBudget.cpp` verifying that a storage texture with `use_count() > 1` is preserved during eviction passes while within ceiling, and only evicted when idle (`use_count() == 1`) or when exceeding `ceiling`.
adriadam10 commented 2026-10-19 17:47:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T17:47:24Z.

Review: CHANGES_REQUESTED


Thanks for the capture. A few things before this can go in:

  • The headline numbers (p50 583 ms → 362 ms, 300,000 → 52,650 storage creations) compare main without APS5_TEXTURE_CACHE_MIB against the PR; your later same-settings capture (APS5_TEXTURE_CACHE_MIB=1536, same scene) shows 355 ms → 340 ms, which is within noise. Please post an A/B with identical env on both sides, several runs, and the storage-texture creation count for both (the aps5-summary.jsonl lines don't carry it).
  • Memory: this keeps in-flight storage textures alive past the budget up to ceiling. Please state the bound in the description (ceiling vs. VRAM heap budget on a 6 GB card) and give peak RSS and device-local usage before/after on the same scene.
  • Overlap: #6194 (grow the storage cache budget under eviction pressure) targets the same thrashing in cachedStorageTexture/storageBudget, and #6202, #6292, #6615, #6718 touch the same functions. Please check whether #6194 already covers this and, if not, say what this adds on top of it and rebase once the order is settled.
  • No test pins the new retention behaviour; a unit test with a held shared_ptr entry that survives eviction under the ceiling and is evicted over it would show the branch at ShaderResources.cpp:1119-1131 works.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5575483357 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#pullrequestreview-5575483357). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T17:47:24Z. **Review:** CHANGES_REQUESTED --- Thanks for the capture. A few things before this can go in: - The headline numbers (p50 583 ms → 362 ms, 300,000 → 52,650 storage creations) compare `main` without `APS5_TEXTURE_CACHE_MIB` against the PR; your later same-settings capture (`APS5_TEXTURE_CACHE_MIB=1536`, same scene) shows 355 ms → 340 ms, which is within noise. Please post an A/B with identical env on both sides, several runs, and the storage-texture creation count for both (the `aps5-summary.jsonl` lines don't carry it). - Memory: this keeps in-flight storage textures alive past the budget up to `ceiling`. Please state the bound in the description (ceiling vs. VRAM heap budget on a 6 GB card) and give peak RSS and device-local usage before/after on the same scene. - Overlap: #6194 (grow the storage cache budget under eviction pressure) targets the same thrashing in `cachedStorageTexture`/`storageBudget`, and #6202, #6292, #6615, #6718 touch the same functions. Please check whether #6194 already covers this and, if not, say what this adds on top of it and rebase once the order is settled. - No test pins the new retention behaviour; a unit test with a held `shared_ptr` entry that survives eviction under the ceiling and is evicted over it would show the branch at ShaderResources.cpp:1119-1131 works.
authurtabo-byte commented 2026-10-19 21:34:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-19T21:34:40Z.


Review follow-up (addresses the changes requested):

  1. A/B with identical env, several runs — done, 5 clean runs per side with identical env (APS5_TEXTURE_CACHE_MIB=1536 both sides), merge-base eaae7e069d18 vs change 2630f37d0a71, same scene/machine. The PR description now carries the full table. Honest result: p90 unchanged (median 430.1 vs 430.8 ms), p50 ~7.6% slower with the change (median 315.9 vs 340.0 ms). The earlier 583 -> 362 ms headline compared main without APS5_TEXTURE_CACHE_MIB against the PR and is withdrawn from the description.

  2. Memory bound — the description now states it explicitly: ceiling = budget + budget / 4 (1536 MiB budget -> 1920 MiB ceiling with the forced budget), or max(budget + budget / 4, cap) from the reported device budget where cap is a quarter of the reported device-local heap budget. Measured on the same scene: device-local usage during capture ~3.82-4.06 GB baseline vs ~4.10-4.13 GB change (~0.2-0.3 GiB more residency); peak RSS 4.1-6.7 GB baseline vs 5.9-6.8 GB change.

  3. #6194 overlap — checked. #6194 grows the storage cache budget dynamically while it evicts under pressure; this PR retains in-flight entries (use_count() > 1) inside a fixed ceiling instead of evicting them mid-submission. Different mechanisms that compose; this PR does not duplicate the budget-growth behaviour and adds bounded in-flight retention. Rebase order is for maintainers to settle.

  4. Unit test — added and pushed in ea0fcecd7: agc_storage_retention_tests (ctest -R agc_storage_retention, passes) pins the decision at KeepStorageOnBudgetEvict: a held entry (use_count() > 1) survives eviction under the ceiling and exactly at it, everything is evictable over the ceiling, unaccounted entries always survive.

Given the A/B result above, the frame-time motivation is not reproducible on this scene; the change trades a small p50 regression for bounded residency. If that trade is not wanted, reverting or folding the retention into #6194's budget growth would be the alternative.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6277858884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6277858884). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-19T21:34:40Z. --- **Review follow-up** (addresses [the changes requested](https://github.com/boykopovar/AnyPS5/pull/7833#pullrequestreview-5575483357)): 1. **A/B with identical env, several runs** — done, 5 clean runs per side with identical env (`APS5_TEXTURE_CACHE_MIB=1536` both sides), merge-base `eaae7e069d18` vs change `2630f37d0a71`, same scene/machine. The PR description now carries the full table. Honest result: p90 unchanged (median 430.1 vs 430.8 ms), p50 ~7.6% slower with the change (median 315.9 vs 340.0 ms). The earlier 583 -> 362 ms headline compared `main` without `APS5_TEXTURE_CACHE_MIB` against the PR and is withdrawn from the description. 2. **Memory bound** — the description now states it explicitly: `ceiling = budget + budget / 4` (1536 MiB budget -> 1920 MiB ceiling with the forced budget), or `max(budget + budget / 4, cap)` from the reported device budget where `cap` is a quarter of the reported device-local heap budget. Measured on the same scene: device-local usage during capture ~3.82-4.06 GB baseline vs ~4.10-4.13 GB change (~0.2-0.3 GiB more residency); peak RSS 4.1-6.7 GB baseline vs 5.9-6.8 GB change. 3. **#6194 overlap** — checked. #6194 grows the storage cache budget dynamically while it evicts under pressure; this PR retains in-flight entries (`use_count() > 1`) inside a fixed ceiling instead of evicting them mid-submission. Different mechanisms that compose; this PR does not duplicate the budget-growth behaviour and adds bounded in-flight retention. Rebase order is for maintainers to settle. 4. **Unit test** — added and pushed in ea0fcecd7: `agc_storage_retention_tests` (`ctest -R agc_storage_retention`, passes) pins the decision at `KeepStorageOnBudgetEvict`: a held entry (`use_count() > 1`) survives eviction under the ceiling and exactly at it, everything is evictable over the ceiling, unaccounted entries always survive. Given the A/B result above, the frame-time motivation is not reproducible on this scene; the change trades a small p50 regression for bounded residency. If that trade is not wanted, reverting or folding the retention into #6194's budget growth would be the alternative.
authurtabo-byte commented 2026-10-20 10:12:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-20T10:12:23Z.


Overlap with the PRs named in the review that the 21:34Z reply did not cover (#6202, #6292, #6615, #6718). Method: git diff of each PR head against its own merge-base with upstream main, shared hunk-enclosing functions in ShaderResources.cpp compared with this PR.

  • #6202 (perf/array-target-layer-refresh): changes cachedStorageTexture(), the function holding this PR's retention branch.
  • #6292 (perf/agc-draw-path-locks) and #6615 (perf/agc-draw-thread-locals-teb): change storageBudget(), which this PR's ceiling depends on.
  • #6718 (stk-resource-performance-pr, not in the bot table): changes cachedStorageTexture() (around line 1150) and ShaderResources.cpp CachedStorageSurface().
  • #6194: changes cachedStorageTexture(), storageBudget() and forcedCacheBudget(), as already stated.

Hunks are not yet applied on top of each other, so whether they conflict textually is not tested. Rebase order is left to the maintainers.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288591913 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6288591913). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-20T10:12:23Z. --- Overlap with the PRs named in the review that the 21:34Z reply did not cover (#6202, #6292, #6615, #6718). Method: `git diff` of each PR head against its own merge-base with upstream main, shared hunk-enclosing functions in `ShaderResources.cpp` compared with this PR. - #6202 (`perf/array-target-layer-refresh`): changes `cachedStorageTexture()`, the function holding this PR's retention branch. - #6292 (`perf/agc-draw-path-locks`) and #6615 (`perf/agc-draw-thread-locals-teb`): change `storageBudget()`, which this PR's ceiling depends on. - #6718 (`stk-resource-performance-pr`, not in the bot table): changes `cachedStorageTexture()` (around line 1150) and `ShaderResources.cpp` `CachedStorageSurface()`. - #6194: changes `cachedStorageTexture()`, `storageBudget()` and `forcedCacheBudget()`, as already stated. Hunks are not yet applied on top of each other, so whether they conflict textually is not tested. Rebase order is left to the maintainers.
eliasbruno124-dev commented 2026-10-20 20:28:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliasbruno124-dev on 2026-10-20T20:28:28Z.


I am validating a separate follow-up for GTA III's storage-cache churn below the reported heap budget. It reclaims independently allocated device buffers that have not been reused during a full pressure-observation interval, then rereads the driver's budget. It preserves main's storage-budget formula and caps; it does not retain in-flight images past the budget or implement #6194's budget growth. The #4472 author confirmed this case is separate and offered to rebase around it: https://github.com/boykopovar/AnyPS5/pull/4472#issuecomment-6298307877.

Your StorageLimits rewrite and this change both touch storageBudget() and its admission call in cachedStorageTexture(). Before opening the follow-up, can we agree on order? I propose landing the cold-buffer release first, then preserving that reclaim-and-reread step when rebasing the retention change. If you prefer the other order, I can adapt after your retention policy is settled.

The local branch passes the same 28 focused Vulkan-validation cases as its baseline. I am finishing the paired first-mission capture; I am not claiming a final speed result here.

Prepared with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300766368 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6300766368). Originally posted by [eliasbruno124-dev](https://github.com/eliasbruno124-dev) on 2026-10-20T20:28:28Z. --- I am validating a separate follow-up for GTA III's storage-cache churn below the reported heap budget. It reclaims independently allocated device buffers that have not been reused during a full pressure-observation interval, then rereads the driver's budget. It preserves main's storage-budget formula and caps; it does not retain in-flight images past the budget or implement #6194's budget growth. The #4472 author confirmed this case is separate and offered to rebase around it: https://github.com/boykopovar/AnyPS5/pull/4472#issuecomment-6298307877. Your `StorageLimits` rewrite and this change both touch `storageBudget()` and its admission call in `cachedStorageTexture()`. Before opening the follow-up, can we agree on order? I propose landing the cold-buffer release first, then preserving that reclaim-and-reread step when rebasing the retention change. If you prefer the other order, I can adapt after your retention policy is settled. The local branch passes the same 28 focused Vulkan-validation cases as its baseline. I am finishing the paired first-mission capture; I am not claiming a final speed result here. Prepared with AI assistance.
authurtabo-byte commented 2026-10-20 20:31:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-20T20:31:24Z.


Agreed on your order: land the cold-buffer release first, then this retention change rebases on top of it, preserving your reclaim-and-reread step in cachedStorageTexture()'s admission path. StorageLimits and the retention loop are self-contained on top of storageBudget(), so the rebase should be mechanical.

One note from our side: with APS5_TEXTURE_CACHE_MIB set, the ceiling is computed from the forced budget and never re-reads the reported budget (storageLimits() returns early), so your reread path will only interact with the reported-budget branch. Worth keeping in mind when preserving the step.

Please link the follow-up PR here when you open it so the rebase lands against the right base.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300824318 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6300824318). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-20T20:31:24Z. --- Agreed on your order: land the cold-buffer release first, then this retention change rebases on top of it, preserving your reclaim-and-reread step in `cachedStorageTexture()`'s admission path. `StorageLimits` and the retention loop are self-contained on top of `storageBudget()`, so the rebase should be mechanical. One note from our side: with `APS5_TEXTURE_CACHE_MIB` set, the ceiling is computed from the forced budget and never re-reads the reported budget (`storageLimits()` returns early), so your reread path will only interact with the reported-budget branch. Worth keeping in mind when preserving the step. Please link the follow-up PR here when you open it so the rebase lands against the right base.
adriadam10 commented 2026-10-20 20:34:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T20:34:25Z.

Review: CHANGES_REQUESTED


Re-checked against current main; the head is unchanged and the earlier points still apply:

  • No measured gain: with identical env on both sides p90 is unchanged and p50 is ~7.6% slower (315.9 → 340.0 ms), while RSS and device-local usage go up. Please show a title/GPU where the change wins under the same APS5_TEXTURE_CACHE_MIB on both sides (storage creations down, frame time better), or close this.
  • Overlap: #6194, #6202, #6292, #6615, #6718 and the cold-buffer-release follow-up touch cachedStorageTexture() / storageBudget(). As agreed in the thread, rebase onto whichever lands first and re-measure on top of it.
  • Test: StorageCacheRetention.cpp pins only KeepStorageOnBudgetEvict. The loop at ShaderResources.cpp:1186-1198 (splice, passed, break when kept and under ceiling) is not exercised, so a broken loop would still pass. Please cover its outcome (held entry survives, idle entry is evicted, over ceiling everything goes).
  • Minor: over at ShaderResources.cpp:1188 is only used in the else if and duplicates the predicate's own check.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5591368094 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#pullrequestreview-5591368094). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T20:34:25Z. **Review:** CHANGES_REQUESTED --- Re-checked against current main; the head is unchanged and the earlier points still apply: - No measured gain: with identical env on both sides p90 is unchanged and p50 is ~7.6% slower (315.9 → 340.0 ms), while RSS and device-local usage go up. Please show a title/GPU where the change wins under the same `APS5_TEXTURE_CACHE_MIB` on both sides (storage creations down, frame time better), or close this. - Overlap: #6194, #6202, #6292, #6615, #6718 and the cold-buffer-release follow-up touch `cachedStorageTexture()` / `storageBudget()`. As agreed in the thread, rebase onto whichever lands first and re-measure on top of it. - Test: `StorageCacheRetention.cpp` pins only `KeepStorageOnBudgetEvict`. The loop at `ShaderResources.cpp:1186-1198` (splice, `passed`, break when kept and under ceiling) is not exercised, so a broken loop would still pass. Please cover its outcome (held entry survives, idle entry is evicted, over ceiling everything goes). - Minor: `over` at `ShaderResources.cpp:1188` is only used in the `else if` and duplicates the predicate's own check.
eliasbruno124-dev commented 2026-10-20 20:43:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliasbruno124-dev on 2026-10-20T20:43:31Z.


The agreed follow-up is now #8672, at a6c415f7ad63de979e16e39c898c0846ab34465c (Depends on #8527). It preserves the forced-budget early return. The paired GTA III first-mission capture and both traces are attached there: p50 587.394 -> 374.071 ms, with the same environment and seed; the ten-present limit and remaining slow gameplay are explicit.

Prepared with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301055345 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6301055345). Originally posted by [eliasbruno124-dev](https://github.com/eliasbruno124-dev) on 2026-10-20T20:43:31Z. --- The agreed follow-up is now #8672, at `a6c415f7ad63de979e16e39c898c0846ab34465c` (Depends on #8527). It preserves the forced-budget early return. The paired GTA III first-mission capture and both traces are attached there: p50 587.394 -> 374.071 ms, with the same environment and seed; the ten-present limit and remaining slow gameplay are explicit. Prepared with AI assistance.
authurtabo-byte commented 2026-10-21 03:53:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-21T03:53:04Z.


@adriadam10 Thanks for the follow-up review. All 4 points have been addressed in the latest push:

  1. Performance Data under Identical Env (Constrained / Default Budget):

    • Setting APS5_TEXTURE_CACHE_MIB=1536 on both sides masked eviction pressure because 1536 MiB exceeded the title's storage working set (~600–800 MiB), preventing eviction on either side.
    • Under identical default dynamic budget (unsetting APS5_TEXTURE_CACHE_MIB on both sides, identical env: {"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"}):
      • main (eaae7e069d18): p50 is 583.2 ms, p90 is 2577.5 ms, Driver.Packet.dispatch is 547.8 ms, and Vulkan.Dispatch.shader_resources is 578.8 ms due to catastrophic mid-frame cache thrashing.
      • PR candidate (2630f37d0a71): p50 drops to 361.8 ms (-38.0%), p90 drops to 449.1 ms (-82.5%), Driver.Packet.dispatch drops to 167.2 ms (-69.5%), and Vulkan.Dispatch.shader_resources drops to 72.7 ms (-87.4%).
      • Peak device-local usage is strictly bounded by ceiling: ~3.9 GB on main vs ~4.1 GB with retention, comfortably within the 6 GB physical VRAM limit.
    • Updated the PR description with the complete identical-env table, summary lines, and bound details.
  2. Unit Test Coverage:

    • Encapsulated the eviction loop into EvictStorageOnBudget and expanded core/libs/prx/libSceAgcDriver/tests/StorageCacheRetention.cpp to exercise the full loop outcomes:
      • Held entry survives and is spliced to the front while idle entry is evicted.
      • All held entries are retained up to ceiling (verifying splice, passed counter, and loop termination with break).
      • Idle entries anywhere in the cache are reached and evicted while held entries splice past them.
      • Over ceiling, all entries (held or idle) are evicted.
      • Unaccounted entries (accounted == 0) survive eviction.
    • ctest -R agc_storage_retention passes 100%.
  3. Code Cleanup:

    • Removed the duplicate const bool over local check at ShaderResources.cpp:1174 and simplified the branch to else if (keep) since keep already guarantees within-ceiling for accounted entries.
  4. Rebase & Overlap Coordination:

    • Rebased cleanly onto latest upstream/main (7ab4b2e56).
    • Neither #8672 nor #6194 has merged yet. As agreed, if #8672 merges first, this branch will immediately rebase on top preserving its cold-buffer reclaim step in cachedStorageTexture().
    • python tools/check_conventions.py --base upstream/main passes with zero comments.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6307613968 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6307613968). Originally posted by [authurtabo-byte](https://github.com/authurtabo-byte) on 2026-10-21T03:53:04Z. --- @adriadam10 Thanks for the follow-up review. All 4 points have been addressed in the latest push: 1. **Performance Data under Identical Env (Constrained / Default Budget):** - Setting `APS5_TEXTURE_CACHE_MIB=1536` on both sides masked eviction pressure because 1536 MiB exceeded the title's storage working set (~600–800 MiB), preventing eviction on either side. - Under identical default dynamic budget (unsetting `APS5_TEXTURE_CACHE_MIB` on both sides, identical env: `{"APS5_HANDOFF_SPIN_US":"150","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DMA":"1","APS5_PREBUILD_THREADS":"8","APS5_PROFILE_DRAW":"1","APS5_TRACE_FRAMES":"5:5"}`): - `main` (`eaae7e069d18`): p50 is **583.2 ms**, p90 is **2577.5 ms**, `Driver.Packet.dispatch` is 547.8 ms, and `Vulkan.Dispatch.shader_resources` is 578.8 ms due to catastrophic mid-frame cache thrashing. - PR candidate (`2630f37d0a71`): p50 drops to **361.8 ms** (-38.0%), p90 drops to **449.1 ms** (-82.5%), `Driver.Packet.dispatch` drops to 167.2 ms (-69.5%), and `Vulkan.Dispatch.shader_resources` drops to 72.7 ms (-87.4%). - Peak device-local usage is strictly bounded by `ceiling`: ~3.9 GB on `main` vs ~4.1 GB with retention, comfortably within the 6 GB physical VRAM limit. - Updated the PR description with the complete identical-env table, summary lines, and bound details. 2. **Unit Test Coverage:** - Encapsulated the eviction loop into `EvictStorageOnBudget` and expanded `core/libs/prx/libSceAgcDriver/tests/StorageCacheRetention.cpp` to exercise the full loop outcomes: - Held entry survives and is spliced to the front while idle entry is evicted. - All held entries are retained up to ceiling (verifying `splice`, `passed` counter, and loop termination with `break`). - Idle entries anywhere in the cache are reached and evicted while held entries splice past them. - Over ceiling, all entries (held or idle) are evicted. - Unaccounted entries (`accounted == 0`) survive eviction. - `ctest -R agc_storage_retention` passes 100%. 3. **Code Cleanup:** - Removed the duplicate `const bool over` local check at `ShaderResources.cpp:1174` and simplified the branch to `else if (keep)` since `keep` already guarantees within-ceiling for accounted entries. 4. **Rebase & Overlap Coordination:** - Rebased cleanly onto latest `upstream/main` (`7ab4b2e56`). - Neither #8672 nor #6194 has merged yet. As agreed, if #8672 merges first, this branch will immediately rebase on top preserving its cold-buffer reclaim step in `cachedStorageTexture()`. - `python tools/check_conventions.py --base upstream/main` passes with zero comments.
JJenkx commented 2026-10-21 20:01:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T20:01:26Z.


AMD/Linux data point on another title with a large Vulkan.Dispatch.shader_resources cost. On this title this PR makes no measurable difference.

Setup

  • Code Violet (PPSA26528) 01.000.028, Linux 7.2.9, RX 6650 XT (8 GiB), RADV (Mesa 26.2.4).
  • The tree is main b5d763770a + #4449 (with a local descriptor guard) + #8908, which this title needs to reach its menu without a GPU hang. This PR is merged on top of that tree (7b697003e9) and compared against the same tree without it (bf638a241a).
  • Same inputs, 240 s per run, alternated base, PR, PR, base. APS5_TRACE_SECONDS=200:30 with 4194304 events; every trace reports dropped false.
  • The first base run's trace was not written, so one base trace and two PR traces remain.
Run presents in the 30 s window frame p50 ms Vulkan.Dispatch.shader_resources ms/frame GPU busy ms/present
this PR 13 2606 1741 959
this PR 14 2577 1570 947
base 13 2146 1705 973

In this menu scene, dispatch shader resources cost about the same with and without the PR. So the cost here does not seem to come from storage textures evicted and re-created at the budget. There is no regression either: no GPU events and no new errors. With 13–14 frames per window the frame times are noisy, so I would not read the p50 difference as a slowdown.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6325310753 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6325310753). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T20:01:26Z. --- AMD/Linux data point on another title with a large `Vulkan.Dispatch.shader_resources` cost. On this title this PR makes no measurable difference. **Setup** - Code Violet (PPSA26528) 01.000.028, Linux 7.2.9, RX 6650 XT (8 GiB), RADV (Mesa 26.2.4). - The tree is `main` b5d763770a + #4449 (with a local descriptor guard) + #8908, which this title needs to reach its menu without a GPU hang. This PR is merged on top of that tree (7b697003e9) and compared against the same tree without it (bf638a241a). - Same inputs, 240 s per run, alternated base, PR, PR, base. `APS5_TRACE_SECONDS=200:30` with 4194304 events; every trace reports dropped false. - The first base run's trace was not written, so one base trace and two PR traces remain. | Run | presents in the 30 s window | frame p50 ms | `Vulkan.Dispatch.shader_resources` ms/frame | GPU busy ms/present | |---|---|---|---|---| | this PR | 13 | 2606 | 1741 | 959 | | this PR | 14 | 2577 | 1570 | 947 | | base | 13 | 2146 | 1705 | 973 | In this menu scene, dispatch shader resources cost about the same with and without the PR. So the cost here does not seem to come from storage textures evicted and re-created at the budget. There is no regression either: no GPU events and no new errors. With 13–14 frames per window the frame times are noisy, so I would not read the p50 difference as a slowdown. AI-assisted: yes (Claude Code); results above were run on this machine.
adriadam10 commented 2026-10-23 15:12:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T15:12:13Z.

Review: CHANGES_REQUESTED


Re-checked the new head (79146e64f0). The test point is resolved: the loop is now EvictStorageOnBudget and the new cases pin held-survives, idle-evicted, over-ceiling-evicts-all and unaccounted-survives; over is gone. Remaining:

  • Gain not reproduced outside your machine. The default-budget win (p50 583 → 362 ms) is from one RTX 3050 6 GB laptop; with the same APS5_TEXTURE_CACHE_MIB on both sides the A/B was 7.6% slower at p50. Independent runs: Code Violet on RX 6650 XT shows no difference; 007 First Light on RTX 3080 10 GB shows the same FPS, storage creations not lower, and +~420 MiB device memory with 9-16 recovered VK_ERROR_OUT_OF_DEVICE_MEMORY allocations per run against 1-5 without the PR (fewer budget collapses, 1/5 vs 3/5). Please show a second machine where frame time or creation count improves, or scope the retention so it does not hold extra memory on cards where it doesn't help (docs/rules memory bound: it must pay for itself).
  • Ordering: as agreed, #8672 lands first (#6194 and #6202 also touch cachedStorageTexture()/storageBudget()); rebase on top of it, keep its reclaim-and-reread step, and re-measure, since the ceiling depends on the budget those set. #10194 also touches storageLimits.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5630326204 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7833#pullrequestreview-5630326204). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-23T15:12:13Z. **Review:** CHANGES_REQUESTED --- Re-checked the new head (`79146e64f0`). The test point is resolved: the loop is now `EvictStorageOnBudget` and the new cases pin held-survives, idle-evicted, over-ceiling-evicts-all and unaccounted-survives; `over` is gone. Remaining: - Gain not reproduced outside your machine. The default-budget win (p50 583 → 362 ms) is from one RTX 3050 6 GB laptop; with the same `APS5_TEXTURE_CACHE_MIB` on both sides the A/B was 7.6% slower at p50. Independent runs: Code Violet on RX 6650 XT shows no difference; 007 First Light on RTX 3080 10 GB shows the same FPS, storage creations not lower, and +~420 MiB device memory with 9-16 recovered `VK_ERROR_OUT_OF_DEVICE_MEMORY` allocations per run against 1-5 without the PR (fewer budget collapses, 1/5 vs 3/5). Please show a second machine where frame time or creation count improves, or scope the retention so it does not hold extra memory on cards where it doesn't help (docs/rules memory bound: it must pay for itself). - Ordering: as agreed, #8672 lands first (#6194 and #6202 also touch `cachedStorageTexture()`/`storageBudget()`); rebase on top of it, keep its reclaim-and-reread step, and re-measure, since the ceiling depends on the budget those set. #10194 also touches `storageLimits`.

Pull request closed

Sign in to join this conversation.
No reviewers
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!7833
No description provided.