Log a driver fault caught by the Windows pipeline guards #1766

Merged
jarynclouatre merged 2 commits from fix/win-driver-fault-log into main 2026-11-10 18:07:50 +00:00
jarynclouatre commented 2026-11-10 16:12:07 +00:00 (Migrated from github.com)

On Windows the __except around vkCreateGraphicsPipelines returns VK_ERROR_UNKNOWN without a word, so a driver fault shows in the log only as "graphics pipeline for ... not made (-13)", the same as the driver returning that error itself. Since 0560ecb the Linux guard logs "the driver faulted compiling a graphics pipeline: that one is left out". Both Windows guards now log the same line, with the exception code.

It came up while chasing a start that hung on an RTX 4070 Ti Super (driver 621.14): a precompile worker's build had faulted inside the driver, and nothing in the log said so; it took a local build that wrote a dump at the fault to see it. A freeze report with this line in it points at the driver straight away.

Testing: RTX 4070 Ti Super, driver 621.14, Windows 11. The Windows DLL builds on adb7a5d. A local build that forced one access violation inside each guard (not part of this change) logged

vk: the driver faulted compiling a compute pipeline (exception 0xc0000005): that one is left out
vk: the driver faulted compiling a graphics pipeline (exception 0xc0000005): that one is left out
vk: graphics pipeline for b37500e0e1cae0f5 not made (-13)

and the precompile went on and finished.

On Windows the `__except` around vkCreateGraphicsPipelines returns VK_ERROR_UNKNOWN without a word, so a driver fault shows in the log only as "graphics pipeline for ... not made (-13)", the same as the driver returning that error itself. Since 0560ecb the Linux guard logs "the driver faulted compiling a graphics pipeline: that one is left out". Both Windows guards now log the same line, with the exception code. It came up while chasing a start that hung on an RTX 4070 Ti Super (driver 621.14): a precompile worker's build had faulted inside the driver, and nothing in the log said so; it took a local build that wrote a dump at the fault to see it. A freeze report with this line in it points at the driver straight away. Testing: RTX 4070 Ti Super, driver 621.14, Windows 11. The Windows DLL builds on adb7a5d. A local build that forced one access violation inside each guard (not part of this change) logged ``` vk: the driver faulted compiling a compute pipeline (exception 0xc0000005): that one is left out vk: the driver faulted compiling a graphics pipeline (exception 0xc0000005): that one is left out vk: graphics pipeline for b37500e0e1cae0f5 not made (-13) ``` and the precompile went on and finished.
hckrman101 (Migrated from github.com) reviewed 2026-11-10 16:41:25 +00:00
hckrman101 (Migrated from github.com) left a comment

The change itself is good: the Windows guards now say the same thing as the Linux one, with the exception code, and logging from the __except body (not the filter) is fine.

But it breaks tests/test_precompile_compute_guard.py on the windows-2022 check. That test extracts guarded_compute from gpu/vk/vk_draw.cpp verbatim into a small fixture, and the fixture has no logf, so the new line resolves to the CRT's logf(float):

fixture.cpp:44:9: error: no matching function for call to 'logf'

The fix is a stub in the fixture's HEAD, e.g. void logf(const char*, ...) {} (a variadic overload next to the math one is fine), or a counter if you want the test to also assert the message is logged on a fault (mode==1). The other Windows failure on that job is not from this PR; everything else is green.

Once the test is fixed this is good to merge.

The change itself is good: the Windows guards now say the same thing as the Linux one, with the exception code, and logging from the `__except` body (not the filter) is fine. But it breaks `tests/test_precompile_compute_guard.py` on the windows-2022 check. That test extracts `guarded_compute` from `gpu/vk/vk_draw.cpp` verbatim into a small fixture, and the fixture has no `logf`, so the new line resolves to the CRT's `logf(float)`: ``` fixture.cpp:44:9: error: no matching function for call to 'logf' ``` The fix is a stub in the fixture's `HEAD`, e.g. `void logf(const char*, ...) {}` (a variadic overload next to the math one is fine), or a counter if you want the test to also assert the message is logged on a fault (`mode==1`). The other Windows failure on that job is not from this PR; everything else is green. Once the test is fixed this is good to merge.
jarynclouatre commented 2026-11-10 16:51:15 +00:00 (Migrated from github.com)

Thanks, fixed in b177711. The fixture now has a counting logf(const char*, ...) and case 4 checks the fault was logged once. I built the generated fixture with llvm-mingw (with -fms-extensions, as I don't have the MSVC target set up here) and ran it on Windows 11: cases 0 to 4 all exit 0.

Thanks, fixed in b177711. The fixture now has a counting `logf(const char*, ...)` and case 4 checks the fault was logged once. I built the generated fixture with llvm-mingw (with -fms-extensions, as I don't have the MSVC target set up here) and ran it on Windows 11: cases 0 to 4 all exit 0.
hckrman101 (Migrated from github.com) approved these changes 2026-11-10 18:00:16 +00:00
hckrman101 (Migrated from github.com) left a comment

The fixture is fixed: the counting logf(const char*, ...) is in, and case 4 now checks the fault was logged exactly once. test_precompile_compute_guard.py passes on the windows-2022 job.

The log call sits in the __except body, after the filter (__except (1)) has returned, so nothing runs inside the filter. logf formats into a 1 KiB stack buffer and hands it to the host log, with no allocation of its own, so it is safe there.

The remaining red on the two Python source checks jobs is not from this PR: test_nup_out_of_space (windows), test_lift_cleanup_error and test_recomplauncher_json fail on main as well, and main has since fixed the lift-cleanup and launcher ones. A merge of main will clear them. The branch is 149 commits behind main but touches only gpu/vk/vk_draw.cpp and the one test, so I don't expect a conflict.

Good to merge.

The fixture is fixed: the counting `logf(const char*, ...)` is in, and case 4 now checks the fault was logged exactly once. `test_precompile_compute_guard.py` passes on the windows-2022 job. The log call sits in the `__except` body, after the filter (`__except (1)`) has returned, so nothing runs inside the filter. `logf` formats into a 1 KiB stack buffer and hands it to the host log, with no allocation of its own, so it is safe there. The remaining red on the two Python source checks jobs is not from this PR: `test_nup_out_of_space` (windows), `test_lift_cleanup_error` and `test_recomplauncher_json` fail on main as well, and main has since fixed the lift-cleanup and launcher ones. A merge of main will clear them. The branch is 149 commits behind main but touches only `gpu/vk/vk_draw.cpp` and the one test, so I don't expect a conflict. Good to merge.
Commenting is not possible because the repository is archived.
No description provided.