Shader tests: run the VALU GPU tests one at a time (cargo test hangs now and then) #433

Manually merged
github merged 1 commit from gh-pr/433/head into gh-pr/433/base 2026-11-26 04:03:48 +00:00
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:18 UTC · original
r4tedx:tests/serialise-valu-gpu-tests → main · +5 −0 · 1 files · 1 commits · merged 2026-11-24 08:15 UTC

What

cargo test now and then never finishes. The seven emit::valu_tests that run on the hardware adapter and on WARP start together on the test threads, none of their dispatches completes, and the test binary keeps one core busy until it is killed (the waits spin on the fence). Any other GPU test running at that moment is stuck with them.

run_cases, which all seven go through, now takes a process-wide lock, so they use the GPU one at a time. The lock is poison-tolerant, so one failing test does not fail the others. Five lines, tests only.

This is not #181's crash, which #244 fixes by serialising WARP operations. A hang was seen on #244 too and put down as probably separate; the numbers below agree. The two changes compose: #244 covers every WARP user, this one keeps these seven tests from overlapping on the hardware adapter as well.

Not verified

I do not know the cause inside the driver or the D3D12 runtime, only that the hang needs these tests to overlap. The tester above traced where it stops: in every hang all seven tests had created their pipeline and were inside their first dispatch, stopped at different calls (CreateCommandQueue, Close, after Signal, after the fence wait), so it looks like the device stalling when several threads use it at once (D3D12 gives every test the same device for an adapter), not one call deadlocking. Replacing the fence polling with an event did not help there (6 of 120 hung).

It is not universal. A second machine with an NVIDIA card and a Radeon iGPU (RTX 5080) reproduces it more often than mine and confirms the fix: the whole victory-shader lib suite hung in 8 of 60 runs on main and 0 of 60 with this PR; with the seven tests on the RTX 5080 alone, 6 of 40 against 0 of 40. (#244 alone hung in 3 of 60 there, as it did here.) Elsewhere it is rare or absent. A run on a machine with one hardware adapter (RTX 3060, no iGPU) saw no hang on main in 30 runs, so there the fix is unconfirmed and only shown harmless. A reviewer on an RTX 5070 machine did see it once without this change: a full cargo test --workspace in which six of these tests sat for more than 10 minutes, and then 5 of 5 standalone runs passed, with and without the lock. My machine has a second adapter (a Radeon iGPU), which the seven tests do not use.

Tested

Windows 11, NVIDIA RTX 5070 with an AMD Radeon iGPU, debug, d2a4bae. The workspace build of the victory-shader test binary, run in a loop with valu_tests as the filter and a 45 s limit per run (a good run takes about 3 s):

runs hung crashed
main d2a4bae 30 3 0
#244 7f95b87 60 3 1 (access violation)
this PR 60 0 0

Split by backend with a local switch (not in the PR), 40 runs each:

valu_tests filter main this PR
hardware adapter only 1 hung, 0 crashed 0 hung, 0 crashed
WARP only 0 hung, 29 crashed (access violation, #181's) 0 hung, 0 crashed

So the hang does not need WARP, and with the seven tests one at a time they do not overlap on WARP either.

The same split on a machine with one hardware adapter (RTX 3060), 40 runs each:

valu_tests filter main this PR
hardware adapter only 0 hung, 0 crashed 0 hung, 0 crashed
WARP only 40 crashed 0 crashed

So the WARP-only crash and its removal are confirmed on a second machine. The hardware-adapter hang has been seen on three machines: mine, the RTX 5080 machine above (which has its own before-and-after counts), and once on the reviewer's RTX 5070. Not on the RTX 3060. A second adapter is not needed: a machine whose only adapter is an RTX 5060 Ti hangs too (2 of 90 valu_tests runs and 3 of 52 whole-lib runs on main, 0 of 120 with this PR), more often under CPU load.

  • The same binary with --skip valu_tests: 0 of 14 hung (on a branch with more GPU tests than main), so nothing else in the suite does this here.
  • cargo test --workspace: 264 passed, 0 failed, 4 ignored. The seven tests take under 7 s one at a time.

AI-assisted; no game assets were used.

🤖 Generated with Claude Code

**@⁠r4tedx** on GitHub · 2026-11-24 03:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/433) `r4tedx:tests/serialise-valu-gpu-tests` → `main` · +5 −0 · 1 files · 1 commits · merged 2026-11-24 08:15 UTC ## What `cargo test` now and then never finishes. The seven `emit::valu_tests` that run on the hardware adapter and on WARP start together on the test threads, none of their dispatches completes, and the test binary keeps one core busy until it is killed (the waits spin on the fence). Any other GPU test running at that moment is stuck with them. `run_cases`, which all seven go through, now takes a process-wide lock, so they use the GPU one at a time. The lock is poison-tolerant, so one failing test does not fail the others. Five lines, tests only. This is not #181's crash, which #244 fixes by serialising WARP operations. A hang was [seen on #244 too](https://git.gtahub.st/github/Marvisak--VIctory/pulls/244) and put down as probably separate; the numbers below agree. The two changes compose: #244 covers every WARP user, this one keeps these seven tests from overlapping on the hardware adapter as well. ## Not verified I do not know the cause inside the driver or the D3D12 runtime, only that the hang needs these tests to overlap. The tester above traced where it stops: in every hang all seven tests had created their pipeline and were inside their first dispatch, stopped at different calls (`CreateCommandQueue`, `Close`, after `Signal`, after the fence wait), so it looks like the device stalling when several threads use it at once (D3D12 gives every test the same device for an adapter), not one call deadlocking. Replacing the fence polling with an event did not help there (6 of 120 hung). It is not universal. [A second machine with an NVIDIA card and a Radeon iGPU](https://git.gtahub.st/github/Marvisak--VIctory/pulls/433) (RTX 5080) reproduces it more often than mine and confirms the fix: the whole `victory-shader` lib suite hung in 8 of 60 runs on `main` and 0 of 60 with this PR; with the seven tests on the RTX 5080 alone, 6 of 40 against 0 of 40. (#244 alone hung in 3 of 60 there, as it did here.) Elsewhere it is rare or absent. [A run on a machine with one hardware adapter](https://git.gtahub.st/github/Marvisak--VIctory/pulls/433) (RTX 3060, no iGPU) saw no hang on `main` in 30 runs, so there the fix is unconfirmed and only shown harmless. [A reviewer on an RTX 5070 machine](https://git.gtahub.st/github/Marvisak--VIctory/pulls/433) did see it once without this change: a full `cargo test --workspace` in which six of these tests sat for more than 10 minutes, and then 5 of 5 standalone runs passed, with and without the lock. My machine has a second adapter (a Radeon iGPU), which the seven tests do not use. ## Tested Windows 11, NVIDIA RTX 5070 with an AMD Radeon iGPU, debug, `d2a4bae`. The workspace build of the `victory-shader` test binary, run in a loop with `valu_tests` as the filter and a 45 s limit per run (a good run takes about 3 s): | | runs | hung | crashed | |---|---|---|---| | `main` `d2a4bae` | 30 | 3 | 0 | | #244 `7f95b87` | 60 | 3 | 1 (access violation) | | this PR | 60 | 0 | 0 | Split by backend with a local switch (not in the PR), 40 runs each: | `valu_tests` filter | `main` | this PR | |---|---|---| | hardware adapter only | 1 hung, 0 crashed | 0 hung, 0 crashed | | WARP only | 0 hung, 29 crashed (access violation, #181's) | 0 hung, 0 crashed | So the hang does not need WARP, and with the seven tests one at a time they do not overlap on WARP either. The same split on [a machine with one hardware adapter](https://git.gtahub.st/github/Marvisak--VIctory/pulls/433) (RTX 3060), 40 runs each: | `valu_tests` filter | `main` | this PR | |---|---|---| | hardware adapter only | 0 hung, 0 crashed | 0 hung, 0 crashed | | WARP only | 40 crashed | 0 crashed | So the WARP-only crash and its removal are confirmed on a second machine. The hardware-adapter hang has been seen on three machines: mine, the RTX 5080 machine above (which has its own before-and-after counts), and once on the reviewer's RTX 5070. Not on the RTX 3060. A second adapter is not needed: [a machine whose only adapter is an RTX 5060 Ti](https://git.gtahub.st/github/Marvisak--VIctory/pulls/433) hangs too (2 of 90 `valu_tests` runs and 3 of 52 whole-lib runs on `main`, 0 of 120 with this PR), more often under CPU load. - The same binary with `--skip valu_tests`: 0 of 14 hung (on a branch with more GPU tests than `main`), so nothing else in the suite does this here. - `cargo test --workspace`: 264 passed, 0 failed, 4 ignored. The seven tests take under 7 s one at a time. AI-assisted; no game assets were used. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`cargo test` now and then never finishes: the seven emit::valu_tests
that run on the hardware adapter and on WARP start together on the
test threads, none of their dispatches completes, and the test binary
keeps one core busy until it is killed (the waits spin on the fence).
Any other GPU test running at that moment is stuck with them.

On an RTX 5070 with a Radeon iGPU, `valu_tests` alone in a loop on
main d2a4bae: 3 of 30 runs hang. With `run_cases` behind a
process-wide lock: 0 of 60, and the seven tests take under 7 s.

The lock is poison-tolerant, so one failing test does not fail the
rest.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:03:48 +00:00
github manually merged commit 1106f43efe into gh-pr/433/base 2026-11-26 04:03:48 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 03:38 UTC · original

Verified 1106f43 on Arch Linux x86_64 with the Windows MSVC release test build under Wine 11.22:

  • Builds clean.
  • victory-shader: 62 passed, 7 failed — the same 7 as main (d2a4bae) with --test-threads=1: bfe_signed_and_unsigned_match_rdna2, v_fract_f16/f32_never_returns_one, v_med3_f16/f32_matches_rdna2_with_nan, v_sin_and_v_cos_f16/f32_reduce_large_turns, all panicking with “neither hardware nor WARP SM 6.6 device available”. So this run cannot exercise the serialisation at all: the VALU GPU tests skip here instead of running concurrently.

The change itself is test-only and does not affect the library suite. A machine with an SM 6.6 device should confirm that the previously intermittent hang is gone.

**@⁠DaviTostes** on GitHub · 2026-11-24 03:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7121279590) Verified `1106f43` on **Arch Linux x86_64** with the Windows MSVC release test build under **Wine 11.22**: - Builds clean. - `victory-shader`: **62 passed, 7 failed** — the same 7 as `main` (`d2a4bae`) with `--test-threads=1`: `bfe_signed_and_unsigned_match_rdna2`, `v_fract_f16/f32_never_returns_one`, `v_med3_f16/f32_matches_rdna2_with_nan`, `v_sin_and_v_cos_f16/f32_reduce_large_turns`, all panicking with “neither hardware nor WARP SM 6.6 device available”. So this run cannot exercise the serialisation at all: the VALU GPU tests skip here instead of running concurrently. The change itself is test-only and does not affect the library suite. A machine with an SM 6.6 device should confirm that the previously intermittent hang is gone.
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 03:42 UTC · original

Tested 1106f43 natively on a machine with an SM 6.6 device, so the seven VALU tests actually run here on the hardware adapter and on WARP.

Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), no iGPU (one hardware adapter), Rust 1.98.1 x86_64-pc-windows-msvc, debug.

Loop, same method as the description (test binary with the valu_tests filter, 45 s limit per run):

runs ok hung crashed
main d2a4bae 30 30 0 0
this PR 30 30 0 0
main, whole victory-shader binary 10 10 0 0
this PR, whole victory-shader binary 10 10 0 0

So I could not reproduce the hang on main on this machine, and I can't confirm the fix from these numbers. They do show it changes nothing here. Possibly relevant: your machine has a second (AMD) adapter and this one doesn't. Once, on my very first cargo test --workspace on main (while the workspace was still building), the victory-shader lib binary exited with STATUS_ACCESS_VIOLATION. Five later workspace runs and every loop above were clean, so I have nothing reproducible there.

Cost: the seven tests one at a time take 5.5–6.4 s against 2.45–2.70 s in parallel (5 runs each), which matches "under 7 s".

Other checks on this PR:

  • cargo test --locked --workspace: 264 passed, 0 failed, 4 ignored
  • cargo clippy --locked -p victory-shader --all-targets: no warnings; cargo fmt --check, git diff --check: clean
  • cargo xtask policy: 151 files ok

Not tested: a machine with two adapters; no game data used.

AI-assisted (Claude Code) ran the checks and drafted this comment.

**@⁠fromthemoonx** on GitHub · 2026-11-24 03:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7121343095) Tested `1106f43` natively on a machine with an SM 6.6 device, so the seven VALU tests actually run here on the hardware adapter and on WARP. **Environment:** Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), **no iGPU** (one hardware adapter), Rust 1.98.1 `x86_64-pc-windows-msvc`, debug. **Loop, same method as the description** (test binary with the `valu_tests` filter, 45 s limit per run): | | runs | ok | hung | crashed | |---|---|---|---|---| | `main` `d2a4bae` | 30 | 30 | 0 | 0 | | this PR | 30 | 30 | 0 | 0 | | `main`, whole `victory-shader` binary | 10 | 10 | 0 | 0 | | this PR, whole `victory-shader` binary | 10 | 10 | 0 | 0 | So I could not reproduce the hang on `main` on this machine, and I can't confirm the fix from these numbers. They do show it changes nothing here. Possibly relevant: your machine has a second (AMD) adapter and this one doesn't. Once, on my very first `cargo test --workspace` on `main` (while the workspace was still building), the `victory-shader` lib binary exited with `STATUS_ACCESS_VIOLATION`. Five later workspace runs and every loop above were clean, so I have nothing reproducible there. **Cost:** the seven tests one at a time take 5.5–6.4 s against 2.45–2.70 s in parallel (5 runs each), which matches "under 7 s". **Other checks on this PR:** - `cargo test --locked --workspace`: 264 passed, 0 failed, 4 ignored - `cargo clippy --locked -p victory-shader --all-targets`: no warnings; `cargo fmt --check`, `git diff --check`: clean - `cargo xtask policy`: 151 files ok **Not tested:** a machine with two adapters; no game data used. AI-assisted (Claude Code) ran the checks and drafted this comment.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:53 UTC · original

Thank you, that is the check this needed, and it limits what I can claim: on a machine with one hardware adapter the hang does not happen on main in 30 runs, so the fix is unconfirmed there and only shown harmless.

Your point about the second adapter made me split the test by backend here (RTX 5070 plus a Radeon iGPU; the seven tests use only the default adapter, the RTX 5070, and WARP). A local switch, not in the PR, makes run_cases use one backend; 40 runs each, 45 s limit:

valu_tests filter main d2a4bae this PR
hardware adapter only 1 hung, 0 crashed 0 hung, 0 crashed
WARP only 0 hung, 29 crashed (access violation) 0 hung, 0 crashed
both, as the tests are written 3 hung of 30 0 hung of 60

So on this machine:

  • The hang does not need WARP. It happens with the seven tests on the hardware adapter alone, each creating a device, a pipeline and a queue on its own test thread. I still do not know the cause, and your result says it is not universal: it may need this driver, this card or the second adapter being present.
  • The WARP-only crashes are #181's, which #244 fixes for every WARP user. With these seven tests one at a time they do not overlap on WARP either, which is why the last column is clean without #244.

I have put your result and this table into the description.

No game data used. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 03:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7121512102) Thank you, that is the check this needed, and it limits what I can claim: on a machine with one hardware adapter the hang does not happen on `main` in 30 runs, so the fix is unconfirmed there and only shown harmless. Your point about the second adapter made me split the test by backend here (RTX 5070 plus a Radeon iGPU; the seven tests use only the default adapter, the RTX 5070, and WARP). A local switch, not in the PR, makes `run_cases` use one backend; 40 runs each, 45 s limit: | `valu_tests` filter | `main` `d2a4bae` | this PR | |---|---|---| | hardware adapter only | 1 hung, 0 crashed | 0 hung, 0 crashed | | WARP only | 0 hung, 29 crashed (access violation) | 0 hung, 0 crashed | | both, as the tests are written | 3 hung of 30 | 0 hung of 60 | So on this machine: - The hang does not need WARP. It happens with the seven tests on the hardware adapter alone, each creating a device, a pipeline and a queue on its own test thread. I still do not know the cause, and your result says it is not universal: it may need this driver, this card or the second adapter being present. - The WARP-only crashes are #181's, which #244 fixes for every WARP user. With these seven tests one at a time they do not overlap on WARP either, which is why the last column is clean without #244. I have put your result and this table into the description. No game data used. AI-assisted.
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 04:17 UTC · original

Ran your split here (RTX 3060, single adapter, same environment as above), with the same kind of local switch in run_cases (not pushed), 40 runs each, 45 s limit:

valu_tests filter main d2a4bae this PR 1106f43
hardware adapter only 40 ok, 0 hung, 0 crashed 40 ok
WARP only 0 ok, 40 crashed (0xC0000005) 40 ok
both, as written (from above) 30 ok of 30 30 ok of 30

So on this machine:

  • The hardware-adapter hang does not reproduce, so that part is still specific to your setup.
  • The WARP-only crash reproduces every time on main, and this PR removes it. With both backends the hardware pass seems to stagger the threads enough that they never overlap on WARP here, which is why main looked clean before.

No game data used. AI-assisted (Claude Code).

**@⁠fromthemoonx** on GitHub · 2026-11-24 04:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7121879679) Ran your split here (RTX 3060, single adapter, same environment as above), with the same kind of local switch in `run_cases` (not pushed), 40 runs each, 45 s limit: | `valu_tests` filter | `main` `d2a4bae` | this PR `1106f43` | |---|---|---| | hardware adapter only | 40 ok, 0 hung, 0 crashed | 40 ok | | WARP only | 0 ok, **40 crashed** (`0xC0000005`) | 40 ok | | both, as written (from above) | 30 ok of 30 | 30 ok of 30 | So on this machine: - The hardware-adapter hang does not reproduce, so that part is still specific to your setup. - The WARP-only crash reproduces every time on `main`, and this PR removes it. With both backends the hardware pass seems to stagger the threads enough that they never overlap on WARP here, which is why `main` looked clean before. No game data used. AI-assisted (Claude Code).
Author
Owner

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

Thank you for running the split. That gives the PR one thing it can claim on more than my machine, and one it cannot:

  • confirmed on yours: the seven tests overlapping on WARP crash every time on main once the hardware pass no longer staggers them, and one at a time they do not;
  • still only mine: the hang with the hardware adapter alone (1 of 40 here, 0 of 40 on yours).

I have added your table to the description and said so there.

No game data used. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 04:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7121900399) Thank you for running the split. That gives the PR one thing it can claim on more than my machine, and one it cannot: - confirmed on yours: the seven tests overlapping on WARP crash every time on `main` once the hardware pass no longer staggers them, and one at a time they do not; - still only mine: the hang with the hardware adapter alone (1 of 40 here, 0 of 40 on yours). I have added your table to the description and said so there. No game data used. AI-assisted.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 05:54 UTC · original

@⁠mercuryVM thank you for the review, and for the data point: six of these tests stuck for more than 10 minutes in a full cargo test --workspace on an RTX 5070 machine is the first sighting of the hang outside mine. The description said it had only been seen here; I have corrected that and linked your review. It now reads: seen on two machines (once on yours), not on the RTX 3060, and still only one before-and-after count (3 of 30 against 0 of 60, mine).

AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 05:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7123395087) @⁠mercuryVM thank you for the review, and for the data point: six of these tests stuck for more than 10 minutes in a full `cargo test --workspace` on an RTX 5070 machine is the first sighting of the hang outside mine. The description said it had only been seen here; I have corrected that and linked your review. It now reads: seen on two machines (once on yours), not on the RTX 3060, and still only one before-and-after count (3 of 30 against 0 of 60, mine). AI-assisted (Claude Code).
Author
Owner

@⁠Lyrnc on GitHub · 2026-11-24 06:14 UTC · original

A second machine with your layout (one NVIDIA card plus a Radeon iGPU): the hang reproduces on main here, including with the hardware adapter alone, and this PR removes it.

Machine. RTX 5080 (driver 610.88), the default adapter, plus the AMD Radeon iGPU of a Ryzen 7 9800X3D (driver 32.0.21042.62). Windows 11 Pro 26200, Rust 1.98.1, debug. cargo test -p victory-shader --lib --no-run per tree, then the test binary run directly with -q, default test threads, 60 s limit per run. A run that hit the limit is "hung" (one core busy, no further output); "crashed" means it exited with 0xC0000005. No game data.

Whole victory-shader lib suite (69 tests):

Tree Runs Hung Crashed
main d2a4bae 60 8 0
this PR 1106f43 60 0 0
this PR + #244 7f95b87 40 0 0
#244 alone 60 3 0

Your split (valu_tests filter, a local switch in run_cases that keeps one backend, not pushed):

Backend main this PR
hardware adapter (RTX 5080) only 6 hung, 0 crashed of 40 0 hung, 0 crashed of 40
WARP only 0 hung, 23 crashed of 40 0 hung, 0 crashed of 40

That is the case you had seen only on your machine (1 of 40 there, 0 of 40 on fromthemoonx's single-adapter RTX 3060). Here it is 6 of 40, with the seven tests on the RTX 5080 alone, and none with this PR. Both machines with a hang have a Radeon iGPU next to the NVIDIA card, which fits your guess about the second adapter. I can't take the iGPU out to test that directly.

So on a second machine: the WARP-only crashes are #181's (fixed for every WARP user by #244), and the hang does not need WARP. #244 alone still hung 3 times in 60 here; this PR alone, and the two together, never did.

AI use: Claude Code (Claude Opus 5.5) ran the loops and drafted this comment; the counts come from the runs above.

**@⁠Lyrnc** on GitHub · 2026-11-24 06:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7123732853) A second machine with your layout (one NVIDIA card plus a Radeon iGPU): **the hang reproduces on `main` here, including with the hardware adapter alone, and this PR removes it.** **Machine.** RTX 5080 (driver 610.88), the default adapter, plus the AMD Radeon iGPU of a Ryzen 7 9800X3D (driver 32.0.21042.62). Windows 11 Pro 26200, Rust 1.98.1, debug. `cargo test -p victory-shader --lib --no-run` per tree, then the test binary run directly with `-q`, default test threads, 60 s limit per run. A run that hit the limit is "hung" (one core busy, no further output); "crashed" means it exited with `0xC0000005`. No game data. **Whole `victory-shader` lib suite** (69 tests): | Tree | Runs | Hung | Crashed | |---|---|---|---| | `main` `d2a4bae` | 60 | **8** | 0 | | this PR `1106f43` | 60 | **0** | 0 | | this PR + #244 `7f95b87` | 40 | 0 | 0 | | #244 alone | 60 | 3 | 0 | **Your split** (`valu_tests` filter, a local switch in `run_cases` that keeps one backend, not pushed): | Backend | `main` | this PR | |---|---|---| | hardware adapter (RTX 5080) only | **6 hung**, 0 crashed of 40 | 0 hung, 0 crashed of 40 | | WARP only | 0 hung, **23 crashed** of 40 | 0 hung, 0 crashed of 40 | That is the case you had seen only on your machine (1 of 40 there, 0 of 40 on fromthemoonx's single-adapter RTX 3060). Here it is 6 of 40, with the seven tests on the RTX 5080 alone, and none with this PR. Both machines with a hang have a Radeon iGPU next to the NVIDIA card, which fits your guess about the second adapter. I can't take the iGPU out to test that directly. So on a second machine: the WARP-only crashes are #181's (fixed for every WARP user by #244), and the hang does not need WARP. #244 alone still hung 3 times in 60 here; this PR alone, and the two together, never did. AI use: Claude Code (Claude Opus 5.5) ran the loops and drafted this comment; the counts come from the runs above.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 06:16 UTC · original

@⁠Lyrnc thank you, that is the confirmation this PR was missing: the hang on the hardware adapter alone, on a second machine, with a before-and-after count (6 of 40 against 0 of 40, and 8 of 60 against 0 of 60 for the whole lib suite). Your rate on main is higher than mine (3 of 30), and your #244-alone result (3 of 60) matches what I saw here.

The description now cites your numbers and says the hang has been seen on three machines, repeatedly on the two that have a Radeon iGPU next to the NVIDIA card. I have left the second-adapter idea as untested, since neither of us can remove the iGPU; if anyone has a discrete NVIDIA card in a system with the iGPU disabled in firmware, the 40-run valu_tests loop on main would settle it.

Nothing changed in the code; head is still 1106f43. The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 06:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7123766133) @⁠Lyrnc thank you, that is the confirmation this PR was missing: the hang on the hardware adapter alone, on a second machine, with a before-and-after count (6 of 40 against 0 of 40, and 8 of 60 against 0 of 60 for the whole lib suite). Your rate on `main` is higher than mine (3 of 30), and your #244-alone result (3 of 60) matches what I saw here. The description now cites your numbers and says the hang has been seen on three machines, repeatedly on the two that have a Radeon iGPU next to the NVIDIA card. I have left the second-adapter idea as untested, since neither of us can remove the iGPU; if anyone has a discrete NVIDIA card in a system with the iGPU disabled in firmware, the 40-run `valu_tests` loop on `main` would settle it. Nothing changed in the code; head is still `1106f43`. The title was not used in these tests. AI-assisted (Claude Code).
Author
Owner

@⁠lameloball2813-ui on GitHub · 2026-11-24 07:33 UTC · original

Another data point: RTX 5060 Ti, the only adapter in the machine (no iGPU), Windows 11, NVIDIA driver 32.0.16.1088, debug build of d2a4bae. So a second adapter isn't needed for the hang.

Test binary run in a loop, 45–60 s limit per run (a good run takes about 3 s):

Build Filter Runs Hung
main valu_tests 90 2
main whole victory-shader lib 52 3
#244 7f95b87 whole lib 90 7
this PR 1106f43 valu_tests 120 0

The #244 runs hung more often while other builds and tests were loading the CPU, so load seems to make it likelier.

Where it stops. In a local build I wrote a line to a file before and after each step of run_cases and Host::dispatch (flushed each time, so a hang keeps it). In every hang, all seven tests had created their pipeline on the hardware adapter and were inside their first dispatch. Within one hang they stop at different calls: CreateCommandQueue, Close, right after Signal, and after the fence wait. So it doesn't look like one call deadlocking. It looks like the whole device stalling when several threads use it at once (D3D12 gives every test the same device for the same adapter).

The fence polling isn't the cause. I replaced both while fence.GetCompletedValue() < 1 { yield_now() } loops in emit/host.rs with SetEventOnCompletion(1, null): still 6 hung in 120 runs. A 20 s timeout I put inside the polling loop also never fired, so in those threads GetCompletedValue/GetDeviceRemovedReason themselves never return.

So running the seven tests one at a time is the fix here too. The runtime in victory-gpu already waits with an event and doesn't share devices across threads this way, so this looks confined to the test harness.

**@⁠lameloball2813-ui** on GitHub · 2026-11-24 07:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7125114843) Another data point: **RTX 5060 Ti, the only adapter in the machine (no iGPU)**, Windows 11, NVIDIA driver 32.0.16.1088, debug build of `d2a4bae`. So a second adapter isn't needed for the hang. Test binary run in a loop, 45–60 s limit per run (a good run takes about 3 s): | Build | Filter | Runs | Hung | |---|---|---|---| | `main` | `valu_tests` | 90 | 2 | | `main` | whole `victory-shader` lib | 52 | 3 | | #244 `7f95b87` | whole lib | 90 | 7 | | this PR `1106f43` | `valu_tests` | 120 | **0** | The #244 runs hung more often while other builds and tests were loading the CPU, so load seems to make it likelier. **Where it stops.** In a local build I wrote a line to a file before and after each step of `run_cases` and `Host::dispatch` (flushed each time, so a hang keeps it). In every hang, all seven tests had created their pipeline on the hardware adapter and were inside their first `dispatch`. Within one hang they stop at different calls: `CreateCommandQueue`, `Close`, right after `Signal`, and after the fence wait. So it doesn't look like one call deadlocking. It looks like the whole device stalling when several threads use it at once (D3D12 gives every test the same device for the same adapter). **The fence polling isn't the cause.** I replaced both `while fence.GetCompletedValue() < 1 { yield_now() }` loops in `emit/host.rs` with `SetEventOnCompletion(1, null)`: still 6 hung in 120 runs. A 20 s timeout I put inside the polling loop also never fired, so in those threads `GetCompletedValue`/`GetDeviceRemovedReason` themselves never return. So running the seven tests one at a time is the fix here too. The runtime in `victory-gpu` already waits with an event and doesn't share devices across threads this way, so this looks confined to the test harness.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 07:40 UTC · original

@⁠lameloball2813-ui thank you, this settles two things the description had open, and both are now in it with a link to your comment.

  • A second adapter is not needed. The idea came from the two machines that showed the hang repeatedly both having a Radeon iGPU; an RTX 5060 Ti alone hanging on main (2 of 90 and 3 of 52) and not with the lock (0 of 120) rules it out.
  • Where it stops. Your trace is the first look inside a hang: all seven past pipeline creation and inside their first dispatch, stopped at different calls, with GetCompletedValue itself not returning. That reads as the shared device stalling under several threads, as you say, not as one call deadlocking, and it explains why swapping the fence polling for an event did not help. The load sensitivity fits too: #244 alone hung more here and on another machine as well.

So the fix stays what it is, one test at a time, and the cause stays in the test harness's use of one device from seven threads. I agree the runtime is a different case, though I have not checked that claim against victory-gpu myself.

Head unchanged (1106f43). The title was not used in these tests. AI-assisted (Claude Code).

**@⁠r4tedx** on GitHub · 2026-11-24 07:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/433#issuecomment-7125249138) @⁠lameloball2813-ui thank you, this settles two things the description had open, and both are now in it with a link to your comment. - **A second adapter is not needed.** The idea came from the two machines that showed the hang repeatedly both having a Radeon iGPU; an RTX 5060 Ti alone hanging on `main` (2 of 90 and 3 of 52) and not with the lock (0 of 120) rules it out. - **Where it stops.** Your trace is the first look inside a hang: all seven past pipeline creation and inside their first dispatch, stopped at different calls, with `GetCompletedValue` itself not returning. That reads as the shared device stalling under several threads, as you say, not as one call deadlocking, and it explains why swapping the fence polling for an event did not help. The load sensitivity fits too: #244 alone hung more here and on another machine as well. So the fix stays what it is, one test at a time, and the cause stays in the test harness's use of one device from seven threads. I agree the runtime is a different case, though I have not checked that claim against `victory-gpu` myself. Head unchanged (`1106f43`). The title was not used in these tests. AI-assisted (Claude Code).
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!433
No description provided.