Refuse an in-set cost --write of a selection: the gate judges the whole set alone

`judge` holds a case's in-set counts to their bounds only in a whole-set run, because a case's
counts are of what ran before it in the process; the README already says a bound is written from
a whole-set `cost --runs 8 --write` and nothing smaller. The command still wrote from any
selection, and the re-record of the 36 cases the interlocked split moved (m3-max-5515: "8 run(s)
of 36 case(s)") wrote a composition the gate never runs: `xr-masked-bgr10xr-red` at 3 pipelines
over its 2 states and `xr-masked-bgr10xr-blue-green` at 6, where the whole set reads 6 and 3 in
every run (11 whole-set processes, the record's commit 064e7a8e88 and b50a345f73, debug and
release, settled 0 to 1000 ms after each xr case: no timing moves it; the released variants the
next creation takes back are another case's in the whole set). The gate's cost --check failed six
xr-masked rows on it.

`cost::write_refusal` now refuses an in-set write of anything but the whole case set, before the
runs; `--alone --write`, whose shape no selection changes, writes from any. Tested by
`an_in_set_write_takes_the_whole_case_set_alone`. The six xr-masked records want a whole-set
write, which the M3 cost re-bless after the fill change makes.

(cherry picked from commit 36340ebbb21c0cf35872defe5ce7549f45c6012c)
This commit is contained in:
Anees Iqbal committed 2026-11-07 16:39:12 -08:00
1 parent e4107afbf0
commit b5d9e0b933
4 files changed
+48 -1

No files matched your search

+3 -1
View File
@@ -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,
@@ -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 {
@@ -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<String> {
(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 {
@@ -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);
}