Skip to content

Shader tests: serialize remaining Host::new tests with ONE_AT_A_TIME (#1882) - #2964

Open
Dukestar69 wants to merge 1 commit into
Marvisak:mainfrom
Dukestar69:fix/diff-tests-gpu-lock
Open

Dukestar69 wants to merge 1 commit into
Marvisak:mainfrom
Dukestar69:fix/diff-tests-gpu-lock

Conversation

@Dukestar69

Copy link
Copy Markdown

Summary

Serialize the remaining Host::new call sites in victory-shader tests (diff_tests.rs, rect.rs, and mod.rs::stub_pipeline_is_created) with ONE_AT_A_TIME, extending the rationale in #1882 / #1892 (credit to @fiestorra).

Related to #1882.

Testing

  • cargo test -p victory-shader emit::rect::tests: 1/1 passed.
  • cargo test -p victory-shader stub_pipeline_is_created: 1/1 passed.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 192 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified against main (63bcca43) on Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1). All updated lock sites acquire ONE_AT_A_TIME before Host::new with .unwrap_or_else(|e| e.into_inner()) (no deadlock or poison cascade even when pre-existing tests panic).

Two remaining Host::new(true) sites in victory-shader were not covered yet (optional follow-up or include here):

  1. crates/victory-shader/src/emit/synthetic_tests.rs:1006 (pops_wait_loop_exits_immediately_for_inactive_lanes) calls Host::new(true) without holding ONE_AT_A_TIME.
  2. crates/victory-shader/src/emit/host.rs:2035, 2039, 2051 (parallel_warp_pipelines_and_draws) intentionally spawns 8 concurrent WARP threads internally, so holding ONE_AT_A_TIME once at test entry would keep it from overlapping other serialized WARP tests.

Local verification:

  • Modified modules in parallel (emit::diff_tests::, emit::rect::, emit::tests::stub_pipeline_is_created, VICTORY_D3D12_DEBUG=1): 8/8 passed
  • Full parallel victory-shader --lib run: 297 passed (zero deadlocks, zero WARP concurrent crashes, zero lock-poison cascades; the 3 failures are pre-existing RTX 5090 baseline tests)
  • cargo clippy --all-targets -- -D warnings + cargo xtask policy (192 files ok): 0 warnings

@kotekompotek kotekompotek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified: the remaining Host::new tests now take ONE_AT_A_TIME, consistent with the serialized-hardware convention already in valu_tests — removes the parallel-GPU-use flake without changing coverage.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. This takes the existing valu_tests::ONE_AT_A_TIME lock in the remaining GPU tests that create a Host without it: the five device tests in emit/diff_tests.rs, the rect test in emit/rect.rs, and stub_pipeline_is_created in emit/mod.rs. Every other GPU test module already takes this lock, and its doc comment says why (hangs, and WARP access violations, when two GPU tests run at once). I checked that the modules have the same cfg(all(test, windows)) gating as valu_tests, and that none of the locked tests calls a helper that takes the lock again (run_cases does, but these tests don't use it), so the non-reentrant Mutex can't deadlock.

CI: not run on this head (no check runs reported).

Recommending a look, not approving.


Generated by Claude Code

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants