Skip to content

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

Open
eazyves wants to merge 1 commit into
fxceless:mainfrom
eazyves:fix/warp-tests-one-at-a-time
Open

eazyves wants to merge 1 commit into
fxceless:mainfrom
eazyves:fix/warp-tests-one-at-a-time

Conversation

@eazyves

@eazyves eazyves commented Nov 25, 2026 •

Copy link
Copy Markdown

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:

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 f85101b: whole-suite run on an RX 6950 XT: one test fails most runs (PR #849), the lib test binary crashes now and then #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

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 (fxceless#850).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B9LnuwwsEX2idaEjw7U39G
@avt0m4t48

Copy link
Copy Markdown

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.

@MamaLeVrai

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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.

@HailLucifer666

Copy link
Copy Markdown

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

Copy link
Copy Markdown

/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 Indirect test: the two groups charge the budget in either order (the test failed 5 runs in 6) #849/Tests: the warp budget test accepts either group winning the budget race #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 f85101b: whole-suite run on an RX 6950 XT: one test fails most runs (PR #849), the lib test binary crashes now and then #850 next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants