fix(agc): skip the background pipeline relink on NVIDIA's proprietary driver #3434

Merged
Yuva1024 merged 2 commits from upstream-pr/3434 into main 2026-10-11 11:49:44 +00:00
Yuva1024 commented 2026-10-11 10:30:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Yuva1024 on 2026-10-11T10:30:32Z.


What

Works around #2866 for NVIDIA's proprietary driver by not queuing the background link-time-optimized relink of pipelines built from libraries. The fast-linked pipeline stays in use; the relink is the only thing skipped.

  • PipelineLinkTimeOptimizationUsable(VkDriverId) returns false for VK_DRIVER_ID_NVIDIA_PROPRIETARY and true for every other driver, next to the existing FragmentShaderBarycentricUsable and NarrowSubgroupClock quirks.
  • The device reads the driver ID where it enables the graphics pipeline library, and passes the result to the graphics Context. If VK_KHR_driver_properties is absent the relink stays on.
  • LinkPipelineFromLibraries queues the relink only when the context allows it. APS5_NO_PIPELINE_LTO still disables it everywhere.
  • agc_pipeline_link_optimization tests the driver table. The pipeline library test now expects no relink when the context disallows it.

Why: on an RTX 4060 the optimized link loses the device (vkWaitForFences graphics: Vulkan result -4) when it is bound, even for a color-only pipeline with no depth attachment, so #2866's depth-attachment workaround does not cover it. A masked pixel shader (kill) drawn twice loses the device on its second draw in 6 of 6 runs at wave64 and wave32; the same shader without the kill, drawn six times, does not.

The scope is wider than the evidence: it covers every GPU on NVIDIA's proprietary driver. The reports so far are Ada (this PR) and Ampere (#2866) losing the device, and two Blackwell cards (RTX 5060 and RTX 5080) not losing it on the same driver. There is no standard Vulkan query for the architecture, so I did not guess at device ID ranges. If maintainers have a reliable way to separate Blackwell, the table is the one place to narrow.

Tested

Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, RTX 4060 (Ada, driver 617.42), rebased on main a7d80e74.

  • agc_driver_pixel_valid_mask: before 0 of 20 pass (16 of 20 failed on main ac2c5c08, 0 of 20 pass on the later base used for the A/B). After 30 of 30 pass.
  • Full ctest --parallel 3: 827 of 828 pass. The failure is windows_exceptions (exit 0xc0000409), which fails the same way without this change and is reported in #3411 with a fix in #3415. Five video_out tests are skipped, as on main.
  • tools/check_conventions.py --base origin/main passes; tools/check_test_registration.py reports no new unregistered test.
  • Not tested: Linux, AMD, Intel, Ampere, Blackwell.

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:4818406348 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3434). Originally posted by [Yuva1024](https://github.com/Yuva1024) on 2026-10-11T10:30:32Z. --- ### What Works around #2866 for NVIDIA's proprietary driver by not queuing the background link-time-optimized relink of pipelines built from libraries. The fast-linked pipeline stays in use; the relink is the only thing skipped. - `PipelineLinkTimeOptimizationUsable(VkDriverId)` returns false for `VK_DRIVER_ID_NVIDIA_PROPRIETARY` and true for every other driver, next to the existing `FragmentShaderBarycentricUsable` and `NarrowSubgroupClock` quirks. - The device reads the driver ID where it enables the graphics pipeline library, and passes the result to the graphics `Context`. If `VK_KHR_driver_properties` is absent the relink stays on. - `LinkPipelineFromLibraries` queues the relink only when the context allows it. `APS5_NO_PIPELINE_LTO` still disables it everywhere. - `agc_pipeline_link_optimization` tests the driver table. The pipeline library test now expects no relink when the context disallows it. Why: on an RTX 4060 the optimized link loses the device (`vkWaitForFences graphics: Vulkan result -4`) when it is bound, even for a color-only pipeline with no depth attachment, so #2866's depth-attachment workaround does not cover it. A masked pixel shader (kill) drawn twice loses the device on its second draw in 6 of 6 runs at wave64 and wave32; the same shader without the kill, drawn six times, does not. The scope is wider than the evidence: it covers every GPU on NVIDIA's proprietary driver. The reports so far are Ada (this PR) and Ampere (#2866) losing the device, and two Blackwell cards (RTX 5060 and RTX 5080) not losing it on the same driver. There is no standard Vulkan query for the architecture, so I did not guess at device ID ranges. If maintainers have a reliable way to separate Blackwell, the table is the one place to narrow. ### Tested Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, RTX 4060 (Ada, driver 617.42), rebased on `main` a7d80e74. - `agc_driver_pixel_valid_mask`: before 0 of 20 pass (16 of 20 failed on `main` ac2c5c08, 0 of 20 pass on the later base used for the A/B). After 30 of 30 pass. - Full `ctest --parallel 3`: 827 of 828 pass. The failure is `windows_exceptions` (exit 0xc0000409), which fails the same way without this change and is reported in #3411 with a fix in #3415. Five `video_out` tests are skipped, as on `main`. - `tools/check_conventions.py --base origin/main` passes; `tools/check_test_registration.py` reports no new unregistered test. - Not tested: Linux, AMD, Intel, Ampere, Blackwell. ### 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)
adriadam10 commented 2026-10-11 11:45:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:45:01Z.


Checked the driver table test (it fails if NVIDIA is not excluded), the scoped Linux build and ctest after rebasing on main; all pass. The change only skips the background relink, so the fast-linked pipeline and its results are unchanged.

Added a TechnicalDebt line (Functional): the skip covers every GPU on NVIDIA's proprietary driver while the reports are Ampere (#2866) and Ada (this PR), with Blackwell not affected, so the scope is wider than the evidence.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108673027 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3434#issuecomment-6108673027). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T11:45:01Z. --- Checked the driver table test (it fails if NVIDIA is not excluded), the scoped Linux build and ctest after rebasing on `main`; all pass. The change only skips the background relink, so the fast-linked pipeline and its results are unchanged. Added a TechnicalDebt line (Functional): the skip covers every GPU on NVIDIA's proprietary driver while the reports are Ampere (#2866) and Ada (this PR), with Blackwell not affected, so the scope is wider than the evidence. Merging once CI is green.
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!3434
No description provided.