From a04dcd5ca6535844e49a74c9f39a104e3708efeb Mon Sep 17 00:00:00 2001 From: CharlyRien <9572419+CharlyRien@users.noreply.github.com> Date: Sat, 28 Nov 2026 23:09:07 +0100 Subject: [PATCH] Tests: XCL_REQUIRE_GPU lets a part of a test skip for its own hardware reason skip_test fails a skip under XCL_REQUIRE_GPU=mesh unless its reason is exactly "no wave64" (and under =wave64 unless it is exactly "no mesh shaders"). lower_dxil's GPU tests skip only their wave64 half, with the reason of that part: "f32 arithmetic, wave64: no wave64", "const_mask, wave64: no wave64", "mask_ff0_flbit, wave64: no wave64" and three more. On a GPU without wave64 (an RTX 3090) the suite under XCL_REQUIRE_GPU=mesh therefore failed six tests whose only skip is the one that setting allows. The rule is now skip_fails, which takes ": " as that reason. Nothing else changes: any other reason, and a part skipped for another one, still fails. Test: skip_tests::a_required_gpu_lets_through_its_hardware_reason_also_for_a_part. Co-Authored-By: Claude Opus 5.5 --- crates/xcl/src/gpu/recomp/runner.rs | 55 +++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/crates/xcl/src/gpu/recomp/runner.rs b/crates/xcl/src/gpu/recomp/runner.rs index bdebc51704..b41240e824 100644 --- a/crates/xcl/src/gpu/recomp/runner.rs +++ b/crates/xcl/src/gpu/recomp/runner.rs @@ -644,26 +644,35 @@ pub fn mesh_shaders_supported() -> Result { } /// A GPU test (or a part of one) that cannot run here, `reason` one of "no GPU", "no DXC", -/// "no wave64", "no mesh shaders": `SKIPPED : ` written to stderr itself, so the -/// line shows without `--nocapture` (libtest captures only `print!` / `eprint!`), and -/// `scripts/test.ps1` counts them. `XCL_REQUIRE_GPU=wave64` or `=mesh` (or both, comma-separated) -/// turns a skip that leaves that coverage out into a failure. +/// "no wave64", "no mesh shaders" (or `: `, the part of a test that is +/// skipped): `SKIPPED : ` written to stderr itself, so the line shows without +/// `--nocapture` (libtest captures only `print!` / `eprint!`), and `scripts/test.ps1` counts +/// them. `XCL_REQUIRE_GPU=wave64` or `=mesh` (or both, comma-separated) turns a skip that leaves +/// that coverage out into a failure. pub fn skip_test(reason: &str) { use std::io::Write; let thread = std::thread::current(); let test = thread.name().unwrap_or("?"); let required = std::env::var("XCL_REQUIRE_GPU").unwrap_or_default(); - let fails = required.split(',').map(str::trim).any(|r| match r { - "wave64" => reason != "no mesh shaders", - "mesh" => reason != "no wave64", - _ => false, - }); - if fails { + if skip_fails(&required, reason) { panic!("{test}: {reason}, but XCL_REQUIRE_GPU={required}"); } let _ = writeln!(std::io::stderr(), "SKIPPED {test}: {reason}"); } +/// Whether `XCL_REQUIRE_GPU=required` makes a skip for `reason` a failure (`skip_test`): every +/// skip but "no mesh shaders" under `wave64`, every one but "no wave64" under `mesh`. A part of +/// a test skipped for one of them (`": no wave64"`, as `lower_dxil`'s wave64 halves) is +/// that skip. +fn skip_fails(required: &str, reason: &str) -> bool { + let is = |what: &str| reason == what || reason.strip_suffix(what).is_some_and(|part| part.ends_with(": ")); + required.split(',').map(str::trim).any(|r| match r { + "wave64" => !is("no mesh shaders"), + "mesh" => !is("no wave64"), + _ => false, + }) +} + /// Run a compiled kernel (DXIL) with `state` and flat memory `mem`. pub fn run(dxil: &[u8], state: &KernelState, mem: &[u32]) -> Result { run_with(dxil, state, mem, &[], &[]) @@ -1942,3 +1951,29 @@ fn dispatch_with( Ok((out, ms)) } } + +#[cfg(test)] +mod skip_tests { + use super::skip_fails; + + /// `XCL_REQUIRE_GPU` lets through the one hardware reason it names, alone or as the reason + /// of a part of a test, and nothing else. + #[test] + fn a_required_gpu_lets_through_its_hardware_reason_also_for_a_part() { + assert!(!skip_fails("", "no GPU")); + assert!(!skip_fails("mesh", "no wave64")); + assert!(!skip_fails("mesh", "f32 arithmetic, wave64: no wave64")); + assert!(!skip_fails("mesh", "const_mask, wave64: no wave64")); + assert!(skip_fails("mesh", "no GPU")); + assert!(skip_fails("mesh", "no mesh shaders")); + assert!(skip_fails("mesh", "no heap windows")); + assert!(skip_fails("mesh", "xno wave64"), "only a whole reason after ': '"); + assert!(skip_fails("mesh", "f32: no wave64 and no GPU")); + assert!(!skip_fails("wave64", "no mesh shaders")); + assert!(!skip_fails("wave64", "mesh draw: no mesh shaders")); + assert!(skip_fails("wave64", "f32 arithmetic, wave64: no wave64")); + assert!(skip_fails("wave64, mesh", "no wave64")); + assert!(skip_fails("wave64,mesh", "no mesh shaders")); + assert!(!skip_fails("other", "no GPU")); + } +}