Browse Source

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 <[email protected]>
r4. 2 days ago
parent
commit
74a9d3316d

+ 7 - 4
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)] {

+ 6 - 0
crates/victory-shader/src/emit/waterfall_tests.rs

@@ -106,6 +106,12 @@ fn run(shader: &HostShader, views: &[View]) -> Vec<(&'static str, Vec<u32>)> {
         ..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");