Tests: victory-shader tests crash (0xC0000005) when several tests use WARP devices in parallel #181

Closed
opened 2026-11-26 03:53:37 +00:00 by github-bot · 7 comments
Owner

@⁠ghost on GitHub · 2026-11-24 01:11 UTC · original

On an AMD GPU, cargo test -p victory-shader --lib on main (9aef3d9) sometimes dies with 0xC0000005 (access violation) when tests run in parallel, which is cargo's default. It never crashes single-threaded.

Measured (AMD Radeon RX 9060 XT, RDNA4, driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.98.1; debug; cargo test -q -p victory-shader …):

Run Crashes
--lib 3 / 25
--lib -- --test-threads=1 0 / 10
valu_tests only 0 / 20
--lib -- --skip valu_tests 0 / 20
--lib -- valu_tests emit::tests::stub_pipeline_is_created 1 / 20
--lib -- emit:: 1 / 20
with #116's LDS tests: byte_and_halfword_writes + byte_and_halfword_reads only 2 / 6
#116, lds filter 4 / 5

The log stops mid-run with process didn't exit successfully: …victory_shader-….exe (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION). No test reports a panic.

So it takes two tests that each create a D3D12 device or pipeline (the Hosts in valu_tests, stub_pipeline_is_created, #116's lds_tests) running at the same time. More such tests make it more frequent. My guess, not checked: something in device or pipeline creation, or in the DXIL validator loaded per test, isn't safe to use from two threads at once on this driver. Either way, it makes the default cargo test --workspace flaky on AMD, and new GPU tests will raise the rate. Serializing the GPU tests (one shared lock, or --test-threads=1 for this crate) would avoid it.

Not tested: NVIDIA or Intel (does it happen there?), a release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 01:11 UTC · [original](https://github.com/Marvisak/VIctory/issues/181) On an AMD GPU, `cargo test -p victory-shader --lib` on `main` (`9aef3d9`) sometimes dies with `0xC0000005` (access violation) when tests run in parallel, which is cargo's default. It never crashes single-threaded. **Measured** (AMD Radeon RX 9060 XT, RDNA4, driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.98.1; debug; `cargo test -q -p victory-shader …`): | Run | Crashes | |---|---| | `--lib` | 3 / 25 | | `--lib -- --test-threads=1` | 0 / 10 | | `valu_tests` only | 0 / 20 | | `--lib -- --skip valu_tests` | 0 / 20 | | `--lib -- valu_tests emit::tests::stub_pipeline_is_created` | 1 / 20 | | `--lib -- emit::` | 1 / 20 | | with #116's LDS tests: `byte_and_halfword_writes` + `byte_and_halfword_reads` only | 2 / 6 | | #116, `lds` filter | 4 / 5 | The log stops mid-run with `process didn't exit successfully: …victory_shader-….exe (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)`. No test reports a panic. So it takes two tests that each create a D3D12 device or pipeline (the `Host`s in `valu_tests`, `stub_pipeline_is_created`, #116's `lds_tests`) running at the same time. More such tests make it more frequent. My guess, not checked: something in device or pipeline creation, or in the DXIL validator loaded per test, isn't safe to use from two threads at once on this driver. Either way, it makes the default `cargo test --workspace` flaky on AMD, and new GPU tests will raise the rate. Serializing the GPU tests (one shared lock, or `--test-threads=1` for this crate) would avoid it. Not tested: NVIDIA or Intel (does it happen there?), a release build. **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:37 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:16 UTC · original

Data point from a different host: it does not reproduce under Wine on Linux.

  • Windows build of main (d2a4bae), cargo xwin test --no-run --release -p victory-shader, run under Wine 11.22 + vkd3d-proton 3.1 on an AMD RX 9060 XT (RADV 26.3.1), default test threads: 15 runs, 0 crashes (every run exits 101 only because of emit::tests::stub_pipeline_is_created, which needs dxil.dll; that is the single failure in each run).
  • --test-threads=1 control: 5 runs, same result.

The likely difference is the validator: dxil.dll is absent under Wine, so Validator::load returns None and the tests skip it, while on Windows it is loaded and used by several tests. That fits your guess about per-test DXIL validator state — a load/use from two threads at once — more than device or pipeline creation in general, since those run in parallel here without a fault.

If it helps to narrow it down on Windows: run the suite with the validator forced off (e.g. a temporary Validator::load returning None, or move dxil.dll aside) for 25 runs. If the crashes stop, the shared state is in the validator rather than in the device/pipeline path.

No game data used.

**@⁠DaviTostes** on GitHub · 2026-11-24 01:16 UTC · [original](https://github.com/Marvisak/VIctory/issues/181#issuecomment-7118930885) Data point from a different host: it does **not** reproduce under Wine on Linux. - Windows build of `main` (`d2a4bae`), `cargo xwin test --no-run --release -p victory-shader`, run under **Wine 11.22 + vkd3d-proton 3.1** on an AMD RX 9060 XT (RADV 26.3.1), default test threads: **15 runs, 0 crashes** (every run exits 101 only because of `emit::tests::stub_pipeline_is_created`, which needs `dxil.dll`; that is the single failure in each run). - `--test-threads=1` control: 5 runs, same result. The likely difference is the validator: `dxil.dll` is absent under Wine, so `Validator::load` returns `None` and the tests skip it, while on Windows it is loaded and used by several tests. That fits your guess about per-test DXIL validator state — a load/use from two threads at once — more than device or pipeline creation in general, since those run in parallel here without a fault. If it helps to narrow it down on Windows: run the suite with the validator forced off (e.g. a temporary `Validator::load` returning `None`, or move `dxil.dll` aside) for 25 runs. If the crashes stop, the shared state is in the validator rather than in the device/pipeline path. No game data used.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 01:27 UTC · original

Thanks @⁠DaviTostes. Your Wine result was the key, but on Windows the difference turns out to be WARP, not the validator. Under vkd3d-proton there's no WARP, so those tests only ever make the hardware host there. Same card here (RX 9060 XT), Windows 11 26200, d3d10warp.dll / D3D12Core.dll 10.0.26100.9818, debug:

cargo test -q -p victory-shader … Crashes (0xC0000005)
#116 lds, as shipped 3 / 10
#116 lds, validator off (VICTORY_DXIL pointing at a missing file) 3 / 20
#116 lds, validator on, load and validate behind one global Mutex (local patch) 6 / 20
#116 lds, WARP only (VICTORY_WARP=1) 20 / 20
#116 lds, hardware only (local patch: Host::new refuses WARP) 0 / 20
main d2a4bae --lib, validator off 1 / 25
main --lib, WARP only 10 / 10
main valu_tests, WARP only 8 / 10
main --lib, WARP only, --test-threads=1 0 / 5

So it's two or more test threads each using their own WARP device at the same time. The validator and the AMD driver are cleared. It isn't AMD-specific either (I'll fix the title): any Windows machine with WARP should hit it. With a real GPU it's rarer only because WARP is just one of each test's two hosts.

Possible fixes, cheapest first: hold a process-wide lock for the WARP host's work in the tests (hosts() / Host::new(true) and its dispatches), or share one WARP Host between tests. Running this crate with --test-threads=1 also avoids it, at the cost of speed.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 01:27 UTC · [original](https://github.com/Marvisak/VIctory/issues/181#issuecomment-7119112992) Thanks @⁠DaviTostes. Your Wine result was the key, but on Windows the difference turns out to be **WARP**, not the validator. Under vkd3d-proton there's no WARP, so those tests only ever make the hardware host there. Same card here (RX 9060 XT), Windows 11 26200, `d3d10warp.dll` / `D3D12Core.dll` 10.0.26100.9818, debug: | `cargo test -q -p victory-shader …` | Crashes (`0xC0000005`) | |---|---| | #116 `lds`, as shipped | 3 / 10 | | #116 `lds`, validator off (`VICTORY_DXIL` pointing at a missing file) | 3 / 20 | | #116 `lds`, validator on, `load` and `validate` behind one global `Mutex` (local patch) | 6 / 20 | | #116 `lds`, **WARP only** (`VICTORY_WARP=1`) | **20 / 20** | | #116 `lds`, **hardware only** (local patch: `Host::new` refuses WARP) | **0 / 20** | | `main` `d2a4bae` `--lib`, validator off | 1 / 25 | | `main` `--lib`, WARP only | **10 / 10** | | `main` `valu_tests`, WARP only | 8 / 10 | | `main` `--lib`, WARP only, `--test-threads=1` | 0 / 5 | So it's two or more test threads each using their own WARP device at the same time. The validator and the AMD driver are cleared. It isn't AMD-specific either (I'll fix the title): any Windows machine with WARP should hit it. With a real GPU it's rarer only because WARP is just one of each test's two hosts. Possible fixes, cheapest first: hold a process-wide lock for the WARP host's work in the tests (`hosts()` / `Host::new(true)` and its dispatches), or share one WARP `Host` between tests. Running this crate with `--test-threads=1` also avoids it, at the cost of speed. **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 04:29 UTC · original

Numbers from a second machine that confirm the WARP diagnosis here, from the thread of #433 (a test-only lock around valu_tests::run_cases).

valu_tests filter with a local switch that makes the seven tests use one backend, 40 runs each:

main d2a4bae with #433
WARP only, RTX 3060 machine (fromthemoonx) 40 crashed (0xC0000005) 0 crashed
WARP only, RTX 5070 + Radeon iGPU 29 crashed 0 crashed
hardware adapter only, RTX 3060 machine 0 crashed 0 crashed

So the seven tests overlapping on WARP crash on main in 40 and 29 of 40 runs once nothing staggers them, on machines with NVIDIA cards too.

What #433 does not do: it serialises only those seven tests. stub_pipeline_is_created, #116's LDS tests and any new GPU test still overlap on WARP, so this issue stays open with it; #244 is the PR that addresses WARP for every test. I am posting the numbers here so they are in one place, not to claim the issue.

No game data used. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 04:29 UTC · [original](https://github.com/Marvisak/VIctory/issues/181#issuecomment-7122073159) Numbers from a second machine that confirm the WARP diagnosis here, from the thread of #433 (a test-only lock around `valu_tests::run_cases`). `valu_tests` filter with a local switch that makes the seven tests use one backend, 40 runs each: | | `main` `d2a4bae` | with #433 | |---|---|---| | WARP only, RTX 3060 machine ([fromthemoonx](https://git.gtahub.st/github/Marvisak--VIctory/pulls/433)) | 40 crashed (`0xC0000005`) | 0 crashed | | WARP only, RTX 5070 + Radeon iGPU | 29 crashed | 0 crashed | | hardware adapter only, RTX 3060 machine | 0 crashed | 0 crashed | So the seven tests overlapping on WARP crash on `main` in 40 and 29 of 40 runs once nothing staggers them, on machines with NVIDIA cards too. What #433 does not do: it serialises only those seven tests. `stub_pipeline_is_created`, #116's LDS tests and any new GPU test still overlap on WARP, so this issue stays open with it; #244 is the PR that addresses WARP for every test. I am posting the numbers here so they are in one place, not to claim the issue. No game data used. AI-assisted.
Author
Owner

@⁠draggygaggy-maker on GitHub · 2026-11-24 07:38 UTC · original

Additional Windows/NVIDIA test results:

Hardware: Ryzen 7 5800X, NVIDIA RTX 4060 Ti 8 GB, Windows 11
Rust: 1.98.1 (MSVC)

  • cargo test --workspace — seven emit::valu_tests remained running for over 60 seconds without completing; manually interrupted.
  • cargo test -p victory-shader --lib emit::valu_tests -- --test-threads=1 --nocapture — 7/7 passed in 6.41s.
  • cargo test --workspace -- --test-threads=1 — all 264 non-ignored tests passed; 0 failed, 4 ignored.

This suggests a parallel-execution problem also affects this NVIDIA setup, although I haven't identified the underlying cause. No crash or access violation was observed.

AI-assisted investigation (OpenAI GPT-6).

**@⁠draggygaggy-maker** on GitHub · 2026-11-24 07:38 UTC · [original](https://github.com/Marvisak/VIctory/issues/181#issuecomment-7125208541) Additional Windows/NVIDIA test results: **Hardware:** Ryzen 7 5800X, NVIDIA RTX 4060 Ti 8 GB, Windows 11 **Rust:** 1.98.1 (MSVC) - `cargo test --workspace` — seven `emit::valu_tests` remained running for over 60 seconds without completing; manually interrupted. - `cargo test -p victory-shader --lib emit::valu_tests -- --test-threads=1 --nocapture` — 7/7 passed in 6.41s. - `cargo test --workspace -- --test-threads=1` — all 264 non-ignored tests passed; 0 failed, 4 ignored. This suggests a parallel-execution problem also affects this NVIDIA setup, although I haven't identified the underlying cause. No crash or access violation was observed. AI-assisted investigation (OpenAI GPT-6).
Author
Owner

@⁠BaggyALPHA on GitHub · 2026-11-24 17:25 UTC · original

I rechecked current upstream after the VALU and waterfall tests began sharing their lock. I selected those two groups plus stub_pipeline_is_created, which still runs outside that lock, and used 16 test threads on Windows 11 with an RTX 3080 available.

  • WARP forced with VICTORY_WARP=1: 25 of 25 runs passed.
  • Default adapter selection, with both hardware and WARP available: 10 of 10 runs passed.

No access violations or missing-device skips in either configuration. This is one machine and does not cover the original AMD system. Only synthetic tests were used.

AI-assisted (Codex).

**@⁠BaggyALPHA** on GitHub · 2026-11-24 17:25 UTC · [original](https://github.com/Marvisak/VIctory/issues/181#issuecomment-7139171080) I rechecked current upstream after the VALU and waterfall tests began sharing their lock. I selected those two groups plus `stub_pipeline_is_created`, which still runs outside that lock, and used 16 test threads on Windows 11 with an RTX 3080 available. - WARP forced with `VICTORY_WARP=1`: 25 of 25 runs passed. - Default adapter selection, with both hardware and WARP available: 10 of 10 runs passed. No access violations or missing-device skips in either configuration. This is one machine and does not cover the original AMD system. Only synthetic tests were used. AI-assisted (Codex).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:47 UTC · original

Automated triage for the maintainers.

The cause found in the thread is several tests driving their own WARP device at the same time. main has partly addressed it: ONE_AT_A_TIME in crates/victory-shader/src/emit/valu_tests.rs (commits 1106f43 and 74a9d33) is now taken by the VALU, waterfall, flow, memory, semantics, stride, synthetic and BVH tests and by edge_flagged_triangles_draw_as_unflagged_ones in emit/mod.rs. That fits the clean 16-thread runs in the last comment. Two tests still create a WARP Host without taking it: the cube-sampling test around diff_tests.rs:1266, and the geometry-stage test in emit/rect.rs (for warp in [false, true]). So the crash can still happen when either of them overlaps another WARP test. stub_pipeline_is_created uses the hardware adapter only.

Open PR #244 serializes WARP host work for every test. The narrower alternative is to take ONE_AT_A_TIME in the two tests above.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:47 UTC · [original](https://github.com/Marvisak/VIctory/issues/181#issuecomment-7149962418) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-24T17:25:24Z at=2026-11-25T01:47:27Z --> Automated triage for the maintainers. The cause found in the thread is several tests driving their own WARP device at the same time. `main` has partly addressed it: `ONE_AT_A_TIME` in `crates/victory-shader/src/emit/valu_tests.rs` (commits 1106f43 and 74a9d33) is now taken by the VALU, waterfall, flow, memory, semantics, stride, synthetic and BVH tests and by `edge_flagged_triangles_draw_as_unflagged_ones` in `emit/mod.rs`. That fits the clean 16-thread runs in the last comment. Two tests still create a WARP `Host` without taking it: the cube-sampling test around `diff_tests.rs:1266`, and the geometry-stage test in `emit/rect.rs` (`for warp in [false, true]`). So the crash can still happen when either of them overlaps another WARP test. `stub_pipeline_is_created` uses the hardware adapter only. Open PR #244 serializes WARP host work for every test. The narrower alternative is to take `ONE_AT_A_TIME` in the two tests above. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠xyzMikah on GitHub · 2026-11-25 19:37 UTC · original

RTX 5060 Ti 16 GB, Windows 11, Rust 1.98.1, upstream main.

cargo test -p victory-shader --lib crashes with 0xC0000005.

Alone, one test crashes every run:

emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index

So it's not only parallel WARP devices.

**@⁠xyzMikah** on GitHub · 2026-11-25 19:37 UTC · [original](https://github.com/Marvisak/VIctory/issues/181#issuecomment-7172545872) **RTX 5060 Ti 16 GB, Windows 11, Rust 1.98.1, upstream main.** `cargo test -p victory-shader --lib` crashes with 0xC0000005. Alone, one test crashes every run: `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` So it's not only parallel WARP devices.
This discussion has been locked. Commenting is limited to contributors.
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#181
No description provided.