GPU: a panic while making a host pipeline refuses it instead of ending the worker #2980

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

@⁠Ingenioeren on GitHub · 2026-11-26 02:08 UTC · original
Ingenioeren:fix/pipeline-worker-panic → main · +32 −1 · 1 files · 1 commits · open

What

Catch unwinding panics from host pipeline creation. Log each caught panic once with its shaders and the message when the payload is a string, then record the pipeline as refused. Add a device-free regression test.

Why

A panic during pipeline creation could end the worker, leave the queued count inflated, and keep the pipeline pending. Later draws could then consume the frame's wait budget on the same pipeline. Recording the refusal wakes waiters and lets the worker decrement the queued count and continue.

Reported in Belobug/VIctory-Belobug-AMD#217 (second item); the first item, a per-pipeline waited-time cap, is a behaviour change left out of this PR.

How tested

  • cargo test --locked --offline -p victory-gpu pipeline::make::tests::panicking_pipeline_is_refused -- --exact failed with the helper calling creation directly (pipeline creation panicked, 0 passed, 1 failed). The same command passed with the panic guard (1 passed, 0 failed).
  • cargo test --locked --offline -p victory-gpu passed with 232 passed, 0 failed, and 1 ignored. There were 0 doctests.
  • cargo clippy --locked --offline -p victory-gpu --all-targets passed with no warnings in the changed lines.
  • cargo fmt --check -p victory-gpu exited 1 on existing formatting drift. Rustfmt reported no changes to the edited lines.
  • cargo test --locked --offline -p victory-gpu --features diagnostics pipeline::make::tests::panicking_pipeline_is_refused -- --exact passed with 1 passed and 0 failed.
  • cargo run --locked --offline -p xtask -- policy --staged passed for the single staged file.

Not tested

No hardware run of a real panicking pipeline and no game run.

AI assistance: prepared with OpenAI Codex under Claude Code's direction, reviewed by Ingenioeren.

**@⁠Ingenioeren** on GitHub · 2026-11-26 02:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980) `Ingenioeren:fix/pipeline-worker-panic` → `main` · +32 −1 · 1 files · 1 commits · open ## What Catch unwinding panics from host pipeline creation. Log each caught panic once with its shaders and the message when the payload is a string, then record the pipeline as refused. Add a device-free regression test. ## Why A panic during pipeline creation could end the worker, leave the queued count inflated, and keep the pipeline pending. Later draws could then consume the frame's wait budget on the same pipeline. Recording the refusal wakes waiters and lets the worker decrement the queued count and continue. Reported in Belobug/VIctory-Belobug-AMD#217 (second item); the first item, a per-pipeline waited-time cap, is a behaviour change left out of this PR. ## How tested - `cargo test --locked --offline -p victory-gpu pipeline::make::tests::panicking_pipeline_is_refused -- --exact` failed with the helper calling creation directly (`pipeline creation panicked`, 0 passed, 1 failed). The same command passed with the panic guard (1 passed, 0 failed). - `cargo test --locked --offline -p victory-gpu` passed with 232 passed, 0 failed, and 1 ignored. There were 0 doctests. - `cargo clippy --locked --offline -p victory-gpu --all-targets` passed with no warnings in the changed lines. - `cargo fmt --check -p victory-gpu` exited 1 on existing formatting drift. Rustfmt reported no changes to the edited lines. - `cargo test --locked --offline -p victory-gpu --features diagnostics pipeline::make::tests::panicking_pipeline_is_refused -- --exact` passed with 1 passed and 0 failed. - `cargo run --locked --offline -p xtask -- policy --staged` passed for the single staged file. ## Not tested No hardware run of a real panicking pipeline and no game run. AI assistance: prepared with OpenAI Codex under Claude Code's direction, reviewed by Ingenioeren.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:19:12 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 02:33 UTC · original

Independent test report for head 38c1ddf00fba74018cb1611956407909e071bdd8 (parent 63bcca43c6a00a758510398fa43096ce7e4f7df0), per the claim in #1633.

Environment: Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, clean detached checkouts. CARGO_TARGET_DIR=D:\victory-2983-2980-warp-target, VICTORY_D3D12_WARP=1, VICTORY_WARP=1, VICTORY_DXIL=C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxil.dll. VICTORY_D3D12_WARP only selects WARP in builds with diagnostics, so I ran the device-creating crate suite only with --features diagnostics. There, host::create goes through warp_adapter(), which refuses non-software adapters. host::tests::warp_adapter_accepts_only_software printed EnumWarpAdapter: vendor=0x1414, flags=0x2, and the compositor test created its device there. No physical GPU was used. The machine has one, but no test ran on it. Synthetic tests only, no game data.

Focused test (head): cargo test -j 4 --locked -p victory-gpu [--features diagnostics] pipeline::make::tests::panicking_pipeline_is_refused -- --exact: 1 passed, 0 failed, both with default features and with diagnostics. The test needs no device.

Parent control (scratch, test-only): the test calls make_with, which is new in this PR. So my control was parent 63bcca4 plus the PR's test plus a scratch make_with that calls create() directly, with no catch_unwind. This tree is not a commit. The same command failed in both feature sets (1 failed): panicked at crates\victory-gpu\src\pipeline\make.rs:368:24: pipeline creation panicked. That matches the author's negative control.

Crate suite (head): cargo test -j 4 --locked --no-fail-fast -p victory-gpu --features diagnostics -- --nocapture: 247 passed, 0 failed, 1 ignored; doctests 0. I did not run the default-features suite. Without diagnostics, host::create uses the default adapter, which is the physical GPU here.

Lint: cargo clippy -j 4 --locked -p victory-gpu --all-targets showed no warnings, with default features and with --features diagnostics. rustfmt --check --edition 2024 on pipeline/make.rs reports 6 diffs on both the parent and the head, so the PR adds none.

Not run: any hardware GPU, a real panicking HostPipeline::new, the title, CI. The test checks the refusal (made == Some(None)). It does not exercise the worker loop's queued-count decrement or waking waiters.

Result: on Windows, the panic guard turns a panicking pipeline creation into a refusal. The same test fails on the parent without the guard. The diagnostics crate suite passes on WARP.

AI use: Claude Code (Claude Opus 5.5), coordinated by Codex (gpt-6.2-sol). I ran the commands above and report their real output.

**@⁠oni-swr** on GitHub · 2026-11-26 02:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980#issuecomment-7180917883) Independent test report for head `38c1ddf00fba74018cb1611956407909e071bdd8` (parent `63bcca43c6a00a758510398fa43096ce7e4f7df0`), per the claim in #1633. **Environment:** Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, clean detached checkouts. `CARGO_TARGET_DIR=D:\victory-2983-2980-warp-target`, `VICTORY_D3D12_WARP=1`, `VICTORY_WARP=1`, `VICTORY_DXIL=C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxil.dll`. `VICTORY_D3D12_WARP` only selects WARP in builds with `diagnostics`, so I ran the device-creating crate suite only with `--features diagnostics`. There, `host::create` goes through `warp_adapter()`, which refuses non-software adapters. `host::tests::warp_adapter_accepts_only_software` printed `EnumWarpAdapter: vendor=0x1414, flags=0x2`, and the compositor test created its device there. No physical GPU was used. The machine has one, but no test ran on it. Synthetic tests only, no game data. **Focused test (head):** `cargo test -j 4 --locked -p victory-gpu [--features diagnostics] pipeline::make::tests::panicking_pipeline_is_refused -- --exact`: 1 passed, 0 failed, both with default features and with `diagnostics`. The test needs no device. **Parent control (scratch, test-only):** the test calls `make_with`, which is new in this PR. So my control was parent `63bcca4` plus the PR's test plus a scratch `make_with` that calls `create()` directly, with no `catch_unwind`. This tree is not a commit. The same command failed in both feature sets (1 failed): `panicked at crates\victory-gpu\src\pipeline\make.rs:368:24: pipeline creation panicked`. That matches the author's negative control. **Crate suite (head):** `cargo test -j 4 --locked --no-fail-fast -p victory-gpu --features diagnostics -- --nocapture`: 247 passed, 0 failed, 1 ignored; doctests 0. I did not run the default-features suite. Without `diagnostics`, `host::create` uses the default adapter, which is the physical GPU here. **Lint:** `cargo clippy -j 4 --locked -p victory-gpu --all-targets` showed no warnings, with default features and with `--features diagnostics`. `rustfmt --check --edition 2024` on `pipeline/make.rs` reports 6 diffs on both the parent and the head, so the PR adds none. **Not run:** any hardware GPU, a real panicking `HostPipeline::new`, the title, CI. The test checks the refusal (`made == Some(None)`). It does not exercise the worker loop's queued-count decrement or waking waiters. Result: on Windows, the panic guard turns a panicking pipeline creation into a refusal. The same test fails on the parent without the guard. The diagnostics crate suite passes on WARP. AI use: Claude Code (Claude Opus 5.5), coordinated by Codex (gpt-6.2-sol). I ran the commands above and report their real output.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 05:44 UTC · original

Automated triage for the maintainers.

Verdict: merge candidate. This is a small robustness fix in crates/victory-gpu/src/pipeline/make.rs. Pending::make now runs HostPipeline::new inside catch_unwind (through a new make_with). A panic is logged and recorded as a refused pipeline (made = Some(None)). Before, a panic inside OnceLock::get_or_init would end the pipeline worker thread and leave the pipeline pending, and draws waiting on it would wait for nothing.

I checked that the loader's panic hook (victory-loader/src/crash.rs, log_crashes_to) only logs and doesn't abort, so the panic is still written to the crash log and the worker carries on. The workspace doesn't set panic = "abort". The diagnostics-only library::LAST.take() it clears exists on main. After the refusal, make still notifies DONE, so waiting draws wake up. The new test panicking_pipeline_is_refused needs no device. A tester above reports it failing without the guard and passing with it.

CI: passing (check). Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 05:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980#issuecomment-7183757305) <!-- victory-triage v1 head=38c1ddf00fba74018cb1611956407909e071bdd8 verdict=merge-candidate at=2026-11-26T05:43:59Z --> Automated triage for the maintainers. **Verdict: merge candidate.** This is a small robustness fix in `crates/victory-gpu/src/pipeline/make.rs`. `Pending::make` now runs `HostPipeline::new` inside `catch_unwind` (through a new `make_with`). A panic is logged and recorded as a refused pipeline (`made = Some(None)`). Before, a panic inside `OnceLock::get_or_init` would end the pipeline worker thread and leave the pipeline pending, and draws waiting on it would wait for nothing. I checked that the loader's panic hook (`victory-loader/src/crash.rs`, `log_crashes_to`) only logs and doesn't abort, so the panic is still written to the crash log and the worker carries on. The workspace doesn't set `panic = "abort"`. The diagnostics-only `library::LAST.take()` it clears exists on `main`. After the refusal, `make` still notifies `DONE`, so waiting draws wake up. The new test `panicking_pipeline_is_refused` needs no device. A tester above reports it failing without the guard and passing with it. CI: passing (`check`). Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 02:22 UTC · original · reviewed

Verified: a panic inside HostPipeline::new on a worker thread previously took the process down; catching it and returning None makes the pending pipeline refused (made=Some(None)), which is the established failure shape callers already handle. Payload extraction covers both &str and String, and the diagnostics LAST.take() keeps the library state from being trusted after a panic.

**@⁠kotekompotek** on GitHub · 2026-11-26 02:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980#pullrequestreview-6067722150) · **reviewed** Verified: a panic inside HostPipeline::new on a worker thread previously took the process down; catching it and returning None makes the pending pipeline refused (made=Some(None)), which is the established failure shape callers already handle. Payload extraction covers both &str and String, and the diagnostics LAST.take() keeps the library state from being trusted after a panic.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 02:41 UTC · original · reviewed

Reviewed 38c1ddf0 against main (63bcca43) — clean panic containment and ready to merge:

  • crates/victory-gpu/src/pipeline/make.rs:92-123 records Some(None) on caught unwind, clears the thread-local diagnostic marker, and wakes waiters; the worker releases QUEUES before invoking make and still decrements WAITING afterward (320-347).
  • Per-name reservations are released cleanly via Held::drop (library.rs:105-124, 262-293), state mutex acquisition recovers from poison, shader translation precedes disk-cache staging creation, and the new test verifies refusal cleanly.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 02:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980#pullrequestreview-6067843949) · **reviewed** Reviewed `38c1ddf0` against `main` (`63bcca43`) — clean panic containment and ready to merge: - `crates/victory-gpu/src/pipeline/make.rs:92-123` records `Some(None)` on caught unwind, clears the thread-local diagnostic marker, and wakes waiters; the worker releases `QUEUES` before invoking `make` and still decrements `WAITING` afterward (`320-347`). - Per-name reservations are released cleanly via `Held::drop` (`library.rs:105-124, 262-293`), state mutex acquisition recovers from poison, shader translation precedes disk-cache staging creation, and the new test verifies refusal cleanly.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 02:44 UTC · original · approved these changes

LGTM — semantics verified. Before this, a panic inside get_or_init left the OnceLock unset: any waiter would retry the same panicking build (and the worker dies on unwind). Some(None) makes the refusal deterministic and lets the caller fall back. LAST.take() under diagnostics is the right hygiene — no stale in-progress record for a build that never finished. The test asserts exactly the discriminating state (made set, value None).

**@⁠kotekompotek** on GitHub · 2026-11-26 02:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980#pullrequestreview-6067861907) · **approved these changes** LGTM — semantics verified. Before this, a panic inside get_or_init left the OnceLock unset: any waiter would retry the same panicking build (and the worker dies on unwind). Some(None) makes the refusal deterministic and lets the caller fall back. LAST.take() under diagnostics is the right hygiene — no stale in-progress record for a build that never finished. The test asserts exactly the discriminating state (made set, value None).
Author
Owner

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

Tested locally merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-gpu --features diagnostics pipeline::make::tests -- --test-threads=1: 4 passed, 0 failed (including panicking_pipeline_is_refused).
  • cargo clippy -p victory-gpu --features diagnostics --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 07:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980#pullrequestreview-6069866099) · **approved these changes** Tested locally merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-gpu --features diagnostics pipeline::make::tests -- --test-threads=1`: 4 passed, 0 failed (including `panicking_pipeline_is_refused`). - `cargo clippy -p victory-gpu --features diagnostics --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

@⁠futurepro62 on GitHub · 2026-11-26 10:31 UTC · original

NVIDIA full-suite run, to go with the reports above by Dukestar69, oni-swr, since none of them names a GPU run. Tested exact head 38c1ddf (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: panicking_pipeline_is_refused.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 10:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2980#issuecomment-7189489482) NVIDIA full-suite run, to go with the reports above by Dukestar69, oni-swr, since none of them names a GPU run. Tested exact head `38c1ddf` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **867 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `panicking_pipeline_is_refused`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
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/2980/head:github-bot/gh-2980'
git switch 'github-bot/gh-2980'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2980'
git switch 'github-bot/gh-2980'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2980'
git switch 'github-bot/gh-2980'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2980'
git switch 'main'
git merge --squash 'github-bot/gh-2980'
git switch 'main'
git merge --ff-only 'github-bot/gh-2980'
git switch 'main'
git merge 'github-bot/gh-2980'
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!2980
No description provided.