From 74a9d3316de69b65eb64b2fa5c06089d8979ed6f Mon Sep 17 00:00:00 2001 From: "r4." <192970269+r4tedx@users.noreply.github.com> Date: Tue, 24 Nov 2026 11:26:39 +0200 Subject: [PATCH] Shader tests: the waterfall tests take the GPU one at a time, with the VALU tests The four tests of emit/waterfall_tests.rs each dispatch on the hardware adapter and on WARP. Run in parallel, the test process sometimes died of an access violation (7 of 24 runs of these four tests on an integration branch; an image test beside a VALU test does the same on WARP). They now take the VALU tests' lock, which moves out of `run_cases` to be shared. With it: 340 workspace tests pass with VICTORY_WARP=1, as on a CI runner, and the shader tests pass on the RTX 5070. Co-Authored-By: Claude Fable 5.2 --- crates/victory-shader/src/emit/valu_tests.rs | 11 +++++++---- crates/victory-shader/src/emit/waterfall_tests.rs | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/victory-shader/src/emit/valu_tests.rs b/crates/victory-shader/src/emit/valu_tests.rs index 6ebd5c0..b4ee77d 100644 --- a/crates/victory-shader/src/emit/valu_tests.rs +++ b/crates/victory-shader/src/emit/valu_tests.rs @@ -160,6 +160,13 @@ fn build_valu_cs(body: &[u32]) -> HostShader { shader } +/// One GPU test at a time. With these tests on the hardware adapter and WARP +/// from several test threads at once, now and then none of their dispatches +/// ever completes and the test binary hangs; and two GPU tests at once on +/// WARP can end the test process with an access violation. Other GPU test +/// modules take this lock too. +pub(super) static ONE_AT_A_TIME: std::sync::Mutex<()> = std::sync::Mutex::new(()); + /// Runs `shader` on every available SM 6.6 host (hardware GPU and WARP) for /// each 4-dword input set and invokes `check(backend, case_index, inputs, result_dword)`. fn run_cases( @@ -167,10 +174,6 @@ fn run_cases( cases: &[[u32; 4]], mut check: impl FnMut(&str, usize, [u32; 4], u32), ) { - // One test at a time: with these tests on the hardware adapter and WARP - // from several test threads at once, now and then none of their - // dispatches ever completes and the test binary hangs. - static ONE_AT_A_TIME: std::sync::Mutex<()> = std::sync::Mutex::new(()); let _one = ONE_AT_A_TIME.lock().unwrap_or_else(|e| e.into_inner()); let mut ran = 0; for (label, warp) in [("hardware", false), ("warp", true)] { diff --git a/crates/victory-shader/src/emit/waterfall_tests.rs b/crates/victory-shader/src/emit/waterfall_tests.rs index a2949e5..72e0b95 100644 --- a/crates/victory-shader/src/emit/waterfall_tests.rs +++ b/crates/victory-shader/src/emit/waterfall_tests.rs @@ -106,6 +106,12 @@ fn run(shader: &HostShader, views: &[View]) -> Vec<(&'static str, Vec)> { ..Default::default() }]; let mut out = Vec::new(); + // One GPU test at a time, with the VALU tests: in parallel on the + // hardware adapter and WARP the test process sometimes died of an + // access violation (7 of 24 runs of these four tests). + let _one = super::valu_tests::ONE_AT_A_TIME + .lock() + .unwrap_or_else(|e| e.into_inner()); for (label, warp) in [("hardware", false), ("warp", true)] { let Ok(host) = Host::new(warp) else { eprintln!("no SM 6.6 {label} device; skipped");