fix(agc): serialize pipeline cache snapshots #4795
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4795"
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 MarcZX10 on 2026-10-12T22:10:49Z.
What
Serialize the periodic persistent pipeline-cache snapshot against pipeline creation that uses that cache. Pipeline creation paths take shared locks, so they can continue concurrently with each other.
PipelineCache::save()takes the exclusive lock only around its twovkGetPipelineCacheDatacalls, then releases it before hashing or writing the cache file.The guard covers graphics, compute, pipeline-library and asynchronous LTO creation paths using the persistent cache. Capture replay uses a separate temporary cache and remains unchanged. A regression checks that snapshot access cannot acquire while a pipeline-use lock is held and succeeds after that lock is released.
This is an application-side workaround for the Intel driver crash reported in issue #4781. The Vulkan specification describes pipeline-cache use by pipeline creation as internally synchronized across threads; this PR does not claim that the crash is a Vulkan valid-usage violation. See the Vulkan pipeline cache specification and
vkGetPipelineCacheDatareference.Tested
libSceAgcDriverandagc_driver_graphics_testspassed on based379bfd014193cb3dc7b1e559c374b40a6dcdf48;agc_driver_graphicspassed 1/1.main30f961266ade83b41d5c9de7dec1393e7fcecfb7. On the rebased head, configured Linux Release withBUILD_TESTING=ONand SPIR-V tools disabled; Ninja builtagc_driver_graphics_testssuccessfully (706/706 steps).ctest --test-dir /tmp/AnyPS5-4795-rebased-build -R '^agc_driver_graphics$' --output-on-failure: passed (1/1, 7.99 s).python3 tools/check_conventions.py --base upstream/main --head HEADandgit diff --check upstream/main...HEADpassed on the rebased head.Checklist
main; no open PR implements persistent pipeline-cache snapshot serializationNotImplemented_nid_no_patchImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T03:27:18Z.
Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built on current main
0c3dc9ca2together with eight other open GPU PRs (their own commits cherry-picked, no merge commits), so only the tests that belong to this PR say something about it:tests/Graphics.cpp(agc_driver_graphics): 10 of 10 runs passed.Not tested: no game run. The batch was built once, not per PR; it had no failures, so no bisect was needed.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T08:12:22Z.
Rebased onto current
main6e83cad17574960029bdca66626dff57cfb7bb4cand pushed headdfff45d02. TheGraphics.cppconflict was between main’s--sparse-buffer-holesdispatch and this PR’s pipeline-cache synchronization regression; both are retained.git diff --checkpasses. I have not rebuilt or rerun tests on this rebased head; the PR description now labels the earlier Linux and Windows reports by their bases.Imported from boykopovar/AnyPS5. Originally posted by kq62 on 2026-10-13T10:09:21Z.
Tested on an Intel Arc 140T on Windows, where
maincrashes the same way as #4781.Setup
0x8086:0x7d51, driver32.0.101.899162d4cfe6..., same as #2475) and relinked with--windows --to-intelResults
maincac4e96880xc0000005inigvk64.dll+0x653291, read of0x350, on a thread withlibSceAgcDriver.prxframesmaincac4e9688ANYPS5_NO_SHADER_CACHE=11eeb2c6641eeb2c664I did not symbolize the crash frames; the timing and the
ANYPS5_NO_SHADER_CACHE=1result match #4781. So the saver race also reproduces on a second Intel GPU generation and on a newer driver (32.0.101.8991, after the two in #4781), and this PR avoids it there.AI-assisted: yes (Claude).
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-13T18:46:02Z.
Rebase handoff — rebased onto current
main(staleness only, applied cleanly), authorship unchanged.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). Note this PR's own pipeline-cache tests all pass, including the snapshot serialization round-trips.To pick it up:
Head is
06804f8a3.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T19:27:00Z.
I checked the current head
1eeb2c66482f87bfc5832b1664275554f9f57dd6:conventions,eligibility, andreportpass; the path-based build jobs (Linux, Windows, relinker, register-context and write-watch) are skipped.gh pr checksshows no current failure, although GitHub still reportsUNSTABLEfrom the check history. No failing current run is available to rerun.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T22:48:02Z.
Thanks for preparing and validating the rebase handoff. I picked up the original topic and rebased it directly onto the newer upstream
main30f961266, since the offered head was based on an earlier main. I rebuiltagc_driver_graphics_testson that head (706/706 Ninja steps), reranagc_driver_graphics(1/1 passed), and reran conventions plusgit diff --check; the PR body now distinguishes the old-base results from these current-head results.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:46:23Z.
Rebased onto main to resolve the conflict in
core/libs/prx/libSceAgcDriver/tests/Graphics.cppafter #4849 (kept both tests); no other change.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T00:54:30Z.
Fresh Linux validation for the current PR tree: published head
4307e3cb549a5745346b39dbaf4784c4e10002f3has the exact same tree as the locally tested commit3e7478b2b43b85b79c45ae47182ae457b045d5b9(same parentce5c839). GCC 12.2, CMake/Ninja Release,BUILD_TESTING=ON:agc_driver_graphics_testsbuilt successfully;ctest -R "^(agc_driver_graphics|agc_driver_address_space_teardown)$" --output-on-failurepassed 2/2. Conventions andgit diff --checkpass. The merge with latest upstreammain0dea07abis also conflict-free. The build emitted GCC-Wstringop-overreadwarnings from libstdc++ vector comparison inPipelineLibrary.cpp; no errors.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T00:56:24Z.
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)core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL4228-4281