From 09fde985019aab866a7793e6ccc5def4ac7b11c6 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 22 Nov 2026 06:22:24 -0800 Subject: [PATCH] Tests: the variant-answers test lowers the variant where the plain module is refused, and counts the kernels whose variant alone lowers The state lowers the variant first, and makes a state from it alone where its make takes no vote word that can pass the limit. A kernel whose plain module the translator refuses was refused a state before; it is made now where its variant lowers. The test counts those kernels apart, with the plain module's refusal, so a run says how many there are. --- .../src/tests/translate.rs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/translate.rs b/crates/metal2vulkan-runtime/src/tests/translate.rs index 1eab49096..7d6c5f890 100644 --- a/crates/metal2vulkan-runtime/src/tests/translate.rs +++ b/crates/metal2vulkan-runtime/src/tests/translate.rs @@ -1937,7 +1937,7 @@ mod on_device { let translator = device.translator(); let budget = Budget::standard(); let entries = StageEntries::new(); - let (mut compared, mut skipped) = (0, unread.clone()); + let (mut compared, mut skipped, mut alone) = (0, unread.clone(), Vec::new()); for (file, library) in &libraries { for info in library.functions() { if info.stage != FunctionStage::Kernel { @@ -1979,14 +1979,23 @@ mod on_device { if !observes { return Ok(None); } - let plain = linked(&plain).map_err(|error| format!("plain: {error}"))?; - let variant = - linked(&partial).map_err(|error| format!("variant: {error}"))?; - Ok(Some((plain, variant))) + Ok(Some((linked(&plain), linked(&partial)))) })(); let (plain, variant) = match modules { - Ok(Some(modules)) => modules, + Ok(Some((Ok(plain), Ok(variant)))) => (plain, variant), Ok(None) => continue, + Ok(Some((Err(plain), Ok(_)))) => { + alone.push(format!("{what}: plain: {plain}")); + continue; + } + Ok(Some((Ok(_), Err(variant)))) => { + skipped.push(format!("{what}: variant: {variant}")); + continue; + } + Ok(Some((Err(plain), Err(_)))) => { + skipped.push(format!("{what}: plain: {plain}")); + continue; + } Err(why) => { skipped.push(format!("{what}: {why}")); continue; @@ -2011,9 +2020,14 @@ mod on_device { for why in &skipped { println!("{name}: not compared: {why}"); } + for why in &alone { + println!("{name}: the variant alone lowers: {why}"); + } println!( "{name}: {compared} observing kernels answer the same on their variant as on \ - their plain module; {} not compared", + their plain module; {} whose plain module alone the translator refuses; {} not \ + compared", + alone.len(), skipped.len() ); assert!(compared > 0, "{name}: no observing kernel compared");