agc: background LTO relink loses the device for pipelines with a depth attachment (NVIDIA) #2866

Open
opened 2026-10-10 16:53:53 +00:00 by ps54all · 14 comments
ps54all commented 2026-10-10 16:53:53 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-10T16:53:53Z.


After perf(agc): relink library pipelines with link-time optimization in the background (#2713), a pipeline built from libraries that renders to a depth attachment hits VK_ERROR_DEVICE_LOST the first time the optimized pipeline is bound (AGC graphics: vkWaitForFences graphics: Vulkan result -4).

Reproduced on origin/main eb94c554d, RTX 3080, Windows, with a minimal execution test: one color target plus one D32_SFLOAT (also D16_UNORM) depth target, a triangle list, several draws with WaitIdle after each. The first draws use the fast-linked pipeline and succeed; the first draw after the background relink finishes loses the device.

What changes the outcome

  • No depth attachment: works.
  • Depth attachment with depth test and depth write both off: still fails. It is the attachment, not the depth state; HTILE is not involved either.
  • APS5_NO_PIPELINE_LTO=1: works.
  • Relinking without VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT: works.
  • Binding only the fast-linked pipeline (ignoring the optimized handle): works.

Tried without effect: VkPipelineRenderingCreateInfo on the fragment shader or all library parts, or chained into the LTO link; making depth test/write/compare static; dropping the stencil and depth-bounds dynamic state commands; a zeroed depth-stencil state for the fragment shader library.

Workaround (local branch, not proposed as the fix): skip the background relink when rendering.depthAttachmentFormat or stencilAttachmentFormat is not VK_FORMAT_UNDEFINED.

The existing library tests only count optimized and never execute an optimized pipeline with a depth target; a test that draws twice into a depth target after WaitForOptimizedPipelines reproduces it.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5793339429 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-10T16:53:53Z. --- After `perf(agc): relink library pipelines with link-time optimization in the background` (#2713), a pipeline built from libraries that renders to a depth attachment hits `VK_ERROR_DEVICE_LOST` the first time the optimized pipeline is bound (`AGC graphics: vkWaitForFences graphics: Vulkan result -4`). **Reproduced** on origin/main `eb94c554d`, RTX 3080, Windows, with a minimal execution test: one color target plus one `D32_SFLOAT` (also `D16_UNORM`) depth target, a triangle list, several draws with `WaitIdle` after each. The first draws use the fast-linked pipeline and succeed; the first draw after the background relink finishes loses the device. **What changes the outcome** - No depth attachment: works. - Depth attachment with depth test and depth write both off: still fails. It is the attachment, not the depth state; HTILE is not involved either. - `APS5_NO_PIPELINE_LTO=1`: works. - Relinking without `VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT`: works. - Binding only the fast-linked pipeline (ignoring the optimized handle): works. **Tried without effect:** `VkPipelineRenderingCreateInfo` on the fragment shader or all library parts, or chained into the LTO link; making depth test/write/compare static; dropping the stencil and depth-bounds dynamic state commands; a zeroed depth-stencil state for the fragment shader library. **Workaround** (local branch, not proposed as the fix): skip the background relink when `rendering.depthAttachmentFormat` or `stencilAttachmentFormat` is not `VK_FORMAT_UNDEFINED`. The existing library tests only count `optimized` and never execute an optimized pipeline with a depth target; a test that draws twice into a depth target after `WaitForOptimizedPipelines` reproduces it.
Silverash-i8 commented 2026-10-10 17:24:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T17:24:30Z.


A data point from a different NVIDIA card: I can't reproduce this on an RTX 5060 Laptop GPU (Blackwell, driver 617.42), Windows 11, main 57f96fd2, LTO on.

I used agc_driver_depth_bias_per_face as the depth test, since it draws into a D32_SFLOAT target with depth test on. Its per-face draws don't use libraries (depthBiasPerFace opts out), but the "both faces pulled closer" draw does. I drew that one, slept 2 s, and drew it again, with a temporary print in Pipeline::Continue to confirm what was bound. The second draw binds the optimized pipeline (libraries=1 optimized=1), finishes, and gives the right pixels. With depth writes turned on as well, the optimized draw still completes. The colors change because the test's expectations assume no depth writes, but it's the same result as with APS5_NO_PIPELINE_LTO=1, and there's no device loss.

So on this setup a library-linked pipeline with a depth attachment survives the LTO relink. That points at something specific to your card or driver (RTX 3080, Ampere), or at a state your test sets that this one doesn't. Which driver version were you on? And if you can push the minimal test somewhere, I'm happy to run it as-is on this card and on the Arrow Lake iGPU in the same laptop.

AI-assisted (Claude Code); I ran the above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100214664 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6100214664). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-10T17:24:30Z. --- A data point from a different NVIDIA card: I can't reproduce this on an RTX 5060 Laptop GPU (Blackwell, driver 617.42), Windows 11, `main` `57f96fd2`, LTO on. I used `agc_driver_depth_bias_per_face` as the depth test, since it draws into a `D32_SFLOAT` target with depth test on. Its per-face draws don't use libraries (`depthBiasPerFace` opts out), but the "both faces pulled closer" draw does. I drew that one, slept 2 s, and drew it again, with a temporary print in `Pipeline::Continue` to confirm what was bound. The second draw binds the optimized pipeline (`libraries=1 optimized=1`), finishes, and gives the right pixels. With depth writes turned on as well, the optimized draw still completes. The colors change because the test's expectations assume no depth writes, but it's the same result as with `APS5_NO_PIPELINE_LTO=1`, and there's no device loss. So on this setup a library-linked pipeline with a depth attachment survives the LTO relink. That points at something specific to your card or driver (RTX 3080, Ampere), or at a state your test sets that this one doesn't. Which driver version were you on? And if you can push the minimal test somewhere, I'm happy to run it as-is on this card and on the Arrow Lake iGPU in the same laptop. AI-assisted (Claude Code); I ran the above on my machine.
fma-rc commented 2026-10-10 18:04:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-10T18:04:18Z.


Linux data point: it does not reproduce on an RTX 5080 either, so with the report above that is two Blackwell cards without the loss, on both operating systems.

Setup: main 57f96fd2, Arch Linux 7.2.9, GCC 16.2.1, Release. RTX 5080 (NVIDIA 615.78.08) and Radeon 610M (RADV, Mesa 26.1.4).

Test (temporary): the "both faces pulled closer" draw of agc_driver_depth_bias_per_face (color target plus D32_SFLOAT depth target, triangle list, pipeline built from libraries), drawn once, then a 3 s sleep, then five more times, with WaitIdle and a pixel check after each draw. A temporary print where Pipeline.cpp picks the handle to bind shows which pipeline each draw used.

Run RTX 5080 RADV, Radeon 610M
as is (depth test on, depth write off) 6 of 6 draws correct; draws 2 to 6 bind the optimized pipeline same
depth test off 6 of 6 correct; draws 2 to 6 bind the optimized pipeline 6 of 6 correct; 1 draw binds the optimized pipeline
APS5_NO_PIPELINE_LTO=1 6 of 6 correct; no draw binds an optimized pipeline same

No VK_ERROR_DEVICE_LOST in any run.

Not run: depth writes on, D16_UNORM, an RTX 30-series card, Windows.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100568485 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6100568485). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-10T18:04:18Z. --- Linux data point: it does not reproduce on an RTX 5080 either, so with the report above that is two Blackwell cards without the loss, on both operating systems. **Setup:** `main` 57f96fd2, Arch Linux 7.2.9, GCC 16.2.1, Release. RTX 5080 (NVIDIA 615.78.08) and Radeon 610M (RADV, Mesa 26.1.4). **Test (temporary):** the "both faces pulled closer" draw of `agc_driver_depth_bias_per_face` (color target plus `D32_SFLOAT` depth target, triangle list, pipeline built from libraries), drawn once, then a 3 s sleep, then five more times, with `WaitIdle` and a pixel check after each draw. A temporary print where `Pipeline.cpp` picks the handle to bind shows which pipeline each draw used. | Run | RTX 5080 | RADV, Radeon 610M | |---|---|---| | as is (depth test on, depth write off) | 6 of 6 draws correct; draws 2 to 6 bind the optimized pipeline | same | | depth test off | 6 of 6 correct; draws 2 to 6 bind the optimized pipeline | 6 of 6 correct; 1 draw binds the optimized pipeline | | `APS5_NO_PIPELINE_LTO=1` | 6 of 6 correct; no draw binds an optimized pipeline | same | No `VK_ERROR_DEVICE_LOST` in any run. **Not run:** depth writes on, `D16_UNORM`, an RTX 30-series card, Windows. AI-assisted: yes
ps54all commented 2026-10-11 07:04:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-11T07:04:33Z.


Thanks for testing, both. Our card is an RTX 3080 (Ampere), driver 610.74, Windows 11, so two Blackwell cards without the loss fits a driver or architecture specific problem rather than a generic one. Not yet run on our side: depth writes on, D16_UNORM, and a second driver version. The minimal reproduction is a depth-tested draw (no HTILE, D32 or D16, even with the depth test off) on a library-linked pipeline after the background LTO relink finished; color-only draws survive. We skip the relink when the pipeline has a depth or stencil attachment as a local workaround and the problem disappears. If either of you has an Ampere or Ada card to try, that would settle whether it is the generation.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106500535 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6106500535). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-11T07:04:33Z. --- Thanks for testing, both. Our card is an RTX 3080 (Ampere), driver 610.74, Windows 11, so two Blackwell cards without the loss fits a driver or architecture specific problem rather than a generic one. Not yet run on our side: depth writes on, `D16_UNORM`, and a second driver version. The minimal reproduction is a depth-tested draw (no HTILE, D32 or D16, even with the depth test off) on a library-linked pipeline after the background LTO relink finished; color-only draws survive. We skip the relink when the pipeline has a depth or stencil attachment as a local workaround and the problem disappears. If either of you has an Ampere or Ada card to try, that would settle whether it is the generation. Written with AI assistance.
Yuva1024 commented 2026-10-11 09:36:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Yuva1024 on 2026-10-11T09:36:55Z.


Data point from an Ada card, and the loss does not need a depth attachment.

Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, RTX 4060 (Ada, driver 617.42), main ac2c5c08. The test is the existing agc_driver_pixel_valid_mask (tests/execution/PixelValidMask.cpp): one R8G8B8A8_UNORM color target, no depth or stencil attachment, four draws with WaitIdle after each.

  • Default: 16 of 20 runs fail with AGC graphics: vkWaitForFences graphics: Vulkan result -4.
  • APS5_NO_PIPELINE_LTO=1: 20 of 20 pass.
  • Full ctest --parallel 3 on that build: 816 of 817 pass; this is the one failure. It also fails when run alone.
  • Temporary print in Pipeline::Continue: draws 1 and 2 bind the fast-linked pipeline (optimized handle null) and pass; draws 3 and 4 bind the optimized handle. Draw 3 passes. Draw 4 (wave32, the masked pixel shader) loses the device in every traced run (6 of 6).
  • A 1.5 s sleep before each draw did not avoid it (3 of 3 failed), so it does not look like a compile running at the same time as the draw.
  • Skipping the background relink when depthAttachmentFormat or stencilAttachmentFormat is set, as in the workaround above, changes nothing here: 0 of 30 passed, because this test has no depth attachment.

So on this card the loss happens for a color-only pipeline too, and only when the optimized link is bound. I have not found why, and I have no fix to propose. I did not test other drivers or the Ampere card from the report.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107651952 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6107651952). Originally posted by [Yuva1024](https://github.com/Yuva1024) on 2026-10-11T09:36:55Z. --- Data point from an Ada card, and the loss does not need a depth attachment. Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, RTX 4060 (Ada, driver 617.42), `main` ac2c5c08. The test is the existing `agc_driver_pixel_valid_mask` (`tests/execution/PixelValidMask.cpp`): one R8G8B8A8_UNORM color target, no depth or stencil attachment, four draws with `WaitIdle` after each. - Default: 16 of 20 runs fail with `AGC graphics: vkWaitForFences graphics: Vulkan result -4`. - `APS5_NO_PIPELINE_LTO=1`: 20 of 20 pass. - Full `ctest --parallel 3` on that build: 816 of 817 pass; this is the one failure. It also fails when run alone. - Temporary print in `Pipeline::Continue`: draws 1 and 2 bind the fast-linked pipeline (optimized handle null) and pass; draws 3 and 4 bind the optimized handle. Draw 3 passes. Draw 4 (wave32, the masked pixel shader) loses the device in every traced run (6 of 6). - A 1.5 s sleep before each draw did not avoid it (3 of 3 failed), so it does not look like a compile running at the same time as the draw. - Skipping the background relink when `depthAttachmentFormat` or `stencilAttachmentFormat` is set, as in the workaround above, changes nothing here: 0 of 30 passed, because this test has no depth attachment. So on this card the loss happens for a color-only pipeline too, and only when the optimized link is bound. I have not found why, and I have no fix to propose. I did not test other drivers or the Ampere card from the report. AI-assisted: yes (Claude Code).
Silverash-i8 commented 2026-10-11 09:42:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T09:42:53Z.


Same driver, different architecture: RTX 5060 Laptop (Blackwell), driver 617.42 like your RTX 4060, Windows 11, WinLibs GCC 15.2.0 r7, Release, main 9a1f6f44, default settings (pipeline LTO on, no APS5_NO_PIPELINE_LTO): agc_driver_pixel_valid_mask passes 20 of 20.

So with the driver held constant, Ada (your 4060, 16 of 20 failing) loses the device and Blackwell doesn't, which fits the earlier picture of the Ampere report failing and two Blackwell cards passing. That points at something architecture-specific in how the optimized link is compiled or run, not a driver-wide problem. I didn't add a trace of which handle is bound, so I can't say whether draw 4 here also uses the optimized pipeline, only that it doesn't lose the device.

AI-assisted (Claude Code); I ran this on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107695715 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6107695715). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-11T09:42:53Z. --- Same driver, different architecture: RTX 5060 Laptop (Blackwell), driver **617.42** like your RTX 4060, Windows 11, WinLibs GCC 15.2.0 r7, Release, `main` 9a1f6f44, default settings (pipeline LTO on, no `APS5_NO_PIPELINE_LTO`): `agc_driver_pixel_valid_mask` passes **20 of 20**. So with the driver held constant, Ada (your 4060, 16 of 20 failing) loses the device and Blackwell doesn't, which fits the earlier picture of the Ampere report failing and two Blackwell cards passing. That points at something architecture-specific in how the optimized link is compiled or run, not a driver-wide problem. I didn't add a trace of which handle is bound, so I can't say whether draw 4 here also uses the optimized pipeline, only that it doesn't lose the device. AI-assisted (Claude Code); I ran this on my machine.
ps54all commented 2026-10-11 15:14:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-11T15:14:40Z.


Another data point, Ampere this time: RTX 3080, driver 610.74, Windows 11, WinLibs GCC 15.2.0, Release, default settings (pipeline LTO on). agc_driver_pixel_valid_mask passes 20 of 20 here, and the full ctest run does not lose the device in it. Silksong at its menu also holds 59.9 FPS with LTO on.

So the table is now: Ada 4060 on 617.42 fails (16 of 20), Blackwell 5060 on 617.42 passes, Ampere 3080 on 610.74 passes. That leaves two variables I cannot separate from here, the architecture and the driver branch (610 against 617). Someone with an Ampere or Ada card on both driver branches would settle it; I only have the 610.74 install.

AI-assisted (Claude Code); I ran this on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110471058 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6110471058). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-11T15:14:40Z. --- Another data point, Ampere this time: RTX 3080, driver 610.74, Windows 11, WinLibs GCC 15.2.0, Release, default settings (pipeline LTO on). `agc_driver_pixel_valid_mask` passes 20 of 20 here, and the full ctest run does not lose the device in it. Silksong at its menu also holds 59.9 FPS with LTO on. So the table is now: Ada 4060 on 617.42 fails (16 of 20), Blackwell 5060 on 617.42 passes, Ampere 3080 on 610.74 passes. That leaves two variables I cannot separate from here, the architecture and the driver branch (610 against 617). Someone with an Ampere or Ada card on both driver branches would settle it; I only have the 610.74 install. AI-assisted (Claude Code); I ran this on my machine.
pipe1os commented 2026-10-12 05:51:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by pipe1os on 2026-10-12T05:51:15Z.


Data point from the same GPU model and driver as the failing report: RTX 4060 desktop (Ada, PCI device 0x2882), driver 617.42, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release. It does not lose the device.

  • main ac2c5c08 (the commit from the report), default settings: agc_driver_pixel_valid_mask passes 20 of 20 through ctest.
  • Same build with a temporary print in Pipeline::Continue: draw 4 (wave32, masked pixel shader) bound the optimized handle in 22 of 30 runs, and all 30 runs passed. In the other 8 the relink had not finished yet, so draw 4 used the fast-linked pipeline.
  • Current main 7a84b2226 with the NVIDIA gate from #3434 bypassed locally: 20 of 20 pass, with the masked draw repeated 6 times per wave size. Same on driver 616.56 before upgrading.

So Ada on 617.42 is not enough to reproduce it; something else on the failing machine matters. @Yuva1024, is yours a laptop 4060? The deviceID from vulkaninfo --summary would tell.

I also have a local change that emits OpTerminateInvocation instead of OpKill when VK_KHR_shader_terminate_invocation is available, since #3434 says only kill shaders lose the device. It passes here, but I can't reproduce the loss, so I can't tell whether it helps. If you can run it on your machine, I'll push the branch.

AI-assisted (Claude Code); I ran the above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118568348 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6118568348). Originally posted by [pipe1os](https://github.com/pipe1os) on 2026-10-12T05:51:15Z. --- Data point from the same GPU model and driver as the failing report: RTX 4060 desktop (Ada, PCI device 0x2882), driver 617.42, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release. It does not lose the device. - `main` ac2c5c08 (the commit from the report), default settings: `agc_driver_pixel_valid_mask` passes 20 of 20 through ctest. - Same build with a temporary print in `Pipeline::Continue`: draw 4 (wave32, masked pixel shader) bound the optimized handle in 22 of 30 runs, and all 30 runs passed. In the other 8 the relink had not finished yet, so draw 4 used the fast-linked pipeline. - Current `main` 7a84b2226 with the NVIDIA gate from #3434 bypassed locally: 20 of 20 pass, with the masked draw repeated 6 times per wave size. Same on driver 616.56 before upgrading. So Ada on 617.42 is not enough to reproduce it; something else on the failing machine matters. @Yuva1024, is yours a laptop 4060? The `deviceID` from `vulkaninfo --summary` would tell. I also have a local change that emits `OpTerminateInvocation` instead of `OpKill` when `VK_KHR_shader_terminate_invocation` is available, since #3434 says only kill shaders lose the device. It passes here, but I can't reproduce the loss, so I can't tell whether it helps. If you can run it on your machine, I'll push the branch. AI-assisted (Claude Code); I ran the above on my machine.
simonbbby commented 2026-10-12 13:04:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-12T13:04:58Z.


An RTX 3090 (Ampere, GA102, device 0x2204) on Linux with NVIDIA 595.99.02 does not lose the device. Every case that binds the optimized LTO pipeline passes on current main, on eb94c554d from the report, and on Yuva1024's ac2c5c08.

Setup: Ubuntu 24.04, Linux 7.0, GCC 13.3, Release with BUILD_TESTING=ON and ANYPS5_ENABLE_SPIRV_TOOLS=ON. main is ffa19840. The 59 commits since then, up to 33ae282e, don't touch the shader recompiler. Under libSceAgcDriver they only add a --prepare flag to the agc_shader_replay tool.

Readback test from #3741, --force-lto, 20 runs per cell:

Tree d32 d16 color32 color64
main ffa19840 20/20 20/20 20/20 20/20
main, APS5_NO_PIPELINE_LTO=1 20/20 20/20 20/20 20/20
main + #4445 (2919dd38) 20/20 20/20 20/20 20/20
main + #4363 (0b46084c) 20/20 20/20 20/20 20/20
eb94c554d (no gate, LTO on), test ported 20/20 20/20 20/20 20/20
eb94c554d, APS5_NO_PIPELINE_LTO=1 20/20 20/20 20/20 20/20

Every LTO-on run printed pipeline readback passed: fast draws 1, optimized draws 1, optimized creations 1, so each run drew with the optimized handle. Without --force-lto, all 8 readback ctests on main print LTO disabled (production policy), so the #3434 gate is active on 595.

agc_driver_pixel_valid_mask with LTO on:

  • ac2c5c08, unmodified: 20 of 20 pass through ctest.
  • ac2c5c08 with a temporary print in Pipeline::Continue: 30 of 30 pass. Draw 4 (wave32, masked pixel shader) bound the optimized handle in 30 of 30 runs, and draw 3 in 29 of 30. A draw gets the optimized handle only if its background link has finished, so this count depends on host load. Those 30 runs were at load average 17. In 10 later runs at load average 54, draw 4 got the optimized handle in 8, and all 10 passed.
  • eb94c554d: 20 of 20.
  • main with the gate bypassed (true || in front of PipelineLinkTimeOptimizationUsable at VulkanDevice.cpp:1317): 20 of 20, with draws 3 and 4 optimized in all 20.

Full ctest on the 3090 (ANYPS5_REQUIRE_VULKAN=1, --parallel 8 --timeout 300): 0 failures out of 957, both with the gate and with the gate bypassed. Each run passed 947 tests and skipped 10. agc_driver_stencil_ref_export skipped because the 3090 lacks VK_EXT_shader_stencil_export, and 9 video_out tests skipped because SDL's offscreen driver has no Vulkan here. A traced gate-bypassed run had the same counts and drew 216 times with an optimized pipeline across 37 tests. Examples: pixel_wave_reduction (58), depth_fast_clear_submit (13), color1555_target (12), depth_fast_clear (6).

No run logged Vulkan result -4, and the kernel log has no NVRM Xid lines for the whole session.

Two side results:

  • On main, Pipeline.cpp destroys the shader modules right after LinkPipelineFromLibraries returns, and the readback test holds the LTO create until after the first draw. So the main arm linked after the modules were gone. NVIDIA 595 still passed, so nothing here suggests that NVIDIA reads destroyed modules the way #4435 describes for AMD on Windows.
  • #4363's new check that a depth target gets new shader parts (agc_driver_recorder_tests --pipeline-library-only) passes on the 3090. The PR says that check fails on main, so that arm does differ from main. Neither PR changes the outcome here, because main doesn't fail.

So the GPU generation alone doesn't explain the loss, and the driver version doesn't either. On 617.42, Yuva1024's RTX 4060 fails and pipe1os's desktop RTX 4060 passes. Silverash-i8's 5060 Laptop also passes on 617.42, and ps54all's 3080 passes pixel_valid_mask on 610.74. Both failing reports are on Windows, but so are those three passing machines. No Linux report fails so far: fma-rc's 5080 on 615.78 and this 3090 on 595. That rests on two cards, and this run can't separate the OS from the driver branch. On this configuration the #3434 gate turns LTO off without need, but the data doesn't yet point at one condition to narrow the gate to.

Not tested: Windows, the 610/616/617 drivers, game workloads with the gate bypassed, the Khronos validation layer (not installed here), and #4363 with #4445 together (main didn't fail).

Commands and local changes
# from the source root
for c in d32 d16 color32 color64; do for i in $(seq 20); do
  ANYPS5_GPU=3090 ANYPS5_NO_SHADER_CACHE=1 ./build/tests/agc_driver_pipeline_optimized_readback_tests $c --force-lto
  echo "$c $i rc=$?"
done; done
# control: the same loop with APS5_NO_PIPELINE_LTO=1

# production policy
ANYPS5_GPU=3090 ctest --test-dir build -V -R '^agc_driver_pipeline_optimized_readback_'

# pixel_valid_mask, ac2c5c08 unmodified
for i in $(seq 20); do ANYPS5_GPU=3090 ctest --test-dir build -V -R '^agc_driver_pixel_valid_mask$'; done

# pixel_valid_mask, run directly: traced ac2c5c08 (30 runs), traced gate-bypassed main (20), eb94c554d (20)
for i in $(seq 20); do
  HV_TRACE_BIND=1 ANYPS5_GPU=3090 ANYPS5_NO_SHADER_CACHE=1 ./build/tests/agc_driver_pixel_valid_mask_tests
  echo "$i rc=$?"
done

# full suite; the traced run added HV_TRACE_BIND=1 and -V
ANYPS5_GPU=3090 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --parallel 8 --timeout 300 --output-on-failure

HV_TRACE_BIND=1 turns on the bind print below. eb94c554d has no print, so the variable does nothing there.

eb94c554d predates #3741. I copied main's PipelineOptimizedReadback.cpp in and set optimize from APS5_NO_PIPELINE_LTO alone, because that commit has no gate. I also added friend struct VulkanDeviceTestAccess; to VulkanDevice.hpp.

Bind trace in Pipeline::Continue:

if (std::getenv("HV_TRACE_BIND") != nullptr) std::fprintf(stderr, "hv-bind libraries=%d optimized=%d\n", libraries ? 1 : 0, best != VK_NULL_HANDLE ? 1 : 0);
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124848482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6124848482). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-12T13:04:58Z. --- An RTX 3090 (Ampere, GA102, device 0x2204) on Linux with NVIDIA 595.99.02 does not lose the device. Every case that binds the optimized LTO pipeline passes on current `main`, on eb94c554d from the report, and on Yuva1024's ac2c5c08. Setup: Ubuntu 24.04, Linux 7.0, GCC 13.3, Release with `BUILD_TESTING=ON` and `ANYPS5_ENABLE_SPIRV_TOOLS=ON`. `main` is ffa19840. The 59 commits since then, up to 33ae282e, don't touch the shader recompiler. Under `libSceAgcDriver` they only add a `--prepare` flag to the `agc_shader_replay` tool. **Readback test from #3741**, `--force-lto`, 20 runs per cell: | Tree | d32 | d16 | color32 | color64 | |---|---|---|---|---| | `main` ffa19840 | 20/20 | 20/20 | 20/20 | 20/20 | | `main`, `APS5_NO_PIPELINE_LTO=1` | 20/20 | 20/20 | 20/20 | 20/20 | | `main` + #4445 (2919dd38) | 20/20 | 20/20 | 20/20 | 20/20 | | `main` + #4363 (0b46084c) | 20/20 | 20/20 | 20/20 | 20/20 | | eb94c554d (no gate, LTO on), test ported | 20/20 | 20/20 | 20/20 | 20/20 | | eb94c554d, `APS5_NO_PIPELINE_LTO=1` | 20/20 | 20/20 | 20/20 | 20/20 | Every LTO-on run printed `pipeline readback passed: fast draws 1, optimized draws 1, optimized creations 1`, so each run drew with the optimized handle. Without `--force-lto`, all 8 readback ctests on `main` print `LTO disabled (production policy)`, so the #3434 gate is active on 595. **`agc_driver_pixel_valid_mask` with LTO on:** - ac2c5c08, unmodified: 20 of 20 pass through ctest. - ac2c5c08 with a temporary print in `Pipeline::Continue`: 30 of 30 pass. Draw 4 (wave32, masked pixel shader) bound the optimized handle in 30 of 30 runs, and draw 3 in 29 of 30. A draw gets the optimized handle only if its background link has finished, so this count depends on host load. Those 30 runs were at load average 17. In 10 later runs at load average 54, draw 4 got the optimized handle in 8, and all 10 passed. - eb94c554d: 20 of 20. - `main` with the gate bypassed (`true ||` in front of `PipelineLinkTimeOptimizationUsable` at `VulkanDevice.cpp:1317`): 20 of 20, with draws 3 and 4 optimized in all 20. **Full ctest on the 3090** (`ANYPS5_REQUIRE_VULKAN=1`, `--parallel 8 --timeout 300`): 0 failures out of 957, both with the gate and with the gate bypassed. Each run passed 947 tests and skipped 10. `agc_driver_stencil_ref_export` skipped because the 3090 lacks `VK_EXT_shader_stencil_export`, and 9 video_out tests skipped because SDL's offscreen driver has no Vulkan here. A traced gate-bypassed run had the same counts and drew 216 times with an optimized pipeline across 37 tests. Examples: `pixel_wave_reduction` (58), `depth_fast_clear_submit` (13), `color1555_target` (12), `depth_fast_clear` (6). No run logged `Vulkan result -4`, and the kernel log has no NVRM Xid lines for the whole session. Two side results: - On `main`, `Pipeline.cpp` destroys the shader modules right after `LinkPipelineFromLibraries` returns, and the readback test holds the LTO create until after the first draw. So the `main` arm linked after the modules were gone. NVIDIA 595 still passed, so nothing here suggests that NVIDIA reads destroyed modules the way #4435 describes for AMD on Windows. - #4363's new check that a depth target gets new shader parts (`agc_driver_recorder_tests --pipeline-library-only`) passes on the 3090. The PR says that check fails on `main`, so that arm does differ from `main`. Neither PR changes the outcome here, because `main` doesn't fail. So the GPU generation alone doesn't explain the loss, and the driver version doesn't either. On 617.42, Yuva1024's RTX 4060 fails and pipe1os's desktop RTX 4060 passes. Silverash-i8's 5060 Laptop also passes on 617.42, and ps54all's 3080 passes `pixel_valid_mask` on 610.74. Both failing reports are on Windows, but so are those three passing machines. No Linux report fails so far: fma-rc's 5080 on 615.78 and this 3090 on 595. That rests on two cards, and this run can't separate the OS from the driver branch. On this configuration the #3434 gate turns LTO off without need, but the data doesn't yet point at one condition to narrow the gate to. Not tested: Windows, the 610/616/617 drivers, game workloads with the gate bypassed, the Khronos validation layer (not installed here), and #4363 with #4445 together (`main` didn't fail). <details><summary>Commands and local changes</summary> ```sh # from the source root for c in d32 d16 color32 color64; do for i in $(seq 20); do ANYPS5_GPU=3090 ANYPS5_NO_SHADER_CACHE=1 ./build/tests/agc_driver_pipeline_optimized_readback_tests $c --force-lto echo "$c $i rc=$?" done; done # control: the same loop with APS5_NO_PIPELINE_LTO=1 # production policy ANYPS5_GPU=3090 ctest --test-dir build -V -R '^agc_driver_pipeline_optimized_readback_' # pixel_valid_mask, ac2c5c08 unmodified for i in $(seq 20); do ANYPS5_GPU=3090 ctest --test-dir build -V -R '^agc_driver_pixel_valid_mask$'; done # pixel_valid_mask, run directly: traced ac2c5c08 (30 runs), traced gate-bypassed main (20), eb94c554d (20) for i in $(seq 20); do HV_TRACE_BIND=1 ANYPS5_GPU=3090 ANYPS5_NO_SHADER_CACHE=1 ./build/tests/agc_driver_pixel_valid_mask_tests echo "$i rc=$?" done # full suite; the traced run added HV_TRACE_BIND=1 and -V ANYPS5_GPU=3090 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --parallel 8 --timeout 300 --output-on-failure ``` `HV_TRACE_BIND=1` turns on the bind print below. eb94c554d has no print, so the variable does nothing there. eb94c554d predates #3741. I copied `main`'s `PipelineOptimizedReadback.cpp` in and set `optimize` from `APS5_NO_PIPELINE_LTO` alone, because that commit has no gate. I also added `friend struct VulkanDeviceTestAccess;` to `VulkanDevice.hpp`. Bind trace in `Pipeline::Continue`: ```cpp if (std::getenv("HV_TRACE_BIND") != nullptr) std::fprintf(stderr, "hv-bind libraries=%d optimized=%d\n", libraries ? 1 : 0, best != VK_NULL_HANDLE ? 1 : 0); ``` </details>
ps54all commented 2026-10-12 15:28:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-12T15:28:41Z.


Thanks pipe1os and simonbbby. Table so far, same test (agc_driver_pixel_valid_mask, default LTO on): Ada 4060 desktop, 617.42 passes (pipe1os); Ampere 3090, Linux 595.99.02 passes (simonbbby); Blackwell 5060 passes; Ampere 3080 desktop, Windows, 610.74 passes here (20 of 20). The original report is the only failure, so it does not follow architecture or driver branch alone. Reporter: could you post the GPU model, driver version and whether other machine-specific settings apply (hybrid graphics, overlays)? Without a pattern I would not chase it further.

AI-assisted (Claude Code); I ran this on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127351308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6127351308). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-12T15:28:41Z. --- Thanks pipe1os and simonbbby. Table so far, same test (`agc_driver_pixel_valid_mask`, default LTO on): Ada 4060 desktop, 617.42 passes (pipe1os); Ampere 3090, Linux 595.99.02 passes (simonbbby); Blackwell 5060 passes; Ampere 3080 desktop, Windows, 610.74 passes here (20 of 20). The original report is the only failure, so it does not follow architecture or driver branch alone. Reporter: could you post the GPU model, driver version and whether other machine-specific settings apply (hybrid graphics, overlays)? Without a pattern I would not chase it further. AI-assisted (Claude Code); I ran this on my machine.
Sevthered commented 2026-10-13 21:07:49 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Sevthered on 2026-10-13T21:07:49Z.


Another data point: RTX 3080 Ti (Ampere, device 0x2208), Windows 11, driver 616.56, no hybrid graphics. agc_driver_pixel_valid_mask with default LTO passes 20 of 20 on a build based on a0f5916a2.

AI-assisted: yes; run on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155222012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6155222012). Originally posted by [Sevthered](https://github.com/Sevthered) on 2026-10-13T21:07:49Z. --- Another data point: RTX 3080 Ti (Ampere, device `0x2208`), Windows 11, driver 616.56, no hybrid graphics. `agc_driver_pixel_valid_mask` with default LTO passes 20 of 20 on a build based on `a0f5916a2`. AI-assisted: yes; run on my machine.
ps54all commented 2026-10-13 22:27:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-13T22:27:06Z.


Thanks simonbbby and Sevthered. Updated table for agc_driver_pixel_valid_mask with default LTO (the case from the report):

GPU OS / driver Result Reporter
RTX 3080 (Ampere desktop) Windows 11, 610.74 20/20 pass ps54all
RTX 3080 Ti (Ampere) Windows 11, 616.56 20/20 pass Sevthered
RTX 3090 (Ampere) Linux, 595.99.02 20/20 pass (+ full ctest 957, 0 failures) simonbbby
RTX 4060 desktop (Ada) Windows, 617.42 pass pipe1os
RTX 4060 (Ada) Windows, 617.42 fail Yuva1024 (original)
RTX 5060 Laptop (Blackwell) Windows, 617.42 pass Silverash-i8

Three Ampere cards on three drivers and two OSes all pass, and the one Ada pass and one Ada fail share a driver, so neither architecture nor driver version separates them. The only failing machine remains the original report. Yuva1024, could you post whether the machine has hybrid graphics, which GPU the test selects (ANYPS5_GPU), and whether the failure still happens with overlays (Afterburner, Discord, Steam) closed? Without a discriminating condition I would not narrow the #3434 gate further.

AI-assisted (Claude Code); I ran the 3080 numbers on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6156550997 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6156550997). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-13T22:27:06Z. --- Thanks simonbbby and Sevthered. Updated table for `agc_driver_pixel_valid_mask` with default LTO (the case from the report): | GPU | OS / driver | Result | Reporter | |---|---|---|---| | RTX 3080 (Ampere desktop) | Windows 11, 610.74 | 20/20 pass | ps54all | | RTX 3080 Ti (Ampere) | Windows 11, 616.56 | 20/20 pass | Sevthered | | RTX 3090 (Ampere) | Linux, 595.99.02 | 20/20 pass (+ full ctest 957, 0 failures) | simonbbby | | RTX 4060 desktop (Ada) | Windows, 617.42 | pass | pipe1os | | RTX 4060 (Ada) | Windows, 617.42 | fail | Yuva1024 (original) | | RTX 5060 Laptop (Blackwell) | Windows, 617.42 | pass | Silverash-i8 | Three Ampere cards on three drivers and two OSes all pass, and the one Ada pass and one Ada fail share a driver, so neither architecture nor driver version separates them. The only failing machine remains the original report. Yuva1024, could you post whether the machine has hybrid graphics, which GPU the test selects (`ANYPS5_GPU`), and whether the failure still happens with overlays (Afterburner, Discord, Steam) closed? Without a discriminating condition I would not narrow the #3434 gate further. AI-assisted (Claude Code); I ran the 3080 numbers on my machine.
ArekatlaNishanthchowdary commented 2026-10-14 05:05:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ArekatlaNishanthchowdary on 2026-10-14T05:05:12Z.


Another data point for the table: RTX 4060 Laptop GPU (Ada), Windows 11 26200, driver 32.0.16.1742, hybrid graphics with Intel UHD (Raptor Lake). agc_driver_pixel_valid_mask with default LTO passes 20 of 20 on main cac4e9688, WinLibs GCC 15.2.0 r7, Release. So hybrid graphics with a 4060 Laptop doesn't reproduce it either.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161327469 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6161327469). Originally posted by [ArekatlaNishanthchowdary](https://github.com/ArekatlaNishanthchowdary) on 2026-10-14T05:05:12Z. --- Another data point for the table: RTX 4060 Laptop GPU (Ada), Windows 11 26200, driver 32.0.16.1742, hybrid graphics with Intel UHD (Raptor Lake). `agc_driver_pixel_valid_mask` with default LTO passes 20 of 20 on `main` `cac4e9688`, WinLibs GCC 15.2.0 r7, Release. So hybrid graphics with a 4060 Laptop doesn't reproduce it either.
ps54all commented 2026-10-14 06:42:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-14T06:42:33Z.


Thanks ArekatlaNishanthchowdary. Added to the table for agc_driver_pixel_valid_mask with default LTO:

GPU OS / driver Result Reporter
RTX 4060 Laptop (Ada), hybrid graphics with Intel UHD Windows 11 26200, 32.0.16.1742 20/20 pass ArekatlaNishanthchowdary

That is two Ada cards on Windows that pass (desktop 4060 on 617.42, this laptop 4060 with hybrid graphics) against the one failing 4060 in the report, so hybrid graphics does not separate them either. Still open for the reporter: the GPU the test selects (ANYPS5_GPU), the exact driver build, and whether an overlay is running.

AI-assisted (Claude Code); table maintained from the reports in this thread.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6162545782 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6162545782). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-14T06:42:33Z. --- Thanks ArekatlaNishanthchowdary. Added to the table for `agc_driver_pixel_valid_mask` with default LTO: | GPU | OS / driver | Result | Reporter | |---|---|---|---| | RTX 4060 Laptop (Ada), hybrid graphics with Intel UHD | Windows 11 26200, 32.0.16.1742 | 20/20 pass | ArekatlaNishanthchowdary | That is two Ada cards on Windows that pass (desktop 4060 on 617.42, this laptop 4060 with hybrid graphics) against the one failing 4060 in the report, so hybrid graphics does not separate them either. Still open for the reporter: the GPU the test selects (`ANYPS5_GPU`), the exact driver build, and whether an overlay is running. AI-assisted (Claude Code); table maintained from the reports in this thread.
GustavoGamarra95 commented 2026-10-17 23:31:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by GustavoGamarra95 on 2026-10-17T23:31:29Z.


Another data point, Ampere laptop on Linux: RTX 3050 Laptop 4 GB (GA107), NVIDIA 615.78.08, CachyOS (kernel 7.2.9), hybrid graphics with an AMD Radeon 660M iGPU (the tests pick the RTX), GCC Release, BUILD_TESTING=ON. The build is main 922dc8999 plus #5987, which only changes device-memory allocation, not pipelines.

Readback test from #3741, 20 runs per cell. On this driver the production policy from #3434 turns the relink off, so I forced it with --force-lto:

Case --force-lto (optimized draws 1) production policy (optimized draws 0)
d32 20/20 pass 20/20 pass
d16 20/20 pass 20/20 pass
color32 20/20 pass 20/20 pass
color64 20/20 pass 20/20 pass

agc_driver_pixel_valid_mask passes 20 of 20 with ctest --repeat until-fail:20. Under the policy it never binds an optimized pipeline here. With the relink forced through the switch below, it also passes 20 of 20.

A title with the relink forced. I ran Beast of Reincarnation (PPSA29343) with a local switch, APS5_FORCE_PIPELINE_LTO=1. It ORs into pipelineLinkTimeOptimization in VulkanDevice.cpp, and APS5_NO_PIPELINE_LTO still wins. The run also counts relinks and binds. Setup: one warm-up run, then 6 runs of 600 s with alternating order (off, LTO, LTO, off, off, LTO), the same scripted input and a warm shader and pipeline cache:

  • With the relink on: 569 pipelines linked, 569 relinks queued and finished, 0 relinks failed, no VK_ERROR_DEVICE_LOST in any of the three runs. About 99.9% of binds in Pipeline::Continue used the optimized handle (≈1 047 000 optimized, ≈900 fast-linked).
  • The relink took about 1 s in total with a warm cache and 94 s with a cold one. It runs on the worker thread.
  • Peak VRAM was 3694–3794 MiB without the relink and 3694–3775 MiB with it, so it added no visible device-memory pressure.
  • Speed: no difference I can claim. After about 200 s this title is GPU-bound at about 300 ms of GPU time per present, for reasons unrelated to LTO, and that hides any effect. Between 400 and 600 s, gpu_busy_ms_per_present was 328 and 328 ms without the relink and 334, 325 and 307 ms with it.
  • One run without the relink stopped with SIGSEGV at 416 s inside title code, after WAIT_REG_MEM timeouts. It isn't related to the relink.

So an Ampere laptop with hybrid graphics on the 615 branch doesn't reproduce it, either in the readback cases or across about 3 million optimized binds in a title.

Proposal: a switch plus counters, to measure this on other machines. Today the only way to force the relink on NVIDIA is the readback test's --force-lto. A title run also doesn't say whether the relink is on, or how many draws used an optimized pipeline. What I used locally:

  • APS5_FORCE_PIPELINE_LTO=1 to turn the relink on whatever the driver table says. Device creation also logs one line saying whether the relink is on or off, and why: driver table, force switch or APS5_NO_PIPELINE_LTO.
  • Counters for pipelines linked, relinks queued, finished and failed, and relink time. Today a failed relink's vkCreateGraphicsPipelines result is dropped without a log. The counters also report optimized vs fast-linked binds in Pipeline::Continue, which is the share of draws that LTO can affect.

To judge whether LTO pays off, compare main and the switch on the same machine and scene:

  • gpu_busy_ms_per_present, frame p50/p99 and worker_busy_pct. Use at least 3 runs per side in alternating order, starting from a warm cache, and post tools/trace_digest.py output for both sides. The scene must not be GPU-bound for another reason, which is the limit of my run above.
  • Any device loss with the switch on, along with the bound pipeline.

There's also a side effect to check: the libraries are always created with VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT, even when the relink is off. On NVIDIA the driver then keeps link-time data for a relink that never runs. I haven't measured how much memory that costs.

With data from more machines, the driver table in PipelineLinkOptimization.hpp could be narrowed to what actually fails, instead of every driver from one vendor. So far the failures in this thread are on Windows, and every other card in the table passes. If the switch looks useful, I can open it as a separate PR.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6243104388 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2866#issuecomment-6243104388). Originally posted by [GustavoGamarra95](https://github.com/GustavoGamarra95) on 2026-10-17T23:31:29Z. --- Another data point, Ampere laptop on Linux: RTX 3050 Laptop 4 GB (GA107), NVIDIA 615.78.08, CachyOS (kernel 7.2.9), hybrid graphics with an AMD Radeon 660M iGPU (the tests pick the RTX), GCC Release, `BUILD_TESTING=ON`. The build is `main` 922dc8999 plus #5987, which only changes device-memory allocation, not pipelines. **Readback test from #3741**, 20 runs per cell. On this driver the production policy from #3434 turns the relink off, so I forced it with `--force-lto`: | Case | `--force-lto` (optimized draws 1) | production policy (optimized draws 0) | |---|---|---| | d32 | 20/20 pass | 20/20 pass | | d16 | 20/20 pass | 20/20 pass | | color32 | 20/20 pass | 20/20 pass | | color64 | 20/20 pass | 20/20 pass | `agc_driver_pixel_valid_mask` passes 20 of 20 with `ctest --repeat until-fail:20`. Under the policy it never binds an optimized pipeline here. With the relink forced through the switch below, it also passes 20 of 20. **A title with the relink forced.** I ran Beast of Reincarnation (PPSA29343) with a local switch, `APS5_FORCE_PIPELINE_LTO=1`. It ORs into `pipelineLinkTimeOptimization` in `VulkanDevice.cpp`, and `APS5_NO_PIPELINE_LTO` still wins. The run also counts relinks and binds. Setup: one warm-up run, then 6 runs of 600 s with alternating order (off, LTO, LTO, off, off, LTO), the same scripted input and a warm shader and pipeline cache: - With the relink on: 569 pipelines linked, 569 relinks queued and finished, 0 relinks failed, no `VK_ERROR_DEVICE_LOST` in any of the three runs. About 99.9% of binds in `Pipeline::Continue` used the optimized handle (≈1 047 000 optimized, ≈900 fast-linked). - The relink took about 1 s in total with a warm cache and 94 s with a cold one. It runs on the worker thread. - Peak VRAM was 3694–3794 MiB without the relink and 3694–3775 MiB with it, so it added no visible device-memory pressure. - Speed: no difference I can claim. After about 200 s this title is GPU-bound at about 300 ms of GPU time per present, for reasons unrelated to LTO, and that hides any effect. Between 400 and 600 s, `gpu_busy_ms_per_present` was 328 and 328 ms without the relink and 334, 325 and 307 ms with it. - One run without the relink stopped with SIGSEGV at 416 s inside title code, after `WAIT_REG_MEM` timeouts. It isn't related to the relink. So an Ampere laptop with hybrid graphics on the 615 branch doesn't reproduce it, either in the readback cases or across about 3 million optimized binds in a title. **Proposal: a switch plus counters, to measure this on other machines.** Today the only way to force the relink on NVIDIA is the readback test's `--force-lto`. A title run also doesn't say whether the relink is on, or how many draws used an optimized pipeline. What I used locally: - `APS5_FORCE_PIPELINE_LTO=1` to turn the relink on whatever the driver table says. Device creation also logs one line saying whether the relink is on or off, and why: driver table, force switch or `APS5_NO_PIPELINE_LTO`. - Counters for pipelines linked, relinks queued, finished and failed, and relink time. Today a failed relink's `vkCreateGraphicsPipelines` result is dropped without a log. The counters also report optimized vs fast-linked binds in `Pipeline::Continue`, which is the share of draws that LTO can affect. To judge whether LTO pays off, compare `main` and the switch on the same machine and scene: - `gpu_busy_ms_per_present`, frame p50/p99 and `worker_busy_pct`. Use at least 3 runs per side in alternating order, starting from a warm cache, and post `tools/trace_digest.py` output for both sides. The scene must not be GPU-bound for another reason, which is the limit of my run above. - Any device loss with the switch on, along with the bound pipeline. There's also a side effect to check: the libraries are always created with `VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT`, even when the relink is off. On NVIDIA the driver then keeps link-time data for a relink that never runs. I haven't measured how much memory that costs. With data from more machines, the driver table in `PipelineLinkOptimization.hpp` could be narrowed to what actually fails, instead of every driver from one vendor. So far the failures in this thread are on Windows, and every other card in the table passes. If the switch looks useful, I can open it as a separate PR. AI-assisted: yes
Sign in to join this conversation.
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#2866
No description provided.