Shader tests: WARP runs one draw or dispatch at a time (parallel runs crashed in d3d10warp.dll) #140

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

@⁠ySKELLETONX on GitHub · 2026-11-25 16:21 UTC · original
ySKELLETONX:fix/warp-serial-dispatch → main · +31 −0 · 1 files · 1 commits · open

Why

cargo test -p victory-shader --lib sometimes ends the whole test process here instead of failing a test:

process didn't exit successfully: `...victory_shader-....exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

On main (01aadd1) it happened in 6 of 8 parallel runs and 3 of 16 in another series. It never happened in serial runs. When it happens, every test after it goes unreported, and a test run of a PR looks like a failure of that PR. While testing the open shader PRs on this card, 9 of 21 looked broken because of this, including PRs that only change hashing or remove dead code.

Cause

I installed a temporary vectored exception handler that prints the faulting module and a backtrace (local only, not in this PR). Every crash was inside WARP, during Host::dispatch, in whichever tests were running at the time:

AV at d3d10warp.dll+0x7b741, reading 0x0   thread "emit::lds_tests::byte_and_halfword_reads"
AV at d3d10warp.dll+0x7b3b4, reading 0x24  thread "emit::lds_tests::byte_and_halfword_writes"
AV at d3d10warp.dll+0x7b741, reading 0x0   thread "emit::scratch_tests::a_store_in_lanes_off_does_not_happen"
AV at d3d10warp.dll+0x7b459, reading 0x0   ...
AV at d3d10warp.dll+0xa790c, ...           thread None (a WARP worker)

with victory_shader::emit::host::Host::dispatch in each test thread's stack.

Each test makes its own Host, but D3D12 gives back the same device for an adapter, so parallel tests drive WARP's one device from several threads at once. No test module crashes on its own (0 of 6 runs each, for every module with hardware tests). It takes several modules dispatching on WARP together.

What

Host::draw and Host::dispatch take a process-wide turn (WARP_TURN) when the device is on a software adapter. That is checked from the device's adapter LUID, so the Host { device } built in lane_read_loop_tests is covered too. Hardware adapters still run in parallel. Test code only (#[cfg(test)]).

Testing

RX 7600 XT, Windows 11 Pro build 26300, WARP 10.0.26100.9818, Rust 1.98.1, the victory_shader test binary run directly:

parallel runs that crashed
main 6 / 8, 3 / 16
main, every dispatch serialised (experiment) 0 / 16
this PR (WARP only) 0 / 20, 266 passed each time

Run time is unchanged: 38.8 to 41.1 s per run, against about 39 s before.

I have only seen this on Windows build 26300, and other reports here (#2, #8, #74) don't mention it. It may depend on the WARP build, but taking turns on WARP is harmless where WARP is fine.

**@⁠ySKELLETONX** on GitHub · 2026-11-25 16:21 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/140) `ySKELLETONX:fix/warp-serial-dispatch` → `main` · +31 −0 · 1 files · 1 commits · open ## Why `cargo test -p victory-shader --lib` sometimes ends the whole test process here instead of failing a test: ``` process didn't exit successfully: `...victory_shader-....exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) ``` On `main` (`01aadd1`) it happened in 6 of 8 parallel runs and 3 of 16 in another series. It never happened in serial runs. When it happens, every test after it goes unreported, and a test run of a PR looks like a failure of that PR. While testing the open shader PRs on this card, 9 of 21 looked broken because of this, including PRs that only change hashing or remove dead code. ## Cause I installed a temporary vectored exception handler that prints the faulting module and a backtrace (local only, not in this PR). Every crash was inside **WARP**, during `Host::dispatch`, in whichever tests were running at the time: ``` AV at d3d10warp.dll+0x7b741, reading 0x0 thread "emit::lds_tests::byte_and_halfword_reads" AV at d3d10warp.dll+0x7b3b4, reading 0x24 thread "emit::lds_tests::byte_and_halfword_writes" AV at d3d10warp.dll+0x7b741, reading 0x0 thread "emit::scratch_tests::a_store_in_lanes_off_does_not_happen" AV at d3d10warp.dll+0x7b459, reading 0x0 ... AV at d3d10warp.dll+0xa790c, ... thread None (a WARP worker) ``` with `victory_shader::emit::host::Host::dispatch` in each test thread's stack. Each test makes its own `Host`, but D3D12 gives back the same device for an adapter, so parallel tests drive WARP's one device from several threads at once. No test module crashes on its own (0 of 6 runs each, for every module with hardware tests). It takes several modules dispatching on WARP together. ## What `Host::draw` and `Host::dispatch` take a process-wide turn (`WARP_TURN`) when the device is on a software adapter. That is checked from the device's adapter LUID, so the `Host { device }` built in `lane_read_loop_tests` is covered too. Hardware adapters still run in parallel. Test code only (`#[cfg(test)]`). ## Testing RX 7600 XT, Windows 11 Pro build 26300, WARP `10.0.26100.9818`, Rust 1.98.1, the `victory_shader` test binary run directly: | | parallel runs that crashed | |---|---| | `main` | 6 / 8, 3 / 16 | | `main`, every `dispatch` serialised (experiment) | 0 / 16 | | this PR (WARP only) | **0 / 20**, 266 passed each time | Run time is unchanged: 38.8 to 41.1 s per run, against about 39 s before. I have only seen this on Windows build 26300, and other reports here (#2, #8, #74) don't mention it. It may depend on the WARP build, but taking turns on WARP is harmless where WARP is fine.
Every Host on an adapter shares the one device D3D12 makes for it, so
parallel tests drive WARP's device from several threads at once. WARP
then sometimes faults inside d3d10warp.dll (a null or near-null read
while running a dispatch), which ends the whole test process with
STATUS_ACCESS_VIOLATION. Draws and dispatches on a software adapter now
take a turn; hardware adapters still run in parallel.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:32 +00:00
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-25 17:41 UTC · original

Same crash here, RX 7900 XT (Windows 11 build 26300, d3d10warp.dll 10.0.26100.9818). On main, the victory_shader test binary died with 0xc0000005 in 4 of 6 whole-library runs, and 9 of 10 runs of emit::lds_tests emit::scratch alone. A vectored handler caught it at d3d10warp.dll+0xa790c on a WARP thread-pool thread, one of the addresses above. With the hardware adapter only (WARP skipped), 0 of 15 runs crashed.

With this PR (34813f3 on 01aadd1), the test binary run directly with the default thread count passed 20 of 20 runs, 266 passed each time (30-160 s per run; the machine was busy with other jobs).

I had a narrower fix for this locally (one lock taken by valu_tests, lds_tests and scratch_tests). This one is better, since it covers every test that reaches WARP through Host::draw/Host::dispatch, so I'm not opening mine.

**@⁠adrianmjim** on GitHub · 2026-11-25 17:41 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/140#issuecomment-7169867907) Same crash here, RX 7900 XT (Windows 11 build 26300, `d3d10warp.dll` 10.0.26100.9818). On `main`, the `victory_shader` test binary died with `0xc0000005` in 4 of 6 whole-library runs, and 9 of 10 runs of `emit::lds_tests emit::scratch` alone. A vectored handler caught it at `d3d10warp.dll+0xa790c` on a WARP thread-pool thread, one of the addresses above. With the hardware adapter only (WARP skipped), 0 of 15 runs crashed. With this PR (`34813f3` on `01aadd1`), the test binary run directly with the default thread count passed **20 of 20** runs, 266 passed each time (30-160 s per run; the machine was busy with other jobs). I had a narrower fix for this locally (one lock taken by `valu_tests`, `lds_tests` and `scratch_tests`). This one is better, since it covers every test that reaches WARP through `Host::draw`/`Host::dispatch`, so I'm not opening mine.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 05:22 UTC · original

Another data point, from an RX 6950 XT (RDNA2), Windows 11 build 26300, Rust 1.98.1. I ran the victory_shader release lib test binary 10 times in a row, with the default threads:

runs that died without a result line (exit 139) runs with a result
main 4f62c2a 2 of 10 8
main + this PR (34813f3) 0 of 10 10

Every run with a result gave 275 passed, 2 failed. The 2 failures are the RDNA2 wave-size tests fixed by #110/#204, so the PR does not change them. Earlier, while other GPU jobs were running on the same machine, main's binary died in about 1 run of 3 here too. Small samples, but it points the same way as your numbers.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-26 05:22 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/140#issuecomment-7183431266) Another data point, from an RX 6950 XT (RDNA2), Windows 11 build 26300, Rust 1.98.1. I ran the `victory_shader` release lib test binary 10 times in a row, with the default threads: | | runs that died without a result line (exit 139) | runs with a result | |---|---|---| | `main` `4f62c2a` | 2 of 10 | 8 | | `main` + this PR (`34813f3`) | **0 of 10** | 10 | Every run with a result gave 275 passed, 2 failed. The 2 failures are the RDNA2 wave-size tests fixed by #110/#204, so the PR does not change them. Earlier, while other GPU jobs were running on the same machine, `main`'s binary died in about 1 run of 3 here too. Small samples, but it points the same way as your numbers. AI-assisted (Claude Code); no game data.
github-bot force-pushed github-bot/gh-140 from 34813f393d to 1c65380155 2026-11-26 13:09:03 +00:00 Compare
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/140/head:github-bot/gh-140'
git switch 'github-bot/gh-140'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-140'
git switch 'github-bot/gh-140'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-140'
git switch 'github-bot/gh-140'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-140'
git switch 'main'
git merge --squash 'github-bot/gh-140'
git switch 'main'
git merge --ff-only 'github-bot/gh-140'
git switch 'main'
git merge 'github-bot/gh-140'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.