fix(agc): identify cached storage budgets in sampled reports #14891

Merged
hamb3r merged 1 commit from upstream-pr/14891 into main 2026-11-03 05:11:48 +00:00
hamb3r commented 2026-11-01 23:08:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-11-01T23:08:14Z.


What

The sampled-cache report reads a fresh Vulkan memory budget but may reuse a storage-cache limit calculated up to one refresh interval earlier. With a reported budget changing from 8 GiB to 2 GiB, the active storage limit can still be 4 GiB while a fresh calculation would select 1 GiB. The old message did not identify that difference in time.

Label the storage limit as active and append the machine-readable storage_limit_age_ms field. Record its calculation time separately from the existing refresh timer, and copy the optional timestamp under the same mutex as the returned limit. Ordinary callers retain the scalar return value; only the report requests the timestamp. Formatting stays inside the existing report gate. If no calculated timestamp is available, the field says unavailable.

Example: active storage image cache budget 4096 MiB; storage_limit_age_ms=25.

The regression test changes the reported budget from 8 GiB to 2 GiB, checks the active 4 GiB limit and its age annotation, verifies exactly one fresh sampled query and no reporting-induced storage refresh, then checks the storage limit becomes 1 GiB after its own interval. Its CTest failure guard rejects failed assertions even when a report matches.

Same-author landing order: #14891 first, then #14219. Its snapshot refactor is rebased on this exact head and declares Depends on: #14891. #14220 at d2cad1510164 merges cleanly with this branch. #6194 still conflicts with main itself; integration and author coordination remain tracked in the existing discussion.

pr_overlap.py returned exit 2: after moving the new test registration and dispatch away from unrelated additions, the only reported comparable overlap was #14219, now resolved by that declared dependency and rebase. Another 23 heads conflict with the comparison base and could not be compared automatically; their shared-file patches were inspected for this budget/report scope. This is not combined runtime validation.

Tested

Windows 10 Pro 10.0.19045, AMD Ryzen 7 7700, NVIDIA GeForce RTX 3080, NVIDIA 617.14, Vulkan validation layer 1.4.350.0, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, CCACHE_DISABLE=1.

  • Main: f03f72490132ed55d81c664b570d0bd26bc96694.
  • PR: 55940bd5c49d44adf0bf1ede28901bed627ee403.
  • Built agc_driver_sampled_cache_budget_tests, agc_driver_graphics_tests and agc_buffer_pool_tests on both.

Same machine/GPU and environment for both runs:

ANYPS5_REQUIRE_VULKAN=1
ANYPS5_NO_SHADER_CACHE=1
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
VK_LOADER_DEBUG=error,warn,layer
ANYPS5_GPU=RTX 3080
ctest --test-dir build-portable -R '^(agc_driver_sampled_cache_budget_(memory|report_age)|agc_driver_recover_(sampled|storage)_allocation|agc_driver_graphics|agc_buffer_pool|agc_memory_accounting_budget_(cap|floor))$' -V

Main passes the same 7/7 existing cases; the PR passes 8/8 including the new report-age case. Both logs confirm the validation layer was inserted, contain no missing-layer warning and have zero VUID validation errors. No cases skipped.

The new test executable also runs against the unmodified main driver: numeric assertions pass, but CTest returns exit 8 because the age annotation is absent. A deliberately wrong assertion after a matching annotated report is rejected with exit 8; restoring it passes.

Conventions and git diff --check pass. Games, FPS, full test suites, Linux and macOS were not tested; this PR makes no performance claim.

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 3080, NVIDIA 617.14, Windows 10 Pro 10.0.19045
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5112505615 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14891). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-11-01T23:08:14Z. --- ### What The sampled-cache report reads a fresh Vulkan memory budget but may reuse a storage-cache limit calculated up to one refresh interval earlier. With a reported budget changing from 8 GiB to 2 GiB, the active storage limit can still be 4 GiB while a fresh calculation would select 1 GiB. The old message did not identify that difference in time. Label the storage limit as active and append the machine-readable `storage_limit_age_ms` field. Record its calculation time separately from the existing refresh timer, and copy the optional timestamp under the same mutex as the returned limit. Ordinary callers retain the scalar return value; only the report requests the timestamp. Formatting stays inside the existing report gate. If no calculated timestamp is available, the field says `unavailable`. Example: `active storage image cache budget 4096 MiB; storage_limit_age_ms=25`. The regression test changes the reported budget from 8 GiB to 2 GiB, checks the active 4 GiB limit and its age annotation, verifies exactly one fresh sampled query and no reporting-induced storage refresh, then checks the storage limit becomes 1 GiB after its own interval. Its CTest failure guard rejects failed assertions even when a report matches. Same-author landing order: #14891 first, then #14219. Its snapshot refactor is rebased on this exact head and declares `Depends on: #14891`. #14220 at `d2cad1510164` merges cleanly with this branch. #6194 still conflicts with main itself; integration and author coordination remain tracked in [the existing discussion](https://github.com/boykopovar/AnyPS5/pull/6194#issuecomment-6552207004). `pr_overlap.py` returned exit 2: after moving the new test registration and dispatch away from unrelated additions, the only reported comparable overlap was #14219, now resolved by that declared dependency and rebase. Another 23 heads conflict with the comparison base and could not be compared automatically; their shared-file patches were inspected for this budget/report scope. This is not combined runtime validation. ### Tested Windows 10 Pro 10.0.19045, AMD Ryzen 7 7700, NVIDIA GeForce RTX 3080, NVIDIA 617.14, Vulkan validation layer 1.4.350.0, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, CCACHE_DISABLE=1. - Main: `f03f72490132ed55d81c664b570d0bd26bc96694`. - PR: `55940bd5c49d44adf0bf1ede28901bed627ee403`. - Built `agc_driver_sampled_cache_budget_tests`, `agc_driver_graphics_tests` and `agc_buffer_pool_tests` on both. Same machine/GPU and environment for both runs: ```text ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=error,warn,layer ANYPS5_GPU=RTX 3080 ``` ```sh ctest --test-dir build-portable -R '^(agc_driver_sampled_cache_budget_(memory|report_age)|agc_driver_recover_(sampled|storage)_allocation|agc_driver_graphics|agc_buffer_pool|agc_memory_accounting_budget_(cap|floor))$' -V ``` Main passes the same 7/7 existing cases; the PR passes 8/8 including the new report-age case. Both logs confirm the validation layer was inserted, contain no missing-layer warning and have zero VUID validation errors. No cases skipped. The new test executable also runs against the unmodified main driver: numeric assertions pass, but CTest returns exit 8 because the age annotation is absent. A deliberately wrong assertion after a matching annotated report is rejected with exit 8; restoring it passes. Conventions and `git diff --check` pass. Games, FPS, full test suites, Linux and macOS were not tested; this PR makes no performance claim. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> NVIDIA GeForce RTX 3080, NVIDIA 617.14, Windows 10 Pro 10.0.19045 - [x] AI-assisted: <!-- yes / no --> yes
BunnyFl commented 2026-11-02 01:45:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T01:45:50Z.

Review: APPROVED


Windows 11, WinLibs GCC 15.2.0 r7, Release, AMD Radeon RX 9070 XT (driver 32.0.32015.7029), Vulkan SDK 1.4.363 validation layer. Head 55940bd5c4 merged into upstream/main 93dbd0f82a. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -R '^agc_driver_sampled_cache_budget':

test this PR with main's ShaderResources.cpp
agc_driver_sampled_cache_budget Passed Passed
..._memory Passed Passed
..._without_storage_image_multisample Passed Passed
..._report_age (new) Passed Failed: required active storage image cache budget 4096 MiB.*storage_limit_age_ms=[1-9][0-9]* not found

Neither log has the missing-layer message or any VUID- ID. Nothing in tools/ or docs/ parses the [gpu] sampled texture cache budget line, so renaming the field to "active storage image cache budget" breaks no consumer.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5731311809 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14891#pullrequestreview-5731311809). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T01:45:50Z. **Review:** APPROVED --- Windows 11, WinLibs GCC 15.2.0 r7, Release, AMD Radeon RX 9070 XT (driver 32.0.32015.7029), Vulkan SDK 1.4.363 validation layer. Head 55940bd5c4 merged into upstream/main 93dbd0f82a. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -R '^agc_driver_sampled_cache_budget'`: | test | this PR | with main's `ShaderResources.cpp` | |---|---|---| | `agc_driver_sampled_cache_budget` | Passed | Passed | | `..._memory` | Passed | Passed | | `..._without_storage_image_multisample` | Passed | Passed | | `..._report_age` (new) | Passed | Failed: required `active storage image cache budget 4096 MiB.*storage_limit_age_ms=[1-9][0-9]*` not found | Neither log has the missing-layer message or any `VUID-` ID. Nothing in `tools/` or `docs/` parses the `[gpu] sampled texture cache budget` line, so renaming the field to "active storage image cache budget" breaks no consumer.
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!14891
No description provided.