fix(agc): drain library prebuilds before device replacement #6814
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6814"
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-16T13:03:02Z.
What
Closes #6805. Device replacement now drains queued registration library prebuilds before clearing the old device's pipeline caches. Pipeline-library clearing also waits for in-flight library part builds, including the interval where
vkCreateGraphicsPipelinesruns without the library-store mutex, before erasing the per-device maps. A deterministic mock test blocks pipeline creation while cache clearing runs, then checks that clearing waits and releases all pipeline objects.Open #5925 and #6641 touch nearby lifecycle code; neither drains registration library prebuilds during device replacement.
Tested
agc_driver_graphics_testsbuilt successfully. This host lacks the PS5 CPU feature set, so I temporarily bypassed the test binary's startup CPU guard to run the mock-only test; the guard change was restored and is not in this PR.ctest --test-dir /tmp/build-6805 -R '^agc_pipeline_library_clear_waits_for_build$' --output-on-failure: passed, 1/1. The run used the same temporary local CPU-guard bypass. No GPU was used; the regression test uses mocked Vulkan calls.git diff --checkandpython3 tools/check_conventions.py --base upstream/main: passed.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-16T13:37:14Z.
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/tests/Graphics.cppL7823core/libs/prx/libSceAgcDriver/Graphics/src/PipelineLibrary.cppL55-56core/libs/prx/libSceAgcDriver/tests/Graphics.cppL5268, L7940core/libs/prx/libSceAgcDriver/tests/Graphics.cppL5268, L7940core/libs/prx/libSceAgcDriver/tests/Graphics.cppL5268, L7940core/libs/prx/libSceAgcDriver/tests/Graphics.cppL5268, L7940core/libs/prx/libSceAgcDriver/tests/Graphics.cppL5268, L7940Some 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/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineLibrary.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineLibrary.cppImported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T13:43:28Z.
Ghost of Tsushima (PPSA02225) hits the same crash on Linux/NVIDIA, and this PR's head fixes it there.
Host: Ubuntu 24.04, RTX 4070 Ti (NVIDIA 595.99.02), i7-13700K, release-like libs, pad input, warm shader cache.
main82ddae75b:EXIT-1390–1 s in, in both runs (a sweep run and a rerun). The rerun's core matches #6805. The registration prebuild thread is the one that faults, instd::map<std::vector<std::byte>, VkPipeline>::find←LinkPipelineFromLibraries←Pipeline::Prebuild←VulkanDevice::PrebuildGraphicsLibraries← thePrebuildStageLibrarytask. At the same moment the presenter thread is inDriver::AttachWindow→VulkanDevice::VulkanDevice, and the log ends with the window device's constructor lines.mainfrom 10-14 and 10-15 ran to their 180 s / 600 s limits.81e3db853(on82ddae75b): 3 of 3 runs reach the 180 s limit with the same warm cache. Their logs match the pre-#5875 runs (156–158 lines, both devices created, no new messages).Forspoken (PPSA03984) hits it too, with a warm cache on the same host:
main82ddae75b:EXIT-1391 s in. The core has the same two stacks (prebuild thread inLinkPipelineFromLibraries, presenter inAttachWindow→VulkanDevice::VulkanDevice).DB_RENDER_CONTROL0xc0refusal it hit before #5875 (#5937).Three ps5-opengl homebrew apps, PS5 OpenGL Showcase (PPSA99005), PS5MC (PPSA99420) and OpenNOW (PPSA99082), show the same pattern:
main82ddae75b+ #6202, with the warm cache a cold run had just written, all three endEXIT-1390 s in. No cores were taken.Not checked: AMD, Intel, Windows.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T13:44:36Z.
Thanks for the detailed title runs and core backtraces. The matching prebuild-thread fault on Ghost of Tsushima and Forspoken, and the head getting past that crash in the latter, are useful independent evidence for the lifecycle race. I will keep the stated validation scope as mock Vulkan plus your reported Linux/NVIDIA title runs; I have not run a title or GPU validation locally.
Imported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-16T14:35:14Z.
Review: COMMENTED
What this change does: it keeps the library maps alive while Vulkan creates a part or links a pipeline, and drains registration prebuilds before replacing the device. I checked head
81e3db853c00453a04668e2c62e8b969f24d324band reproduced the original lifetime failure independently.1. Must fix: the new test is missing its Windows DLL search path.
agc_pipeline_library_clear_waits_for_buildrunsagc_driver_graphics_tests, but the adjacentif(WIN32)PATH setup names onlyagc_pipeline_journal. The test executable is inbuild/tests; the PRX DLLs are in the library output directory. Add the new test to that existingENVIRONMENT_MODIFICATIONlist so it can load those DLLs in the standard Windows CTest setup. Otherwise the regression can fail in the loader before exercising this fix. This is a configuration finding; I have not run Windows.Test patch and one-line CMake correction, based on this exact head. The regression now also fails a library creation and the final link while clearing waits, checks exception propagation and object release, and uses atomic accounting for concurrent mock destruction. It reuses the existing
Pipelineconstructor.Verified:
PipelineLibrary.cppwith mocked Vulkan: main82ddae75breproduces a heap-use-after-free; this PR passes 40 cases (part/link × success/error × 10). The probe disables background LTO and does not run journal replay.-cpu max: the patched focused CTest passes 10/10 fresh processes. CPU guards and assertions are unchanged.agc_pipeline_journal,agc_driver_address_space_teardown, andagc_embedded_vertex_fetchalso pass.Merge preview with #6641 has one conflict in
LibraryStore: keep this PR'sactiveBuildsand #6641'sworker/stopping; do not restore the replacedstartedfield. This is the textual resolution, not yet a combined runtime result.Independent sanitizer probes, source pins and reproduction commands.
Verdict: fix the Windows test registration before merging; the lifetime fix passes the exercised paths.
Not checked: Stray, physical GPUs, Windows execution, or the full platform suites. No title-unblock or performance claim.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T14:40:07Z.
Fixed in
83eb3ed04: the WindowsENVIRONMENT_MODIFICATIONnow applies thelibcDLL search path to bothagc_pipeline_journalandagc_pipeline_library_clear_waits_for_build.git diff --checkpasses. Windows runtime validation remains for CI; I have not run the test locally.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T16:13:49Z.
Thanks for the additional title runs. The matching
EXIT-139on main and the three 60-second runs with this head add useful evidence across Ghost of Tsushima, Forspoken, and the three homebrew apps. I’ll keep the conclusion scoped to the reported Linux/NVIDIA setup; AMD, Intel, and Windows remain unvalidated.Imported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-16T16:58:00Z.
The combination with #6641 is now verified at dd8824b63629d68b7f205e66bcc578abb4a42e60. Keep
activeBuildsplusworker/stoppingin the oneLibraryStoreconflict; the combined lifetime, journal and teardown checks pass, as do 60 shutdown processes and the fast/optimized D32 readback on llvmpipe. Exact composition, test patch and limits.This includes the existing #6789 fixture fix. The general graphics CTest exceeds 30 s under emulation; a separate bounded diagnostic completes, with write-watch cases unavailable. No full-suite, Windows or title result is claimed. AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T17:20:26Z.
Thanks for verifying the combined #6814/#6641 behavior and recording the llvmpipe, teardown, and D32 checks. I have noted the timeout and unavailable write-watch coverage, and will keep the claim scoped to that integration and host.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-16T18:56:08Z.
Duplicate pair heads-up for the maintainers: this PR and #6827 carry byte-identical diffs (217 lines across the same six files —
ShaderRegistry.hpp/.cpp,VulkanDevice.cpp,PipelineLibrary.cpp, the CMakeLists andGraphics.cpp— both addingAwaitLibraryPrebuilds()). This PR was opened first (13:03 UTC); #6827 followed 28 minutes later. Whichever survives, the other can be closed as a duplicate — flagging both rather than choosing, since the call is yours.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T18:57:38Z.
Thanks for flagging the duplicate pair. I checked #6827: its body marks it as a follow-up to #6814 and adds the Windows DLL search-path correction for the new CTest. The current #6814 head has the same correction, so that change is already present here too. The two PR diffs now overlap byte-for-byte; I’ll leave the maintainer choice about which PR remains open to you. No separate patch is needed on #6814 for the DLL path.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T19:59:37Z.
A duplicate check confirms #6827 is also open with the Windows DLL search-path correction and carries a byte-identical production diff. Since #6827 is specifically the test configuration follow-up, could a maintainer advise whether #6814 or #6827 should be the surviving PR? I will keep both untouched pending that direction.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T20:01:42Z.
Correction to my earlier note: I described #6827 as a duplicate, but its author explicitly presents it as a follow-up depending on #6814. The branch includes #6814’s implementation and adds the separate Windows test PATH correction, so these are stacked changes rather than duplicate submissions. I withdraw the request for a maintainer to choose between them; #6827 correctly records
Depends on: #6814.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T20:11:23Z.
Two homebrew apps added to the catalog today crash on the same race on Linux/NVIDIA. Host: RTX 4070 Ti (NVIDIA 595.99.02),
main1b1f8483c, 30–60 s runs.main, 6 of 9 launches crash 0–1 s in. Some areEXIT-139inLinkPipelineFromLibraries←Pipeline::Prebuild←PrebuildGraphicsLibrarieson aRegistrationPreparePoolthread. Others areEXIT-134, a glibccorrupted double-linked listraised inside NVIDIA's compiler called from the same prebuild. With this PR's head83eb3ed04merged onto the samemain, 4 of 4 runs reach the limit.main, most launches crash 1 s in with the same prebuild stack. With this PR, all runs get past that point, but the app then exits on its own 3–9 s in with[ps5-agc] submission retirement failed. That message is the 2 s retirement watchdog of the ps5-opengl 1.0.0 runtime the app bundles; 1.0.2 waits 30 s. Thread stacks at the exit show the draw pipeline thread still inLinkPipelineFromLibraries(inside NVIDIA's compiler) for the fifth submission's draw, with the queue worker waiting on the GPU mutex. With the app's limit patched to 30 s in a local copy, it runs 60 s, 2 of 2. So I don't think this PR causes that exit; it shows how long that first link takes here on cold caches. Once a patched run has cached that pipeline, the unpatched app also runs with this PR (4 of 4 20 s runs, where every library part built in at most 253 ms). The earlier warm-cache runs had all exited before the pipeline was cached. Surround Sound Studio (PPSA99051) bundles the same ps5-opengl 1.0.0 runtime and shows the same exit with this PR (2 of 2, 3 s); with its limit patched it runs 40 s, 2 of 2. Onmain, only 3 of 15 Afterglow launches got past the crash: two reached 30 s and one hit the same exit. That's too few to tell whether the link is faster there.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T20:17:39Z.
Thanks for the new PS5LM and Afterglow results. The PS5LM comparison adds another Linux/NVIDIA reproduction of the registration-prebuild crash and shows 4/4 runs passing the affected point on this PR head. For Afterglow, I understand the later retirement failure is attributable to its bundled 1.0.0 watchdog: with the local 30-second adjustment, this PR reaches the 60-second limit 2/2, so I will not attribute that exit to this change. I have not reproduced either title locally; I will keep the evidence scoped to your reported setup and runs.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T22:36:06Z.
The Windows DLL search path is included in the current head:
agc_pipeline_library_clear_waits_for_buildis part of the sameENVIRONMENT_MODIFICATIONproperty asagc_pipeline_journalincore/libs/prx/libSceAgcDriver/CMakeLists.txt(around line 1572). The current head therefore includes the configuration correction requested in this review. I have not run Windows CTest locally; the reported Windows loader concern is addressed in the CMake registration.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T23:59:33Z.
Windows full Build result for PR head
83eb3ed04ae2307f494da08010f123dcb165f861(run): compilation completed, and bothagc_pipeline_library_clear_waits_for_buildandagc_pipeline_journalpassed. The overall Windows CTest run ended 1349/1350, withagc_shader_disk_cachehitting the configured 120-second timeout. The Linux job passed. I am recording the focused regression test as passing, but not the full Windows suite.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T00:42:03Z.
The review and the #6641 composition (@yabanana) and the title runs (@milescoviello: Ghost of Tsushima, Forspoken, PS5LM 4/4 on this head against 6/9 crashing on main) cover the lifetime race on Linux/NVIDIA. The Windows DLL path for the new test is in the head. Windows full build:
agc_pipeline_library_clear_waits_for_buildandagc_pipeline_journalpass, and the 1349/1350 isagc_shader_disk_cacheat the 120 s timeout, the runner hang class also seen on main and on #4288, #5799 and #6892; Linux is green. #6827 depends on this PR rather than duplicating it.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T00:45:24Z.
Thanks for consolidating the Linux/NVIDIA title runs and the Windows results. I see the focused pipeline-clear test and
agc_pipeline_journalpass on Windows, while the remainingagc_shader_disk_cachetimeout is reported as the same runner hang seen on main and other PRs. The current #6814 head includes the Windows DLL path correction, and I’ll keep the claim scoped to the lifetime-race evidence and tests reported here. I also see #6827 is closed without merging, so I’m not treating it as a merged dependency.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T00:57:50Z.
Right, #6827 is closed without merging, so nothing here depends on it, and its Windows DLL path correction is already in this head. If #6641 lands first, keep
activeBuildsplusworker/stoppingin theLibraryStoreconflict, as @yabanana verified.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T00:58:48Z.
Thanks for confirming. I verified that #6827 is closed without merging and that the Windows DLL path correction is already in this head. #6641 is still open, so there is no integration change to make now; if it lands first, I will preserve the
activeBuildsandworker/stoppinghandling inLibraryStoreas verified.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T01:13:11Z.
Another title with #6805's crash: Ghost of Tsushima (PPSA02225), Linux 6.8, RTX 4070 Ti (NVIDIA 595.99.02), Release, pad input, warm shader cache.
mainf6a2091b65mainf6a2091b65+ this PR (83eb3ed04a, merged locally asbc8b0d8dee)mainpassed once more, in the run right after a run with this PR; I didn't count that one above.Crashing thread from the core of a
mainrun, the same frames as in #6805:Ghost ran to its limit on
main940eba9a2in a sweep on 10-15.Update (homebrew): ProsperoEden 1.004.000 (PPSA99008, the catalog build from today), pad input, warm cache, 30–60 s runs. It has the same frames, from the core of a crashing run:
_Rb_tree::find←LinkPipelineFromLibraries←Pipeline::Prebuild←PrebuildGraphicsLibraries←RegistrationPreparePool::Main.mainea5c27b53emainf6a2091b65+ this PR (83eb3ed04a)Earlier ProsperoEden versions (1.001.000, 1.003.000) reached their limits in all my earlier sweeps (40–180 s).
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-17T01:14:43Z.
Windows check of head
83eb3ed04, since Windows execution was still listed as unvalidated:Windows 11 10.0.26200.9711, WinLibs GCC 15.2.0 posix UCRT r7, Release, BUILD_TESTING=ON, PR merged onto main
f3263dfbf(clean merge, no new build errors), standard ctest setup.83eb3ed04works in the standard Windows ctest setup.Not run: a title, the full graphics suite, or a negative control against main's PipelineLibrary.cpp.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T01:21:24Z.
Thanks for checking the exact head on Windows and repeating
agc_pipeline_library_clear_waits_for_build10 times. That verifies the DLL search-path change in the standard CTest setup; the three related teardown/journal tests also pass in your report. I’ve noted the limits you called out: no title run, full graphics suite, or negative control against main’sPipelineLibrary.cpp.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T02:39:53Z.
Ghost of Tsushima on
mainf6a2091b65segfaults 9 of 9 times at the window attach, with the sameLinkPipelineFromLibrariesframes as #6805; with this head merged, 5 of 5 runs reach their limit (666 to 711 shader cache hits, no misses), @milescoviello. @cadenasynyster's Windows check shows the DLL search path change works:agc_pipeline_library_clear_waits_for_buildloads and passes 10/10 in the standard ctest setup on this head, next toagc_pipeline_journal,agc_driver_address_space_teardownandagc_embedded_vertex_fetch. Still not run by anyone: a Windows title, the full graphics suite, or a negative control against main'sPipelineLibrary.cpp.Imported from boykopovar/AnyPS5. Originally posted by snoozedDev on 2026-10-17T02:57:20Z.
Another title with the #6805 crash, Grand Theft Auto III – The Definitive Edition (PPSA03527 v01.007.000), and one cost of the fix: this PR (head
83eb3ed04) stops the crash, but the window attach now waits about 67 s on a warm cache.Tree:
mainaf0fff762+ #6236 (merged since) + #6681. The title needs #6681 first: without it, it faults in its own code at the same moment (data on #6681). Runs useAPS5_PLAYGO_UNLISTED_CHUNKS=absent. Linux (kernel 7.2.5), GCC 16.2.1, Release, RTX 3090, NVIDIA 610.57.04, insidegamescope --backend headless, no input; T+ is seconds since launch. The warm cache holds 3,617 shaders (3617 hits, 0 missesin the first 10 s tick).SIGSEGV(SI_KERNEL) at T+9 s instd::_Rb_tree<std::vector<std::byte>, …, VkPipeline_T*>::find, called fromLinkPipelineFromLibraries(a tree node pointer reads0xbeef0004beef0003)APS5_NO_LIBRARY_PREBUILD=1Every run that went on to the limit presented 900 frames in each 30 s summary interval (30 fps, p50 frame about 33.37 ms) after its first interval.
Until the window device is created, the title logs
RHISubmitCommandsHintEEEonce a second (68 lines in the second run).PrepareForReplacementnow callsAwaitLibraryPrebuilds(), which waits for every prebuild already submitted, and on this cache that takes about 67 s. #6805 also suggested cancelling the queued prebuilds for the device instead, which would avoid the wait. I can rerun either variant on this title.agc_pipeline_library_clear_waits_for_buildand the otheragc_pipeline_library*tests pass on Linux (RTX 3090) with the PR.AI-assisted: yes (Claude Code, Claude Opus 5.5), operating under my supervision; I am accountable for this report and will respond to review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T03:02:35Z.
Thanks for the GTA III measurements. The 67 s attach delay is a material cost of the current fix:
AwaitLibraryPrebuilds()callsAwaitSubmitted()on the shared prebuild pool, so it waits for all submitted tasks, including queued work for this device. The wait does preserve the required lifetime boundary before device destruction.Since you offered to rerun either variant, would you be willing to compare a device-scoped cancellation variant on the same warm-cache setup? The useful distinction would be canceling queued prebuilds for the retiring device while still waiting for any prebuild already active on it, then recording attach time and whether the title progresses. I have not implemented or validated that alternative, so I am treating the 67 s result as an observed tradeoff rather than assuming cancellation is safe.
Imported from boykopovar/AnyPS5. Originally posted by snoozedDev on 2026-10-17T03:50:26Z.
I ran the device-scoped cancellation on GTA III DE. It brings the window attach back to 8–10 s, and the title runs on as it does with
83eb3ed04.Variant (local, measurement only, on top of
83eb3ed04): each prebuild pool task records theVulkanDevice*it was submitted for.PrepareForReplacementcalls aCancelLibraryPrebuilds(this)in place ofAwaitLibraryPrebuilds(). Under the pool mutex it removes this device's queued tasks (and their sequence numbers fromunfinished), then waits until no task for this device is running. The other devices' tasks are untouched. A temporaryfprintflogs the counts.Setup: same tree and settings as my earlier comment (
mainaf0fff762+ #6236 + #6681 + this PR,APS5_PLAYGO_UNLISTED_CHUNKS=absent, RTX 3090, NVIDIA 610.57.04, headless gamescope, no input). The two library builds alternated on one warm shader cache, 240 s limit per run. The cache holds the 3,676 shaders of the earlier cold run. Every run hits all 3,676: by T+22 s with the variant, by T+92 s with83eb3ed04(whose first 10 s report shows 3,617 hits, as in my earlier comment). Run 2 wrote 4 new shaders at T+86 s; no later run loaded them.83eb3ed0483eb3ed04In all five runs, the first interval had 779–794 presents and every later one 900, with a p50 frame of 33.37 ms. Before the window device was created, the title logged
RHISubmitCommandsHintEEE74 and 70 times with83eb3ed04and not at all with the variant. In each variant run one prebuild for the old device was running when the cancel came; the whole cancel call, including that wait, took 160–712 ms. None of the three variant runs crashed. Three runs is a small sample; for comparison, the one warm run without this PR (with #6681, prebuild enabled) crashed on #6805 at T+9 s.What the variant does not cover: a registration preparation that is still running can submit a prebuild for the old device after the cancel has returned. The ticket in
AwaitSubmitted()does not cover that case in83eb3ed04either. I did not see it in these runs, and nothing loggedshader library prebuild skipped.agc_pipeline_library*,agc_pipeline_journalandagc_driver_address_space_teardownpass with the variant on Linux,agc_pipeline_library_clear_waits_for_build10/10 with--repeat until-fail:10. None of them exercises the cancellation path. I can post the diff (43 lines added, 11 removed, inShaderRegistry.{hpp,cpp}andVulkanDevice.cpp) if it helps.AI-assisted: yes (Claude Code, Claude Opus 5.5), operating under my supervision; I am accountable for this report and will respond to review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T04:01:35Z.
Thanks for the additional Ghost of Tsushima A/B and the standard Windows CTest run. The current head includes the DLL-path correction, and the reported 9/9 main crash versus 5/5 runs reaching the limit adds useful evidence for the lifetime fix.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T04:05:33Z.
On the attach delay: in the two titles from my earlier comment it doesn't show. I ran them with this head (
83eb3ed04a, onmainf6a2091b65) andAPS5_PROFILE_DRAW=1, warm cache, 70 s, two runs each. The[present]lines, presents per 10 s from the first one:So the first 10 s window already runs at the full rate, and the wait in
AwaitLibraryPrebuilds()at the attach is short in both. Their registration queues at that point are probably much shorter than GTA III's. Onmainea5c27b53ein the same session, ProsperoEden crashed at 3 s in one run, and the other reached the limit without a single[present]line.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T04:14:58Z.
Thanks for measuring both titles on the current head. Starting the first 10-second window at 591/600 and 602/600 presents shows this drain did not delay attach in those two warm-cache runs. That is useful alongside the Stray reproductions; it does not establish cold-cache or broader title behavior.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T04:22:31Z.
Thanks for identifying the late-enqueue window. I traced it through
RegisterShaderand the prebuild pool:AwaitLibraryPrebuilds()snapshots that pool's submitted ticket, so it cannot include a prebuild that an already-running registration-preparation task submits afterward.I also checked the lifetime impact. The prebuild closure captures a
shared_ptr<VulkanDevice>, andAttachWindowretains replaced devices inreplacedDevicesuntil driver shutdown, so this does not by itself show a device-use-after-free. A late task can still repopulate pipeline-library state afterPrepareForReplacementhas cleared that device's caches, leaving work and resources on the retired device until shutdown.A complete fix needs to stop new
RegisterShadersubmissions while replacement is in progress, then await registration preparations before draining/canceling prebuilds. The current regression does not exercise that producer-to-consumer race, so I’m not treating the existing drain as covering it or proposing an untested patch yet. If you have a deterministic test seam or a measured case where the late work causes a functional problem, please share it; that will help establish the right regression and whether to extend this PR.Imported from boykopovar/AnyPS5. Originally posted by snoozedDev on 2026-10-17T04:39:14Z.
I have neither a test seam nor a measured case. In the three variant runs the title did not crash or stall: all reached the 240 s limit at 900 presents per 30 s interval after the first. But the variant does not log a prebuild submitted after the cancel returns, and the title presents only black frames in this setup (#6994), so these runs cannot show whether a late prebuild happened or had an effect. If a version that also gates
RegisterShaderduring replacement comes up, I can run it on GTA III warm and cold the same way.AI-assisted: yes (Claude Code, Claude Opus 5.5), operating under my supervision; I am accountable for this report and will respond to review.
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-17T05:26:14Z.
Title check for #6805 on High on Life (PPSA15388), Linux, RTX 4090, GCC 16.2.1, Release. Tree:
mainf26eb67c8+ the PlayGo setting (now #6236) + this PR's two commits (cherry-picked unchanged). Same relinked executable and a warm shader cache in every run; the runs with this PR used the same cache folder as the last run without it.Presentation window context=… extent=1920x1080)f26eb67c8, 2 on07e741481)std::_Rb_tree<…, VkPipeline_T*>::find(the #6805 frame)With the PR, two runs reached the main menu. The third passed the window attach and then hit a different crash about 80 s in: a jump to
0x468from the title's own code. That one is an older, intermittent High on Life start-up crash, seen on builds from before #5875 too, so it's not related to this change.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-17T05:29:16Z.
The same on Guardians of the Galaxy (PPSA01748), same tree as above (
f26eb67c8+ this PR), Guardians' own warm shader cache:std::_Rb_tree<…, VkPipeline_T*>::find(#6805), 1 × passesTested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by teepean on 2026-10-17T06:21:19Z.
Stray (PPSA02100), the title from #6805, on current
main6a32550fdwith and without this PR (83eb3ed04, merged locally). Linux (CachyOS, kernel 7.2.10), Ryzen 9 9950X, RTX 3090 (615.78.08), GCC Release, stock game config, no input, 90 s per run. All runs use a warm shader cache (3393 hits, 0 missesin the first 10 s),APS5_NO_IDLE_STORE=1(an unrelated Stray startup crash) andAPS5_PROFILE_DRAW=1.main6a32550fdmain6a32550fdAPS5_NO_LIBRARY_PREBUILD=1)main+ this PRmain+ this PRThe two crashes on
main, from the cores:_Rb_tree<…, VkPipeline_T*>::find←LinkPipelineFromLibraries←Pipeline::Prebuild←PrebuildGraphicsLibraries←PrebuildStageLibrary.corrupted double-linked listfromposix_memaligninsidelibnvidia-gpucomp.so, the other form @milescoviello saw on PS5LM.On the attach delay:
AwaitLibraryPrebuilds()runs inAttachWindowbefore the window device is constructed, so the gap between the last log line before the constructor and the constructor'sVulkanDevice constructor window=…line shows its cost. That gap is 0.27–0.32 s with the prebuild on, against 0.08 s with it off. So on Stray the drain costs about 0.2–0.25 s, far from the 67 s on GTA III, like Ghost of Tsushima and ProsperoEden in @milescoviello's runs.AI-assisted: yes (analysis and text written with Claude Code; the runs and core dumps are from my machine).
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-17T07:19:10Z.
Windows and AMD, on a title with no warm cache at all: ProsperoLight (PPSA99002, catalog 01.000.100), the stop I reported in the catalog update (
libSceAgcDriver.prx+0x19b24dinLinkPipelineFromLibraries).Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release. Tree:
main6a32550fd+ #6220 (libkernelsysctlonly, needed by another title on this build) on both sides; with this head83eb3ed04merged cleanly. Each cold run starts from an empty shader cache; audio muted.0xC0000374(heap corruption), three0xC0000005(inucrtbaseorlibstdc++)The update notice is for the current release, 01.000.110 (from the project's GitHub releases, SHA-256 checked). That release on the same tree with this PR, cold, 90 s: no crash, 8.0 FPS, and the dumped frames show its home screen ("Your PCs", "No PCs yet", tabs PCs, Games, Settings, About).
AI-assisted: yes (Claude Code).