diff --git a/crates/metal2vulkan-conformance/README.md b/crates/metal2vulkan-conformance/README.md index 7f4a6eff9..6dc65866f 100644 --- a/crates/metal2vulkan-conformance/README.md +++ b/crates/metal2vulkan-conformance/README.md @@ -443,7 +443,9 @@ over 1,755 states, 1.519 each, the worst row `swizzled-storage-rgba8unorm` at 11 hold none, and for a reason the record states: 453 cases create no pipeline state, so there is no denominator, and 11 carry a recorded refusal instead. A bound measured over a selection would not do: `judge` refuses any selection but the whole set, which is the shape the gate runs in, so the -bound is written from a whole-set `cost --runs 8 --write` and nothing smaller. +bound is written from a whole-set `cost --runs 8 --write` and nothing smaller: `cost --write` of a +selection refuses before it runs (`cost::write_refusal`), and `cost --alone --write`, whose shape +no selection changes, writes from any. `cost`'s own per-case wall-clock figure stays **advisory**: it is printed so a reader can see where the counts are large, and it is neither recorded nor gated. Timing against Metal is the times half, diff --git a/crates/metal2vulkan-conformance/src/bin/conformance.rs b/crates/metal2vulkan-conformance/src/bin/conformance.rs index 0f0d180ce..57a4f1d43 100644 --- a/crates/metal2vulkan-conformance/src/bin/conformance.rs +++ b/crates/metal2vulkan-conformance/src/bin/conformance.rs @@ -325,6 +325,14 @@ fn cost( } else { metal2vulkan_conformance::cost::Shape::InSet }; + // Refused before the runs, which take minutes over the whole set. + if write { + let whole = metal2vulkan_conformance::cases::all().len(); + if let Some(why) = metal2vulkan_conformance::cost::write_refusal(shape, cases.len(), whole) + { + return Err(why); + } + } let (venue, measured) = if alone { run::cost_alone_on_under(venues, policy, cases, runs)? } else { diff --git a/crates/metal2vulkan-conformance/src/cost.rs b/crates/metal2vulkan-conformance/src/cost.rs index 4b87df544..0c6b317a2 100644 --- a/crates/metal2vulkan-conformance/src/cost.rs +++ b/crates/metal2vulkan-conformance/src/cost.rs @@ -1866,6 +1866,28 @@ pub enum Shape { Alone, } +/// Why a `cost --write` of `shape` over `selected` of the case set's `whole` cases writes nothing, +/// where it may not: an in-set measurement of a selection that is not the whole case set. +/// +/// A case's in-set counts are of what ran before it in the process, and [`judge`] holds them to +/// their bounds only in a run of the whole set, so a bound or ratio written from a smaller +/// selection is of a composition the gate never runs. Measured: the 36 cases the interlocked split +/// moved, written from a selection of those 36 alone, recorded `xr-masked-bgr10xr-red` at 3 +/// pipelines over its 2 states and `xr-masked-bgr10xr-blue-green` at 6, where every whole-set run +/// reads 6 and 3 (the released variants the next creation takes back are another case's in the +/// whole set), and the gate failed both. Each case alone is the same shape in any selection, so an +/// alone measurement writes from any. +pub fn write_refusal(shape: Shape, selected: usize, whole: usize) -> Option { + (shape == Shape::InSet && selected != whole).then(|| { + format!( + "--write takes an in-set measurement of the whole case set ({whole} cases) alone, \ + and this selection holds {selected}: a case's in-set counts are of what ran before \ + it, and the gate holds them to their bounds only in a run of the whole set \ + (`--alone --write` writes from any selection)" + ) + }) +} + /// What one case's cost run came to: the counts it moved, and how long it took. #[derive(Clone, Debug, PartialEq, Eq)] pub struct CaseCost { diff --git a/crates/metal2vulkan-conformance/src/tests.rs b/crates/metal2vulkan-conformance/src/tests.rs index c7e257b7b..a996e323d 100644 --- a/crates/metal2vulkan-conformance/src/tests.rs +++ b/crates/metal2vulkan-conformance/src/tests.rs @@ -7704,3 +7704,18 @@ fn a_recorded_refusal_is_unmeasured_and_gates_no_count() { "an empty record bounds every count at zero, which is what the refusal must not do" ); } + +/// `cost --write` takes an in-set measurement of the whole case set alone: a selection's in-set +/// counts are of another composition than the one the gate judges (`cost::write_refusal`), and an +/// alone measurement, whose shape no selection changes, writes from any. +#[test] +fn an_in_set_write_takes_the_whole_case_set_alone() { + use crate::cost::{write_refusal, Shape}; + let whole = crate::cases::all().len(); + assert_eq!(write_refusal(Shape::InSet, whole, whole), None); + let refused = write_refusal(Shape::InSet, 36, whole).expect("a selection of 36 is refused"); + assert!(refused.contains(&format!("{whole} cases")), "{refused}"); + assert!(refused.contains("holds 36"), "{refused}"); + assert_eq!(write_refusal(Shape::Alone, 36, whole), None); + assert_eq!(write_refusal(Shape::Alone, whole, whole), None); +}