fix(agc): keep a shader library part's modules until the part is destroyed #3149
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3149"
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 poonasor on 2026-10-10T23:17:37Z.
What
Pipelinedestroys its shader modules right afterLinkPipelineFromLibrariesreturns, but the pre-rasterization and fragment shader library parts built from them stay cached and are relinked later by the backgroundVK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXTlink (#2713). On AMD's Windows driver that link faults insideamdvlk64.dll, at varying offsets, reading freed heap memory. Destroying a module after pipeline creation is valid Vulkan, so this looks like a driver defect; the change works around it.When the optimized link is enabled, the library store takes over the modules of each newly built shader part and destroys them in
ClearPipelineLibraries, after the pending links have finished. Modules of a pipeline whose parts all came from the cache are destroyed as before, and nothing changes withAPS5_NO_PIPELINE_LTO=1. Cost: one retainedVkShaderModuleper stage of each unique shader part, for the device's lifetime.This is the AMD half of #2777: #2869 fixed the destroyed layout, which did not change the AMD failures (as noted there and in #2755). Addresses the segfaults in #2944 and #2755.
How the cause was narrowed down (RX 6700 XT, on
57f96fd2+51078717,agc_driver_vertex_fetchandagc_driver_provoking_vertex):LinkPipelineFromLibrariesjob, insidevkCreateGraphicsPipelines.APS5_NO_PIPELINE_LTO=1: pass.VkPipelineCache: still faults 3/3.VK_LOADER_LAYERS_DISABLE=~implicit~): still faults.Tested
Windows 11 Pro 23H2 (22631), WinLibs GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON. AMD Radeon RX 6700 XT (Navi 22, 0x73df), Adrenalin 25.10.45.05 (driver 32.0.21045.5002), the only Vulkan device.%LOCALAPPDATA%\AMD\VkCacheemptied before eachagc_run,ctest -R "^agc_" -j1:main379d8b4eamdvlk64.dll, plussdwa_float_selectorsandsdwa_ldexp_f16main379d8b4e+ this PRpixel_interlock,sdwa_float_selectors,sdwa_ldexp_f16, no SEGFAULTThe 22:
agc_pipeline_cache,agc_pipeline_library, andagc_driver_mesh,conservative_rasterization,depth_bias_per_face,dual_source_blend,exec_host_lanes,ngg_vertex_wave_info,packed_unorm_color_target,pixel_fixed_point_position,pixel_helper_lanes,pixel_interlock,pixel_lds,pixel_lds_lane_slots,pixel_uint16_export,pixel_valid_mask,pixel_wave_reduction,prepared_exports,provoking_vertex,scalar_swappc_fetch,srgb8_color_target,vertex_fetch.Full parallel
ctestwith this PR (warm driver cache): 724 of 732 passed, 5 skipped (video_outflip tests,guest_video_out_wqhd_detection_no_vulkan), the same 3 failed.The 3 remaining failures are wrong results, not faults, and are not addressed here: the two
sdwaf16 ones are the values already in #2944;pixel_interlockno longer faults and fails withpixel interlock wave64 BDA fault: pixel 0 counted 1 of 0 overlapping read-modify-writes, which it also does withAPS5_NO_PIPELINE_LTO=1.Title: Dreaming Sarah (PPSA02929), which faulted in
amdvlk64.dll+0x21eef34at its first graphics submission on this machine (discussion #3018), relinked against this build runs for 90 s with no fault in the log. I did not check the rendered output.Not tested on NVIDIA, Intel or Linux.
python tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T23:17:59Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by poonasor on 2026-10-11T00:04:08Z.
For when intake reopens: this fixes the
amdvlk64.dllsegfaults reported in #2944 (and matches #2755 / the AMD half of #2777). Title confirmation: Dreaming Sarah is playable on the RX 6700 XT with this commit, see discussion #3018. The branch stays available atpoonasor:fix/agc-library-module-lifetime.AI-assisted (Claude Code).
Pull request closed