GPU tests: one test on the software adapter at a time (#850) #875

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

@⁠eazyves on GitHub · 2026-11-25 11:31 UTC · original
eazyves:fix/warp-tests-one-at-a-time → main · +20 −1 · 4 files · 1 commits · open

For the crash in #850: the victory-gpu test binary now and then dies with an access violation when run with default threads.

Where it dies. Under a small debugger loop, every second-chance access violation I looked at (the last 15) was at d3d10warp.dll+0x8be6d, a read at 0x24. Filtered runs of the test binary, crashes in 100 runs each:

filter crashes
inplace 0
indirect 0
inplace:: and indirect:: together 5
everything but inplace 7
everything but indirect 2
everything but both 0

So it needs tests of several modules on WARP at once. victory-shader's tests already serialise for the same reason (ONE_AT_A_TIME). I have not found what in WARP goes wrong.

The change. Test code only: a lock that the WARP tests in inplace, indirect, queue2 and shadow hold while they use the device.

Measured, 250 runs of the whole victory-gpu lib test binary on f85101b, default threads:

without with
crashes 10 0

The "without" binary also had a retry in one inplace test (what #151 does), nothing else. Two things to know about the runs with the lock:

  • warp_budget_saturates_... still fails, now in nearly every run (248 of 250; 142 without the lock). That is the order assumption #849 and #847 fix: with the lock it runs as it does alone.
  • queue2::tests::warp_a_fetch_behind_a_fence_holds_everything_sent_before_that_fence failed once in 250. It isn't new: running only queue2::, some queue2 test failed in 3 of 150 runs without the lock (I didn't note which) and in 0 of 150 with it. I have not looked into the cause.

Limits (thanks @⁠avt0m4t48 and @⁠MamaLeVrai for checking):

  • queue2's harness leaks Second, whose timing threads can still make fence calls after the lock is let go. The two host queue tests under opt-in diagnostics WARP and the ignored tiled-resource WARP test are outside the lock.
  • It does nothing for crashes inside AMD's shader compiler (amdxc64.dll), which #850 also reports on an RX 6950 XT. My 15 were all in WARP.
  • On that RX 6950 XT: 2 crashes in 120 runs of main, 0 in 250 with this PR; the inplace test failed 10 times in 120 and 0 in 250 (their measurement, below).

cargo xtask policy passes. Clippy's -D warnings fails on main (#841), so I could not run it clean; I added no warnings to the test build.

RX 9070 XT, driver 32.0.32029.2010, Windows 11 26200, Ryzen 7 5800X3D, run from a service session. No game data. AI-assisted (Claude Code); run on my machine.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B9LnuwwsEX2idaEjw7U39G

**@⁠eazyves** on GitHub · 2026-11-25 11:31 UTC · [original](https://github.com/fxceless/victory-fork/pull/875) `eazyves:fix/warp-tests-one-at-a-time` → `main` · +20 −1 · 4 files · 1 commits · open For the crash in #850: the `victory-gpu` test binary now and then dies with an access violation when run with default threads. **Where it dies.** Under a small debugger loop, every second-chance access violation I looked at (the last 15) was at `d3d10warp.dll+0x8be6d`, a read at `0x24`. Filtered runs of the test binary, crashes in 100 runs each: | filter | crashes | |---|---| | `inplace` | 0 | | `indirect` | 0 | | `inplace::` and `indirect::` together | 5 | | everything but `inplace` | 7 | | everything but `indirect` | 2 | | everything but both | 0 | So it needs tests of several modules on WARP at once. `victory-shader`'s tests already serialise for the same reason (`ONE_AT_A_TIME`). I have not found what in WARP goes wrong. **The change.** Test code only: a lock that the WARP tests in `inplace`, `indirect`, `queue2` and `shadow` hold while they use the device. **Measured**, 250 runs of the whole `victory-gpu` lib test binary on f85101b, default threads: | | without | with | |---|---|---| | crashes | 10 | 0 | The "without" binary also had a retry in one `inplace` test (what #151 does), nothing else. Two things to know about the runs with the lock: - `warp_budget_saturates_...` still fails, now in nearly every run (248 of 250; 142 without the lock). That is the order assumption #849 and #847 fix: with the lock it runs as it does alone. - `queue2::tests::warp_a_fetch_behind_a_fence_holds_everything_sent_before_that_fence` failed once in 250. It isn't new: running only `queue2::`, some `queue2` test failed in 3 of 150 runs without the lock (I didn't note which) and in 0 of 150 with it. I have not looked into the cause. **Limits** (thanks @⁠avt0m4t48 and @⁠MamaLeVrai for checking): - `queue2`'s harness leaks `Second`, whose timing threads can still make fence calls after the lock is let go. The two host queue tests under opt-in diagnostics WARP and the ignored tiled-resource WARP test are outside the lock. - It does nothing for crashes inside AMD's shader compiler (`amdxc64.dll`), which #850 also reports on an RX 6950 XT. My 15 were all in WARP. - On that RX 6950 XT: 2 crashes in 120 runs of `main`, 0 in 250 with this PR; the `inplace` test failed 10 times in 120 and 0 in 250 (their measurement, below). `cargo xtask policy` passes. Clippy's `-D warnings` fails on `main` (#841), so I could not run it clean; I added no warnings to the test build. RX 9070 XT, driver 32.0.32029.2010, Windows 11 26200, Ryzen 7 5800X3D, run from a service session. No game data. AI-assisted (Claude Code); run on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01B9LnuwwsEX2idaEjw7U39G
WARP is one device per process; tests on it at once now and then end the
test binary with an access violation in d3d10warp.dll (#850).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B9LnuwwsEX2idaEjw7U39G
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:52:57 +00:00
Author
Owner

@⁠avt0m4t48 on GitHub · 2026-11-25 11:40 UTC · original

I checked the exact base f85101b6095e8cf3cecf8f0647cc7f5428daa177 and head 75ca59f11f333ada6b26ceeac7c72a6011e02074. The GitHub test merge has the same source tree as the head.

  • Windows MSVC cross-target cargo check --offline --locked --target x86_64-pc-windows-msvc -p victory-gpu --all-targets --features blake3/pure passed at both revisions on Rust 1.98.1. Adding diagnostics also passed at both. Warning messages matched for each base/head pair.
  • A standalone Linux probe using the exact mutex and helper passed three tests. It checked 1,536 serialized entries across 12 workers, guard release after failed setup, reacquisition after panic, and Rust drop order with a mock device. The two harnesses acquire the guard before device creation and store it after their owned fields. The lock covers 15 test entry points across inplace, indirect, queue2 and shadow.
  • One scope limit in queue2.rs is that the test harness leaks Second and starts its timing threads. Those threads can still make fence calls after the harness releases its guard if they are processing a queued timing notification. The two host queue tests under opt-in diagnostics WARP and the ignored tiled-resource WARP test also sit outside the shared lock.

The PR's GitHub Actions run showed action_required with zero jobs when checked. I did not run native Windows or measure the crash rate, so the reported WARP stress result remains the author's measurement.

**@⁠avt0m4t48** on GitHub · 2026-11-25 11:40 UTC · [original](https://github.com/fxceless/victory-fork/pull/875#issuecomment-7161353334) I checked the exact base `f85101b6095e8cf3cecf8f0647cc7f5428daa177` and head `75ca59f11f333ada6b26ceeac7c72a6011e02074`. The GitHub test merge has the same source tree as the head. - Windows MSVC cross-target `cargo check --offline --locked --target x86_64-pc-windows-msvc -p victory-gpu --all-targets --features blake3/pure` passed at both revisions on Rust 1.98.1. Adding `diagnostics` also passed at both. Warning messages matched for each base/head pair. - A standalone Linux probe using the exact mutex and helper passed three tests. It checked 1,536 serialized entries across 12 workers, guard release after failed setup, reacquisition after panic, and Rust drop order with a mock device. The two harnesses acquire the guard before device creation and store it after their owned fields. The lock covers 15 test entry points across `inplace`, `indirect`, `queue2` and `shadow`. - One scope limit in `queue2.rs` is that the test harness leaks `Second` and starts its timing threads. Those threads can still make fence calls after the harness releases its guard if they are processing a queued timing notification. The two host queue tests under opt-in diagnostics WARP and the ignored tiled-resource WARP test also sit outside the shared lock. The PR's GitHub Actions run showed `action_required` with zero jobs when checked. I did not run native Windows or measure the crash rate, so the reported WARP stress result remains the author's measurement.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 12:23 UTC · original

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head 75ca59f into main f85101b in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with exactly the errors main itself has on this machine (placed_filler_twins, depth_written, a sort; PR #841 fixes them), also with --all-features; this PR adds none. cargo test --workspace --locked: run 1: stopped at indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields (the one that fails on main itself most runs here (PR #849 and #847 fix its assertion)); run 2: stopped at indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields (the one that fails on main itself most runs here (PR #849 and #847 fix its assertion)) (main alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data.

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 12:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/875#issuecomment-7162303224) Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head `75ca59f` into `main` `f85101b` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails with exactly the errors `main` itself has on this machine (`placed_filler_twins`, `depth_written`, a sort; PR #841 fixes them), also with `--all-features`; this PR adds none. `cargo test --workspace --locked`: run 1: stopped at `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields` (the one that fails on `main` itself most runs here (PR #849 and #847 fix its assertion)); run 2: stopped at `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields` (the one that fails on `main` itself most runs here (PR #849 and #847 fix its assertion)) (`main` alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 12:28 UTC · original

Measured on another machine and card than the author's (Windows 11, RX 6950 XT, driver with amdxc64.dll, Rust 1.98.1), running the victory-gpu test binary directly, one run is one process:

runs process died (access violation) inplace::...shows_its_bytes_at_its_offset failed
main f85101b 120 2 10 (8%)
main + this PR (75ca59f) 250 0 0

(The indirect::tests::warp_budget... test fails in both: 56 of 120 on main, 175 of 250 here; this PR does not touch its assertion, #849 and #847 do.)

So the serialisation also removes the inplace test's failures on this machine, which the crash fix alone would not have predicted: that test was failing in the whole binary and never alone (VirtualFree(MEM_DECOMMIT) returning ERROR_INVALID_PARAMETER right after its placed buffer is dropped, see #878), and it fits the same cause, tests using the software adapter at the same time. I checked the lock for a re-entrant use (a test holding it and constructing a harness that takes it again, which would hang) and found none in the files this PR changes.

Earlier I also saw 9 crashes in amdxc64.dll (offset 0x17cc7e1) in other runs; none of them showed up in these 250 runs, but I did not isolate which tests cause those, so they may not be covered by a lock around WARP tests.

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 12:28 UTC · [original](https://github.com/fxceless/victory-fork/pull/875#issuecomment-7162421035) Measured on another machine and card than the author's (Windows 11, RX 6950 XT, driver with `amdxc64.dll`, Rust 1.98.1), running the `victory-gpu` test binary directly, one run is one process: | | runs | process died (access violation) | `inplace::...shows_its_bytes_at_its_offset` failed | |---|---|---|---| | `main` `f85101b` | 120 | 2 | 10 (8%) | | `main` + this PR (`75ca59f`) | 250 | 0 | 0 | (The `indirect::tests::warp_budget...` test fails in both: 56 of 120 on `main`, 175 of 250 here; this PR does not touch its assertion, #849 and #847 do.) So the serialisation also removes the `inplace` test's failures on this machine, which the crash fix alone would not have predicted: that test was failing in the whole binary and never alone (`VirtualFree(MEM_DECOMMIT)` returning `ERROR_INVALID_PARAMETER` right after its placed buffer is dropped, see #878), and it fits the same cause, tests using the software adapter at the same time. I checked the lock for a re-entrant use (a test holding it and constructing a harness that takes it again, which would hang) and found none in the files this PR changes. Earlier I also saw 9 crashes in `amdxc64.dll` (offset `0x17cc7e1`) in other runs; none of them showed up in these 250 runs, but I did not isolate which tests cause those, so they may not be covered by a lock around WARP tests. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠HailLucifer666 on GitHub · 2026-11-25 15:20 UTC · original

This is the answer to something I spent tonight failing to get, and I want to record that it is yours so nobody re-derives it: I had narrowed the crash exactly as far as your table (needs several modules on WARP at once; 0 crashes with the candidate test run alone, 20 runs; 1 in 16 with inplace:: and xmem:: skipped) and then stopped, because there is no cdb/WinDbg on this machine and WER logged nothing. You got the stack. d3d10warp.dll+0x8be6d, read at 0x24 — that is the whole missing piece.

Independent numbers for your "without" column, Windows 10, software adapter, 32 whole-binary runs at four-way process load: 3 crashes. Serial: 0 in 16. So the crash tracks concurrency, not the test binary's content, which matches your filtered table.

One ordering trap worth flagging loudly. Your note says with the lock warp_budget_saturates_without_wraparound_and_preserves_draw_fields fails in 248 of 250 runs — because serialising makes it run the way it does alone, and alone on this machine it takes [64, 65] first and the assertion at indirect.rs:1539 only accepts 1 or 2.

That means #875 on its own turns the suite red nearly every time. #970 (or #849/#847) fixes that assertion to tolerate either legal winner. Land them as a pair — #970 first, then this — and the suite is green and crash-free. Land this alone and the crash goes away while CI goes red, which will read as "the lock broke the tests".

I hit that same trap myself tonight: the 16 runs that produced my crash numbers also produced one failure of that exact assertion on current main, with nothing of mine involved.

**@⁠HailLucifer666** on GitHub · 2026-11-25 15:20 UTC · [original](https://github.com/fxceless/victory-fork/pull/875#issuecomment-7166689653) This is the answer to something I spent tonight failing to get, and I want to record that it is yours so nobody re-derives it: I had narrowed the crash exactly as far as your table (**needs several modules on WARP at once**; 0 crashes with the candidate test run alone, 20 runs; 1 in 16 with `inplace::` and `xmem::` skipped) and then stopped, because there is no `cdb`/WinDbg on this machine and WER logged nothing. You got the stack. `d3d10warp.dll+0x8be6d`, read at `0x24` — that is the whole missing piece. **Independent numbers for your "without" column**, Windows 10, software adapter, 32 whole-binary runs at four-way *process* load: 3 crashes. Serial: 0 in 16. So the crash tracks concurrency, not the test binary's content, which matches your filtered table. **One ordering trap worth flagging loudly.** Your note says with the lock `warp_budget_saturates_without_wraparound_and_preserves_draw_fields` fails in **248 of 250** runs — because serialising makes it run the way it does alone, and alone on this machine it takes `[64, 65]` first and the assertion at `indirect.rs:1539` only accepts `1` or `2`. That means **#875 on its own turns the suite red nearly every time.** #970 (or #849/#847) fixes that assertion to tolerate either legal winner. Land them as a pair — #970 first, then this — and the suite is green *and* crash-free. Land this alone and the crash goes away while CI goes red, which will read as "the lock broke the tests". I hit that same trap myself tonight: the 16 runs that produced my crash numbers also produced one failure of that exact assertion on current `main`, with nothing of mine involved.
Author
Owner

@⁠HailLucifer666 on GitHub · 2026-11-25 22:42 UTC · original

/kee review — the mechanism is sound and the measurement is the most honest in this batch, but it lands a known regression.

What holds up. The lock is well placed: _one is declared last in WarpHarness/Warp, so it drops after the device, and poisoning is handled with into_inner() rather than unwrap(). The 10/250 → 0/250 table, the per-filter breakdown, and the third-party measurements on the RX 6950 XT are the kind of evidence that usually isn't in a PR body.

What blocks it. By the PR's own table, warp_budget_saturates_... goes from failing 142/250 runs to 248/250 with the lock. That is a green→red change for a test that #849/#847 are meant to fix, and it means main would go from "sometimes red" to "red on nearly every run" in the suite. Two ways out, and the body doesn't say which is intended:

  1. Rebase on #849/#847 when they land, and re-measure — the 248/250 is the order assumption they remove.
  2. Scope the lock so the budget test keeps the parallelism it was calibrated against (it is measuring saturation, so serialising is precisely what it cannot tolerate).

Merging this first makes the failure mode deterministic without fixing it.

Smaller points.

  • pub(crate) mod tests in inplace is now the public home of one_warp_at_a_time() for three other modules. That works, but a #[cfg(test)] mod test_support would say what it is; a test module is not an API.
  • If any Warp/WarpHarness is ever leaked (mem::forget, a static, a panic inside new() after the lock is taken), the guard goes with it and every later WARP test blocks for the rest of the process. new() looks clean today — it's worth a comment saying the lock must never outlive its test.
  • The stated gaps (queue2's Second threads, the diagnostics-only host queue tests, the ignored tiled test) are the tests most likely to reproduce #850 next.
**@⁠HailLucifer666** on GitHub · 2026-11-25 22:42 UTC · [original](https://github.com/fxceless/victory-fork/pull/875#issuecomment-7176699834) `/kee` review — the mechanism is sound and the measurement is the most honest in this batch, but it lands a known regression. **What holds up.** The lock is well placed: `_one` is declared last in `WarpHarness`/`Warp`, so it drops after the device, and poisoning is handled with `into_inner()` rather than `unwrap()`. The 10/250 → 0/250 table, the per-filter breakdown, and the third-party measurements on the RX 6950 XT are the kind of evidence that usually isn't in a PR body. **What blocks it.** By the PR's own table, `warp_budget_saturates_...` goes from failing 142/250 runs to **248/250** with the lock. That is a green→red change for a test that #849/#847 are meant to fix, and it means `main` would go from "sometimes red" to "red on nearly every run" in the suite. Two ways out, and the body doesn't say which is intended: 1. Rebase on #849/#847 when they land, and re-measure — the 248/250 is the order assumption they remove. 2. Scope the lock so the budget test keeps the parallelism it was calibrated against (it is measuring saturation, so serialising is precisely what it cannot tolerate). Merging this first makes the failure mode deterministic without fixing it. **Smaller points.** - `pub(crate) mod tests` in `inplace` is now the public home of `one_warp_at_a_time()` for three other modules. That works, but a `#[cfg(test)] mod test_support` would say what it is; a test module is not an API. - If any `Warp`/`WarpHarness` is ever leaked (`mem::forget`, a static, a panic inside `new()` after the lock is taken), the guard goes with it and every later WARP test blocks for the rest of the process. `new()` looks clean today — it's worth a comment saying the lock must never outlive its test. - The stated gaps (queue2's `Second` threads, the diagnostics-only host queue tests, the ignored tiled test) are the tests most likely to reproduce #850 next.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/875/head:github-bot/gh-875'
git switch 'github-bot/gh-875'

Merge

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