fix(agc): keep the Vulkan pipeline cache file with its shader cache version #6771
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6771"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-16T11:22:11Z.
What
The Vulkan pipeline cache file lived in the shader cache root, and every run merged its pipelines into it, so pipelines built from SPIR-V of earlier recompiler versions were never dropped. The file only grew: 965 MB for Uncharted: Legacy of Thieves Collection (PPSA05684, #4001) after a few recompiler changes, all of it loaded into host memory when the device is created (874 MiB of heap at startup).
The file now sits in the directory of the current shader cache source version (
ShaderCacheDirectory()/<source version>/vk-pipelines-*.bin), next to the variants it was built from, so it is dropped with them when that version's directory ages out. The USAGE.md sentence on the pipeline cache says where the file is.Related: #6958 (Pipodi) edits
PipelineCache.cppand the sameRecorder.cpptest file (periodic save), different lines; whichever merges second may need a trivial rebase. #5875 (merged) journals a run's pipelines and already listsShaderDiskCache::SourceVersionamong the reviewed names; #6568 edits the same USAGE.md paragraph. Neither moves the pipeline cache file, whichmainstill writes to the shader cache root.Tested
aff725bf6after #5875 merged;mainat that commit does not build here (PipelineJournal.cppstatic assertions), so the tests below ran on the previous base3f171d03ewith the same change.agc_pipeline_cacheandagc_pipeline_cache_file: the file is written inside the current source version's directory and no file is left in the root; other version directories are tolerated. Re-run with the review fix onmain29a546d37, alsoagc_pipeline_journalandagc_driver_pipeline_journal. Negative controls:PipelineCache.cppfrommainfails, a file under another version fails.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T11:31:28Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/user/USAGE.mdL285Some 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.
core/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/user/USAGE.mddocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/user/USAGE.mdcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineCache.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/user/USAGE.mddocs/user/USAGE.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T11:45:23Z.
Review: COMMENTED
The version-scoped cache path and existing Vulkan UUID/device checks look sound. One regression-test assumption looks brittle:
pipelineCacheFileTestscallsremove_all(directory)only after the lambda is exercised, then the newcacheFilehelper requires the cache root to contain exactly one entry. A prior failed/interrupted run can leave an older version subdirectory in this unique temp directory, making the successful cache test fail even though the current version contains exactly one expected file. Could the helper select the currentShaderDiskCache::SourceVersion()subdirectory (or assert the current version directory and file while tolerating other versions)? That would keep the test focused on the new path without assuming cleanup from a previous test process.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-16T23:29:46Z.
@MarcZX100 thanks for the review. Agreed, the helper should look up the current version's directory instead of assuming it is the only entry. Pushed 7c6fcf248,
cacheFilenow:vk-pipelines-*.binleft in the root, other version directories tolerated),<root>/<source version as %016llx>(ShaderDiskCache::Generated::SourceVersion, the valueSourceVersion()returns) and requires it to exist,vk-pipelines-*file in that directory.For the record, a previous process could not leak into this run before either: the test root is
aps5-pipeline-cache-file-test-<random>, removed at the start of each loop iteration and byRemoveDirectoryon exit. The new helper is still the better check, because it ties the file to the current source version instead of to whichever directory happens to be there.Tested with the two commits on current
main29a546d37, Linux, RTX 4070 Ti SUPER, driver 615.78.08:agc_pipeline_cache,agc_pipeline_cache_file,agc_pipeline_journal,agc_driver_pipeline_journal,agc_driver_compute_pipeline_outside_gpu_mutexpass. Negative controls onagc_pipeline_cache_file:PipelineCache.cppfrommain(file in the root): fails with "a pipeline cache file lives in the shader cache root".SourceVersion() + 1: fails with "the current shader cache version has no directory" (the previous helper accepted this).Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T09:49:25Z.
Rebase handoff — rebased onto current
main(authorship unchanged). One conflict indocs/user/USAGE.md: your pipeline-cache-with-its-shader-subdirectory wording merged withmain's newer no-size-limit sentence, both kept in one paragraph.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV):tools/check_conventions.py --base origin/mainpassesmainregression (agc_driver_tessellationsegfault, #4727), not this PRTo pick it up:
Head is
d07e5926f.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-17T11:02:41Z.
@blawesom thanks for the rebase. I rebased onto the newer
main864729dc0myself and resolveddocs/user/USAGE.mdthe same way, keeping both sentences in one paragraph.git range-diffshows both commits identical to your3857c5a12andd07e5926f. Pushed as dc4d6d2eb;tools/check_conventions.py --base origin/mainpasses.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T09:08:55Z.
Re-checked against current
main: the merged changes toRecorder.cppandUSAGE.mdare in other tests and sections,PipelineCache.cppis untouched and the PR merges cleanly. The version directory is still created on write and the test looks up the current version's directory. The third-party Linux and Windows runs above cover the test targets; merged.