fix(agc): build pipeline library shader parts for the draw's depth format #4363

Merged
johnmaia merged 1 commit from upstream-pr/4363 into main 2026-10-13 04:53:05 +00:00
johnmaia commented 2026-10-12 07:42:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-12T07:42:23Z.


What

LinkPipelineFromLibraries built the pre-rasterization and fragment shader libraries with an empty VkPipelineRenderingCreateInfo, so those parts had VK_FORMAT_UNDEFINED depth and stencil even when the fragment output library and the draw had a depth target. On RADV a pipeline fast-linked from such parts hangs the GPU at its first draw (ring gfx_0.0.0 timeout, no page fault).

The shader parts now get the draw's view mask and depth and stencil formats, and those three values join their cache key. Color formats stay out of it, so fragment shader parts are still shared across color target formats.

Rebased on #4152: the attachment key is combined with each part's own layout key. Shader parts that #4152 prebuilds at registration have no depth target, so a draw with a depth target builds its own.

Tested

Linux, RX 7600 (RADV NAVI33, Mesa 25.2.8).

  • agc_driver_recorder_tests --pipeline-library-only gets a check that a depth target builds new pre-rasterization and fragment shader parts. It fails on main ("a depth target shared the shader libraries built with no depth format") and passes with this change. The full agc_driver_recorder_tests run and all agc ctests (434) pass after the rebase on e7c70a2df; the pipeline-library tests also pass with APS5_NO_PIPELINE_LTO=1.
  • Epic Mickey (PPSA15657) on main + #3763 + #2904 + #425 (plain main stops earlier on "color views of several array slices are unsupported"), same save, level load:
Run Result
default GPU hang at the first translucency lighting volume pass
RADV_DEBUG=syncshaders hang
APS5_NO_GPL=1 no hang
APS5_NO_PIPELINE_LTO=1 (fast-linked pipelines only) hang within seconds of boot
APS5_NO_PIPELINE_LTO=1 + this change no hang, 1,500 s, 3,584 lighting volume passes
default + this change no hang, 1,200 s, 2,617 lighting volume passes

Bisecting the fast-link-only run by shader hash found several independent culprits (depth-only shadow and G-buffer pipelines); all had a depth target.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826389763 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4363). Originally posted by [johnmaia](https://github.com/johnmaia) on 2026-10-12T07:42:23Z. --- ### What `LinkPipelineFromLibraries` built the pre-rasterization and fragment shader libraries with an empty `VkPipelineRenderingCreateInfo`, so those parts had `VK_FORMAT_UNDEFINED` depth and stencil even when the fragment output library and the draw had a depth target. On RADV a pipeline fast-linked from such parts hangs the GPU at its first draw (`ring gfx_0.0.0 timeout`, no page fault). The shader parts now get the draw's view mask and depth and stencil formats, and those three values join their cache key. Color formats stay out of it, so fragment shader parts are still shared across color target formats. Rebased on #4152: the attachment key is combined with each part's own layout key. Shader parts that #4152 prebuilds at registration have no depth target, so a draw with a depth target builds its own. ### Tested Linux, RX 7600 (RADV NAVI33, Mesa 25.2.8). - `agc_driver_recorder_tests --pipeline-library-only` gets a check that a depth target builds new pre-rasterization and fragment shader parts. It fails on main ("a depth target shared the shader libraries built with no depth format") and passes with this change. The full `agc_driver_recorder_tests` run and all `agc` ctests (434) pass after the rebase on `e7c70a2df`; the pipeline-library tests also pass with `APS5_NO_PIPELINE_LTO=1`. - Epic Mickey (PPSA15657) on main + #3763 + #2904 + #425 (plain main stops earlier on "color views of several array slices are unsupported"), same save, level load: | Run | Result | |---|---| | default | GPU hang at the first translucency lighting volume pass | | `RADV_DEBUG=syncshaders` | hang | | `APS5_NO_GPL=1` | no hang | | `APS5_NO_PIPELINE_LTO=1` (fast-linked pipelines only) | hang within seconds of boot | | `APS5_NO_PIPELINE_LTO=1` + this change | no hang, 1,500 s, 3,584 lighting volume passes | | default + this change | no hang, 1,200 s, 2,617 lighting volume passes | Bisecting the fast-link-only run by shader hash found several independent culprits (depth-only shadow and G-buffer pipelines); all had a depth target. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-12 07:43:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T07:43:34Z.


The conventions checks fail for five findings: the PR template sections What, Tested, and Checklist are not recognized because the body does not use the required ### headings, and the two new inline comments in PipelineLibrary.cpp violate the repository comment rule (comments must document technical debt in docs/dev/TechnicalDebt.md). Could you use the template headings and either move the implementation rationale to the PR description or document actual remaining debt in that file? Please also include Depends on: none (or the relevant PR) and AI-assisted: yes in the checklist.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119945682 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4363#issuecomment-6119945682). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T07:43:34Z. --- The conventions checks fail for five findings: the PR template sections `What`, `Tested`, and `Checklist` are not recognized because the body does not use the required `###` headings, and the two new inline comments in `PipelineLibrary.cpp` violate the repository comment rule (comments must document technical debt in `docs/dev/TechnicalDebt.md`). Could you use the template headings and either move the implementation rationale to the PR description or document actual remaining debt in that file? Please also include `Depends on: none` (or the relevant PR) and `AI-assisted: yes` in the checklist.
MarcZX10 commented 2026-10-12 08:07:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:07:00Z.


The current conventions check is failing on two removable source comments at PipelineLibrary.cpp:138–139 (comments must be limited to technical debt, or removed) and the PR body is missing the required What, Tested, and Checklist sections. The other reported checks are passing. Please update those items and rerun conventions.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120266678 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4363#issuecomment-6120266678). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:07:00Z. --- The current conventions check is failing on two removable source comments at `PipelineLibrary.cpp:138–139` (comments must be limited to technical debt, or removed) and the PR body is missing the required `What`, `Tested`, and `Checklist` sections. The other reported checks are passing. Please update those items and rerun conventions.
kr4y4 commented 2026-10-12 18:51:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-12T18:51:00Z.


Windows run on NVIDIA and Intel, since the description's run was on RADV.

Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU, both with graphics pipeline libraries. The head 0b46084c9 merged into main 2a5eca11c.

  • agc_pipeline_library, agc_pipeline_library_off, agc_pipeline_library_fast_only, agc_pipeline_cache and agc_driver_graphics pass on both GPUs with --repeat until-fail:3. The three pipeline-library tests also pass three times each with APS5_NO_PIPELINE_LTO=1.
  • With main's PipelineLibrary.cpp and the new check, agc_pipeline_library fails on both GPUs: a depth target shared the shader libraries built with no depth format.
  • Full suite (ctest --timeout 120 --parallel 4): 973 of 973 on the RTX 4070. On the iGPU 972 of 973; the one failure, agc_driver_f32_dot2_rounding, fails the same way on main (no shaderFloat64, #4528).
  • Under the Khronos validation layer 1.4.363 (errors and warnings), agc_driver_recorder_tests --pipeline-library-only logs nothing on either GPU, with this change or with main's PipelineLibrary.cpp. With main's file, the draw with the depth target links before the check fails, so the layer doesn't flag shader parts built with no depth format. Neither GPU hung.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6130559657 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4363#issuecomment-6130559657). Originally posted by [kr4y4](https://github.com/kr4y4) on 2026-10-12T18:51:00Z. --- Windows run on NVIDIA and Intel, since the description's run was on RADV. Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU, both with graphics pipeline libraries. The head 0b46084c9 merged into `main` 2a5eca11c. - `agc_pipeline_library`, `agc_pipeline_library_off`, `agc_pipeline_library_fast_only`, `agc_pipeline_cache` and `agc_driver_graphics` pass on both GPUs with `--repeat until-fail:3`. The three pipeline-library tests also pass three times each with `APS5_NO_PIPELINE_LTO=1`. - With `main`'s `PipelineLibrary.cpp` and the new check, `agc_pipeline_library` fails on both GPUs: `a depth target shared the shader libraries built with no depth format`. - Full suite (`ctest --timeout 120 --parallel 4`): 973 of 973 on the RTX 4070. On the iGPU 972 of 973; the one failure, `agc_driver_f32_dot2_rounding`, fails the same way on `main` (no `shaderFloat64`, #4528). - Under the Khronos validation layer 1.4.363 (errors and warnings), `agc_driver_recorder_tests --pipeline-library-only` logs nothing on either GPU, with this change or with `main`'s `PipelineLibrary.cpp`. With `main`'s file, the draw with the depth target links before the check fails, so the layer doesn't flag shader parts built with no depth format. Neither GPU hung. Written with AI assistance.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4363
No description provided.