fix(agc): keep shader modules of pipeline library parts alive for background linking #4445
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4445"
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 LeandroLP23 on 2026-10-12T11:48:25Z.
What
Fixes #4435. On AMD's Windows driver, 47 AGC tests have crashed inside
amdvlk64.dllsince #4152. The driver still reads a pipeline library part's shader modules during the background link-time-optimized link, afterPipelinehas destroyed them. Destroying them is legal Vulkan, so this works around a driver bug.#3173 handed the modules of each newly created part to the device's library store and destroyed them in
ClearPipelineLibraries. #4152 reworkedLinkPipelineFromLibrariesand that store went away. This puts it back on the current code:LinkPipelineFromLibrariestakes the caller's modules again. When background linking is on, it moves the ones a new part uses intoDeviceLibraries::modulesand clears them in the caller's span.Pipeline.cpppass_modules: the draw path and #4152's prebuild-at-registration path. Their existing destroy loops then skip the handed-over modules, since they areVK_NULL_HANDLE.ClearPipelineLibrariesdestroys the stored modules after the parts and layouts.A part that loses the race to another thread is destroyed as before, and its modules stay with the caller.
Tested
Radeon 860M (RDNA 3.5, AMD Windows driver 32.0.13058.8001), Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release. Tests run one at a time, with the shader cache emptied first.
ctest -R '^agc_' -j 1maine7c70a2dfamdvlk64.dll, 27 non-zero exits, 1 timeout)mainwithAPS5_NO_PIPELINE_LTO=1mainctest -E '^agc_' -j 4).tools/check_conventions.py --base mainandgit diff --checkpass.conventions_ci_gate. That test flags the pre-0ab2a04dbuild.ymlthe fork uses to run full builds, not this change.Upstream CI runs the GPU tests on lavapipe, which doesn't show the fault, so CI can't tell this change from
main.#4363 changes the same function (
LinkPipelineFromLibraries, the part keys). With it merged and without this change, the failing tests still fail. The two touch different lines, but whichever merges second may need a rebase.Checklist
main; no other open PR implements the same changeNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T15:53:06Z.
The crash also reaches titles. I re-ran the homebrew catalog sweep on AMD Windows (Radeon 860M, driver 32.0.13058.8001), one 60-second run per title, relinked with
--windows. Without this PR, onmaind592d54e1, four titles crash insideamdvlk64.dll:maind592d54e1main+ this PR0xc0000005at 12 s, ripamdvlk64.dll+0x2cc126d0xc0000005at 12 s, ripamdvlk64.dll+0x1bb64420xc0000005at 42 s, ripamdvlk64.dll+0x4bc8c00xc0000005at 27 s, ripamdvlk64.dll+0x4bc8c0Jelly5 and Emby5 ran 60 s on
main8c4a295ff, before #4152. Stremio Plus and EVO Player stopped earlier on thatmain, on AGC checks that were fixed since (#4030, #4245).Three more titles exit early on
mainand run 60 s with this PR, but their logs don't show where they stop, so I can't attribute them:0xc0000005at 22 s.AI-assisted: yes (Claude Code)