Repository navigation
fix(agc): release pipeline cache save temporaries after use - #9558
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
The lifetime change is narrow and the paired validation/memory evidence is strong, but the PR is based on 8c26eac3 while current upstream main is dce41a89478876a8e3ea9c346b1dac00bb31c8cd (23 commits ahead). The required AGC comparison therefore does not cover current main. Please rebase/update to current main, rerun the same focused validation-layer tests on that main and the updated head on the same machine/GPU, confirm the layer loaded in both logs and compare VUIDs, and refresh the comparison evidence/checklist accordingly. I checked the intervening upstream commits touching PipelineCache.cpp; none are present, but that does not replace the repository’s current-main test requirement. I did not run tests locally. Existing hosted eligibility/conventions/intake/labels/report checks pass; product Linux/Windows jobs are skipped.
|
Reviewed; the lifetime fix is correct. One detail caught my eye and holds up: the new |
|
The lifetime review and independent correctness comment address the ownership sequence: the create call consumes the payload, the temporary cache is reset after data retrieval, and early returns retain RAII cleanup. The hosted eligibility, conventions, intake, labels and report checks passed; product and relinker jobs were skipped. Current upstream main is 4777cac, while this branch is 1 ahead/111 behind (merge base 8c26eac). Although the three-way merge is clean and no intervening main commit changed PipelineCache.cpp, the required AGC evidence must use current main: please update the branch and rerun the same focused tests on current main and the updated head on the same machine/GPU with validation enabled, no shader cache, required Vulkan, loaded-layer confirmation, and VUID comparison. Refresh the Tested section with those commits. I did not run these tests locally; this environment has a full filesystem. |
MarcZX10
left a comment
There was a problem hiding this comment.
The implementation and independent review look sound, but this changes the AGC driver and the repository requires paired focused validation-layer tests on current main and the PR head using the same machine/GPU. The detailed existing Windows/RTX 4090 report is based on 8c26eac, while current upstream main is 4777cac and the branch is 111 commits behind. Please update and rerun the paired suite with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_LAYER_KHRONOS_validation, verify layer loading and compare VUIDs, then refresh Tested. I did not run tests locally due to the full filesystem.
|
@MarcZX10 the branch has now been updated with the tested main integration. The new head is On the same Windows 11 / RTX 4090 / driver 617.14 machine, main and the updated head pass 8/8 cache/library/graphics cases with The repeated four-process ABBA save probe on main versus the identical candidate tree reduced median process peak commit from 1639.246 to 1315.037 MiB, a 324.209 MiB reduction. All four serialized outputs were byte-identical. This measures save-time committed memory; it does not establish FPS, whole-game memory savings or a Yōtei loading improvement. The persistence probe enables a private cache ( I also checked #7622 at Limitations: focused Windows/NVIDIA validation only; no Linux, full-suite, other-vendor GPU or title runtime testing, and no runtime test of a combined #7622/#9558 build. Full Windows/Linux project CI still needs a collaborator to dispatch the Build workflow for this updated head. |
|
The new paired report is strong and the measured |
…r#9558, hritikutekar's four committer changes) AI-assisted: yes
…kutekar's committer changes) AI-assisted: yes
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Dismissing a stale review: the requested changes were addressed after it (new head and/or updated description with the asked-for runs) and the merge queue blocks on it. Please request changes again if anything is still open.
What
When
PipelineCache::savemerges a cache already on disk, it keeps the input file buffer and the temporary Vulkan cache alive until the function returns. Both overlap the serialized output buffer, its hash and the atomic file write. Large cache files therefore add avoidable host-memory pressure during a save.Release
disk.contentsaftervkCreatePipelineCacheconsumes its payload, before merging/serializing. Destroy the temporary merged cache immediately aftervkGetPipelineCacheDatacopies its output. Its guard still destroys it on earlier returns and clears the handle to prevent a second destruction. Keep the merge diagnostic in a separate boolean.One production file changes. Cache contents, format, source namespace, save policy, snapshot locking, size floor and error paths are preserved. No cache budget or title-specific policy is added. This follows Vulkan's cache data retrieval and cache destruction lifetimes.
Tested
Current-integration paired verification, 2026-10-22
Refreshed in response to the exact-head/current-main review request. The main branch advanced during preparation; the final comparison uses these exact snapshots:
83462cc57ddecac5e5f3cdafafbe38d406e55953.4e28be4c6cc659d17d6d310422a043845ed35075.267120c401ad69a803bb8152e3f9f5649038db20.c6f2cd2db104ccb59b061a55a970a4fcb717af81and the pinned main above.The exact final commit was created in the fork and fetched by SHA before moving the PR branch. Its complete tree was checked against the clean local merge; that exact commit was rebuilt and tested, then the branch was moved to it without rewriting history. Only
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineCache.cppdiffers from the pinned main. Its production patch is unchanged from the earlier tested headae1c84b0b.Same machine/GPU for both selections: Windows 11 build 26200, WinLibs MinGW-w64 GCC 15.2.0 r7, Release; NVIDIA GeForce RTX 4090, driver 617.14; Khronos validation 1.4.363.0.
The eight cases are:
agc_pipeline_cache,agc_pipeline_cache_file,agc_pipeline_library,agc_pipeline_library_off,agc_pipeline_library_fast_only,agc_pipeline_library_clear_waits_for_build,agc_pipeline_store_lazy_buffer_pool,agc_driver_graphics.83462cc574e28be4c6Both run serially with
ctest -V --timeout 30,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationand loader layer diagnostics. Both logs confirm actual Khronos loading and the RTX 4090 device, contain no requested-layer-not-found message, and have empty VUID sets. The change adds no validation errors in this selection. The cache-file fixture explicitly enables its private persistence cache to exercise saves.agc_driver_graphicsis a CPU fixture; native Vulkan coverage comes from the cache/library fixtures.git diff --checkand conventions against the pinned upstream main pass. The literalorigin/mainconventions check was also run; it reports unrelated upstream changes because that ref tracks our older fork main.Limitations: focused Windows/NVIDIA validation only. No new Linux, other-vendor GPU, full-suite, title-runtime or combined #7622/#9558 runtime test. No new save-time memory benchmark was run for this refresh. These results do not establish completion of full Windows/Linux project CI; that build workflow still requires collaborator dispatch for the updated head. Subsequent main commits are outside these pinned runs.
Earlier save-time memory measurement — not rerun for this refresh
Four fresh-process runs in main/change/change/main order, comparing main
3ca07d086d5f44fbe3c00370e7f03953ab46ca1bwith local integrationc75625764251d4db13cfa66a9f6594555eee1ebc(tree2701b67ddb91a67f4b30eec8269d12021a5b6250, published asae1c84b0b2ec2a4bb6858451bbd82adccb1ccd69). A private probe built from the then-current main device fixture uses the realPipelineCacheand alternates only the production driver DLL. It imports and merges the same two opaque NVIDIA cache files (338,090,706 and 361,513,974 bytes). No shader dispatch or title is run. This persistence probe deliberately enables its private cache (ANYPS5_NO_SHADER_CACHE=0); the paired focused regression suites use1.Median peak reduction: 339,957,760 bytes (324.209 MiB). The peak is Windows
PROCESS_MEMORY_COUNTERS_EX::PeakPagefileUsage(process peak commit, not physical pagefile writes). All four outputs are byte-identical: 361,513,974 bytes, SHA-25611f8fd160edfb5241330d4097f3fccd707bf77a1d8c3c6564fd9c7fb6d02ac9e. Input hashes remained unchanged. Khronos was active in every probe process, with no missing-layer messages or VUIDs. The tested candidate DLL was restored afterward. This benchmark was not repeated on the new main or final head; its numbers apply only to the earlier pinned comparison.This is a save-time peak-memory result. No FPS, speed, whole-game memory or title-unblock claim. The probe and opaque inputs remain local; no captured game data is committed. No Linux, full-suite or title runtime validation; full Windows/Linux CI still requires a collaborator to dispatch the project build workflow.
Earlier #7622 overlap check — retained with its original base
On main
3ca07d086d5f44fbe3c00370e7f03953ab46ca1band the corresponding PR tree2701b67ddb91a67f4b30eec8269d12021a5b6250, inspected #7622 at778f35ea5fd168bc5b8dc1523acc5d1d7b4181aa. In the sharedPipelineCache.cpp, #7622 adds the host-thread helper include and changes the constructor's saver launch fromstd::threadtoLibc::StartHostThread. This PR changes temporary lifetimes insave; it does not implement that worker/MXCSR change.Three-way merges of the shared file succeed in both orders, producing identical bytes and preserving both changes. This holds against that pinned main alone and that pinned main with this PR. Whole-tree merge checks show that #7622 already conflicts with that pinned main in
Execution/src/VulkanDevice.cppandcore/shader/recompiler/ShaderDiskCache.cpp; adding this PR leaves exactly that same conflict-file set.PipelineCache.cppis clean. No ordering dependency or duplicate implementation was found for this PR's change. A combined #7622/#9558 runtime build was not tested.This overlap experiment was not rerun for the current refresh.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)