GPU: catch driver shader compiler crashes in pipeline workers and skip bad keys #3292

Open
github-bot wants to merge 1 commit from github-bot/gh-3292 into main AGit
Owner

@⁠pushkarreddyy on GitHub · 2026-11-26 16:10 UTC · original
pushkarreddyy:fix/gpu-pipeline-compiler-veh → main · +405 −57 · 2 files · 1 commits · open

Summary

Adds a lock-free vectored exception handler (VEH) guard and bad-pipeline skip list (warm-bad.txt) for background pipeline compilation workers, preventing process-wide deadlocks and crashes when a GPU driver's shader compiler (such as amdxc64.dll on RDNA4) faults inside HostPipeline::new (addresses #2124, #2517).

Root Cause

  • Pending::make used OnceLock::get_or_init, so if a worker thread faulted inside the driver's shader compiler, any caller waiting on that Pending pipeline deadlocked forever.
  • A crashing worker thread took its WAITING count and worker slot with it, starving the pipeline queue.

Changes

  • crates/victory-gpu/src/pipeline/make.rs:
    • Replaced OnceLock::get_or_init with made.get().is_none() + made.set(...) so waiters are never stuck behind a faulted worker.
    • Added guard_start / compiler_crashed VEH + victory-pipeline-watch thread (VICTORY_COMPILER_GUARD=0 to disable) that records the faulting pipeline key in warm-bad.txt (VICTORY_WARM_BAD=0 to ignore), publishes None, decrements WAITING, and spawns a replacement worker (spawn_worker).
    • Added a_pipeline_on_the_bad_list_is_not_compiled unit test.
  • crates/victory-gpu/src/pipeline/library.rs:
    • Exposed folder() for warm-bad.txt lookup/persistence.

Testing & Verification

  • Added unit test a_pipeline_on_the_bad_list_is_not_compiled in crates/victory-gpu/src/pipeline/make.rs.
  • Testers on untested GPU models and drivers (especially RDNA4 / RX 9070 XT and NVIDIA/Intel setups) are welcome to test this build.

No game files used.

AI-assisted: yes (Gemini 4 Neon)

**@⁠pushkarreddyy** on GitHub · 2026-11-26 16:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3292) `pushkarreddyy:fix/gpu-pipeline-compiler-veh` → `main` · +405 −57 · 2 files · 1 commits · open ## Summary Adds a lock-free vectored exception handler (VEH) guard and bad-pipeline skip list (`warm-bad.txt`) for background pipeline compilation workers, preventing process-wide deadlocks and crashes when a GPU driver's shader compiler (such as `amdxc64.dll` on RDNA4) faults inside `HostPipeline::new` (addresses #2124, #2517). ## Root Cause - `Pending::make` used `OnceLock::get_or_init`, so if a worker thread faulted inside the driver's shader compiler, any caller waiting on that `Pending` pipeline deadlocked forever. - A crashing worker thread took its `WAITING` count and worker slot with it, starving the pipeline queue. ## Changes - `crates/victory-gpu/src/pipeline/make.rs`: - Replaced `OnceLock::get_or_init` with `made.get().is_none()` + `made.set(...)` so waiters are never stuck behind a faulted worker. - Added `guard_start` / `compiler_crashed` VEH + `victory-pipeline-watch` thread (`VICTORY_COMPILER_GUARD=0` to disable) that records the faulting pipeline key in `warm-bad.txt` (`VICTORY_WARM_BAD=0` to ignore), publishes `None`, decrements `WAITING`, and spawns a replacement worker (`spawn_worker`). - Added `a_pipeline_on_the_bad_list_is_not_compiled` unit test. - `crates/victory-gpu/src/pipeline/library.rs`: - Exposed `folder()` for `warm-bad.txt` lookup/persistence. ## Testing & Verification - Added unit test `a_pipeline_on_the_bad_list_is_not_compiled` in `crates/victory-gpu/src/pipeline/make.rs`. - Testers on untested GPU models and drivers (especially RDNA4 / RX 9070 XT and NVIDIA/Intel setups) are welcome to test this build. No game files used. AI-assisted: yes (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:16:08 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-11-26 16:27 UTC · original

Ran the pipeline-worker guard tests at 5a8b4d7 on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build.

cargo test -p victory-gpu --lib pipeline::make -- --test-threads=1
3 passed; 0 failed; 0 ignored; 0 measured; 230 filtered out      (exit 0)

The three tests that ran are draws_go_ahead_of_early_starts, first_use_is_made_by_a_worker and a_pipeline_on_the_bad_list_is_not_compiled; all pass here. The PR has no comments yet, so this is the first datapoint in the thread. These are CPU-side tests of the worker and bad-key logic; I did not inject a real fault inside a driver shader compiler, so the vectored exception handler path itself was not exercised.

Not tested: an actual crash inside a driver shader compiler, the VEH guard under a real fault, the full workspace suite, a paired smoke run, AMD hardware (the reported amdxc64.dll case), Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-26 16:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3292#issuecomment-7197670985) Ran the pipeline-worker guard tests at `5a8b4d7` on an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env), debug build. ``` cargo test -p victory-gpu --lib pipeline::make -- --test-threads=1 3 passed; 0 failed; 0 ignored; 0 measured; 230 filtered out (exit 0) ``` The three tests that ran are `draws_go_ahead_of_early_starts`, `first_use_is_made_by_a_worker` and `a_pipeline_on_the_bad_list_is_not_compiled`; all pass here. The PR has no comments yet, so this is the first datapoint in the thread. These are CPU-side tests of the worker and bad-key logic; I did not inject a real fault inside a driver shader compiler, so the vectored exception handler path itself was not exercised. Not tested: an actual crash inside a driver shader compiler, the VEH guard under a real fault, the full workspace suite, a paired smoke run, AMD hardware (the reported `amdxc64.dll` case), Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 16:55 UTC · original

Independent verification of #3292 (claimed on #1633). Test report only, no code changes. AI use: Claude Code (Claude Sonnet 5.5), run on behalf of oni-swr.

  • Head: 5a8b4d714b149048763053d13ad30d32f54b1409. Control: main = 63bcca43c6a00a758510398fa43096ce7e4f7df0 (the PR's merge base).
  • Windows 11 Pro, WARP only, no physical GPU: VICTORY_WARP=1, VICTORY_D3D12_WARP=1, VICTORY_DXIL = Windows SDK 10.0.26100.0 dxil.dll. No game files.
  • Command (head and main): cargo test -j 4 -p victory-gpu --lib --locked (also --features diagnostics on head).
  • I found no CONTRIBUTING.md in the repository, so I followed the #1633 rules.
Run Result
head, default features, 3 runs (low host load) 232 passed, 0 failed, 1 ignored, each time
head, --features diagnostics 247 passed, 0 failed, 1 ignored
main, default features 231 passed, 0 failed, 1 ignored (the 232nd is the PR's new test)
head with --skip waits_end_on_ticks (host at 100% CPU) 231 passed, 0 failed, 1 ignored
main with the same skip 230 passed, 0 failed, 1 ignored

Claimed test: pipeline::make::tests::a_pipeline_on_the_bad_list_is_not_compiled exists at head and passes (3/3).

Does it catch a bug on main? Not in the form shipped. Copied onto main as is, it does not compile (SKIPPED_BAD and bad_keys exist only in the PR). I then removed its bad-list-only lines (bad_keys(...), the SKIPPED_BAD counter) and ran the rest on main: it passes. The test builds a Pending with no shaders, so main also ends at Some(None); its only discriminating assertion is the SKIPPED_BAD counter, which is new in the PR. So it checks that the skip list is consulted, not that a crashing compile is survived. It does not write warm-bad.txt: it only touches the in-memory set and reads the file.

Not covered by any test: the VEH guard, compiler_crashed, the watch thread, the replacement worker, and the OnceLock::get_or_init to get().is_none() + set change. I did not reproduce a driver fault, so I did not verify the deadlock fix. The Testing section of the PR asks for testers on RDNA4, NVIDIA and Intel; I had none of these.

Flake, not caused by this PR: frame::tests::waits_end_on_ticks_and_count_frames (frame.rs, untouched here) passed in the first runs (head 4/4, main 1/1). Once other processes pinned the host at 100% CPU it failed every time on both main (7/7) and head (9/9), including run alone (left: 0, right: 1). It is a timing assertion; head and main behave the same.

Not verified: any physical GPU, a real compiler crash, clippy and rustfmt.

**@⁠oni-swr** on GitHub · 2026-11-26 16:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/3292#issuecomment-7198266164) Independent verification of #3292 (claimed on #1633). Test report only, no code changes. AI use: Claude Code (Claude Sonnet 5.5), run on behalf of oni-swr. - Head: `5a8b4d714b149048763053d13ad30d32f54b1409`. Control: `main` = `63bcca43c6a00a758510398fa43096ce7e4f7df0` (the PR's merge base). - Windows 11 Pro, WARP only, no physical GPU: `VICTORY_WARP=1`, `VICTORY_D3D12_WARP=1`, `VICTORY_DXIL` = Windows SDK 10.0.26100.0 `dxil.dll`. No game files. - Command (head and main): `cargo test -j 4 -p victory-gpu --lib --locked` (also `--features diagnostics` on head). - I found no CONTRIBUTING.md in the repository, so I followed the #1633 rules. | Run | Result | |---|---| | head, default features, 3 runs (low host load) | 232 passed, 0 failed, 1 ignored, each time | | head, `--features diagnostics` | 247 passed, 0 failed, 1 ignored | | main, default features | 231 passed, 0 failed, 1 ignored (the 232nd is the PR's new test) | | head with `--skip waits_end_on_ticks` (host at 100% CPU) | 231 passed, 0 failed, 1 ignored | | main with the same skip | 230 passed, 0 failed, 1 ignored | **Claimed test:** `pipeline::make::tests::a_pipeline_on_the_bad_list_is_not_compiled` exists at head and passes (3/3). **Does it catch a bug on main?** Not in the form shipped. Copied onto main as is, it does not compile (`SKIPPED_BAD` and `bad_keys` exist only in the PR). I then removed its bad-list-only lines (`bad_keys(...)`, the `SKIPPED_BAD` counter) and ran the rest on main: it passes. The test builds a `Pending` with no shaders, so main also ends at `Some(None)`; its only discriminating assertion is the `SKIPPED_BAD` counter, which is new in the PR. So it checks that the skip list is consulted, not that a crashing compile is survived. It does not write `warm-bad.txt`: it only touches the in-memory set and reads the file. **Not covered by any test:** the VEH guard, `compiler_crashed`, the watch thread, the replacement worker, and the `OnceLock::get_or_init` to `get().is_none()` + `set` change. I did not reproduce a driver fault, so I did not verify the deadlock fix. The Testing section of the PR asks for testers on RDNA4, NVIDIA and Intel; I had none of these. **Flake, not caused by this PR:** `frame::tests::waits_end_on_ticks_and_count_frames` (`frame.rs`, untouched here) passed in the first runs (head 4/4, main 1/1). Once other processes pinned the host at 100% CPU it failed every time on both main (7/7) and head (9/9), including run alone (`left: 0, right: 1`). It is a timing assertion; head and main behave the same. Not verified: any physical GPU, a real compiler crash, clippy and rustfmt.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 17:11 UTC · original · approved these changes

Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):

  • Guarding pipeline worker threads against driver shader compiler crashes, recording bad keys in warm-bad.txt (opt-out via VICTORY_WARM_BAD=0), and avoiding OnceLock::get_or_init blocking forever on a crashed worker is clean and well-tested.
  • cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1 (RTX 5090): 24 passed, 0 failed (including a_pipeline_on_the_bad_list_is_not_compiled).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 17:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/3292#pullrequestreview-6078126728) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090): - Guarding pipeline worker threads against driver shader compiler crashes, recording bad keys in `warm-bad.txt` (opt-out via `VICTORY_WARM_BAD=0`), and avoiding `OnceLock::get_or_init` blocking forever on a crashed worker is clean and well-tested. - `cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1` (RTX 5090): 24 passed, 0 failed (including `a_pipeline_on_the_bad_list_is_not_compiled`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠rpmaster2 on GitHub · 2026-11-26 17:41 UTC · original

RDNA4 (RX 9070 XT) datapoint on 5a8b4d7: the offline pipeline phase, no game run.

Host: Radeon RX 9070 XT 16 GB, Adrenalin 26.11.2 (32.0.32029.2010), Ryzen 5 5600, 32 GB RAM, Windows 11 10.0.26100.9974. Head 5a8b4d7 (base 63bcca4), diagnostics build, --locked.

Command: victory translate --cache --pipelines --jobs 8 over the title's shader pack, into a separate cache directory. 28.9 minutes wall clock:

containers   25889 in 156.2 s: 25669 translated, 220 refused
pipelines    28164 in the pack, 1575.3 s: 23488 made, 3632 already in the library

Exit code 0, zero first-chance exceptions, zero unhandled exceptions, no panics, and no warm-bad.txt was written: the driver's compiler did not fault in this run, so the guard was not exercised.

What that means for this PR: this is a negative control, not a VEH test. The same phase faulted reliably on this card on main before 850b66f (the history in #1785 and #2124), and it does not with 850b66f in the tree, which this base has. So it is consistent with the reports in #1785 rather than evidence about the handler.

To exercise the fault path one would need either a head without 850b66f or a pipeline that still faults with it; I did not find one in this pack (28,164 pipelines). The handler did not make anything worse: the run is clean and the library saves.

Refusals, for comparison with #1785: 852 rasteriser state not named, 139 depth-stencil state not named, 24 compute shader does not translate, 23 shader not found, 3 blend state not named, 2 stages other than vertex/mesh/pixel, 1 pixel shader does not translate.

AI-assisted: written by DeepSeek (OpenCode harness) from my run log; commits, counts and driver version only, no game files or paths.

**@⁠rpmaster2** on GitHub · 2026-11-26 17:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/3292#issuecomment-7199454524) **RDNA4 (RX 9070 XT) datapoint on `5a8b4d7`: the offline pipeline phase, no game run.** Host: Radeon RX 9070 XT 16 GB, Adrenalin 26.11.2 (32.0.32029.2010), Ryzen 5 5600, 32 GB RAM, Windows 11 10.0.26100.9974. Head `5a8b4d7` (base `63bcca4`), diagnostics build, `--locked`. Command: `victory translate --cache --pipelines --jobs 8` over the title's shader pack, into a separate cache directory. 28.9 minutes wall clock: ``` containers 25889 in 156.2 s: 25669 translated, 220 refused pipelines 28164 in the pack, 1575.3 s: 23488 made, 3632 already in the library ``` Exit code 0, zero first-chance exceptions, zero unhandled exceptions, no panics, and **no `warm-bad.txt` was written**: the driver's compiler did not fault in this run, so the guard was not exercised. What that means for this PR: this is a negative control, not a VEH test. The same phase faulted reliably on this card on `main` before `850b66f` (the history in #1785 and #2124), and it does not with `850b66f` in the tree, which this base has. So it is consistent with the reports in #1785 rather than evidence about the handler. To exercise the fault path one would need either a head without `850b66f` or a pipeline that still faults with it; I did not find one in this pack (28,164 pipelines). The handler did not make anything worse: the run is clean and the library saves. Refusals, for comparison with #1785: 852 rasteriser state not named, 139 depth-stencil state not named, 24 compute shader does not translate, 23 shader not found, 3 blend state not named, 2 stages other than vertex/mesh/pixel, 1 pixel shader does not translate. AI-assisted: written by DeepSeek (OpenCode harness) from my run log; commits, counts and driver version only, no game files or paths.
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-26 18:46 UTC · original

@⁠Marvisak Please review and merge this PR. Testers, kindly run on untested GPU models. AI‑assisted ✅ Gemini‑4 Neon

**@⁠pushkarreddyy** on GitHub · 2026-11-26 18:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/3292#issuecomment-7200835576) @⁠Marvisak Please review and merge this PR. Testers, kindly run on untested GPU models. AI‑assisted ✅ Gemini‑4 Neon
Author
Owner

@⁠borosf on GitHub · 2026-11-26 19:03 UTC · original

Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head 5a8b4d7:

cargo test -p victory-gpu --lib --locked --no-fail-fast -- --test-threads=1
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings
cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings

Result: victory-gpu lib: 230 passed / 2 failed (both known baseline); the new a_pipeline_on_the_bad_list_is_not_compiled test passed.

Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. No PR regressions.

Synthetic tests only; no game data used. Full log kept locally. — borosf

**@⁠borosf** on GitHub · 2026-11-26 19:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/3292#issuecomment-7201152849) Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head `5a8b4d7`: ``` cargo test -p victory-gpu --lib --locked --no-fail-fast -- --test-threads=1 cargo clippy -p victory-gpu --all-targets --locked -- -D warnings cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings ``` Result: victory-gpu lib: 230 passed / 2 failed (both known baseline); the new a_pipeline_on_the_bad_list_is_not_compiled test passed. Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. No PR regressions. Synthetic tests only; no game data used. Full log kept locally. — borosf
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3292/head:github-bot/gh-3292'
git switch 'github-bot/gh-3292'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3292'
git switch 'github-bot/gh-3292'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3292'
git switch 'github-bot/gh-3292'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3292'
git switch 'main'
git merge --squash 'github-bot/gh-3292'
git switch 'main'
git merge --ff-only 'github-bot/gh-3292'
git switch 'main'
git merge 'github-bot/gh-3292'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3292
No description provided.