Cost runs name a release build's venue apart from the debug binary's records

What: cost::venue names the venue a cost run is held to and writes: the device's name in a
build with debug assertions, '<device>, release build' otherwise. replay's cost gate and
cost_on_under take it. A release run is so Unmeasured against the committed records (no record
of its venue), and a release --write keeps a record of its own beside the debug one. The
README's cost section says so.

Why: the records did not say which build measured them, and the two builds' counts differ: a
debug build takes the whole check at a kept draw's first and every second rebound hit
(render/draw_again.rs, render/draw_again/rebound.rs), so a release replay of
point-viewport-coverage read 3 rebinds against the debug record's 1 and failed as Over (the
11-07 M3 'regression' that was the profile). Every committed record was measured by the debug
binary (each stack's rebless runs target/debug/conformance cost --write), so the debug name
keeps them valid unchanged and no recording file moves.

Verified: a_release_build_s_cost_runs_name_their_venue_apart (both names, and a debug record
judging the debug venue Over and the release venue Unmeasured). Runs on Linux follow.

(cherry picked from commit e455eed9ac8894efb6ac9609d8fd24058874b124)
This commit is contained in:
Anees Iqbal committed 2026-11-10 05:16:04 -08:00
1 parent 702de35f8a
commit 67d9be4cd6
4 files changed
+84 -2

No files matched your search

@@ -269,6 +269,12 @@ Both shapes, as two commands, because a bound is written from both or it is not
A case's cost record lives in its own recording file, beside the Metal answers, so a host with no
Metal reads it with the rest of the case.
**A record names the venue and the build.** The committed records are measured by the debug binary
(`target/debug/conformance`), whose debug assertions take paths of their own (a kept draw rebound
again takes the whole check at its first and every second hit), so a release build's counts are not
its counts: a release build's runs name their venue `<device>, release build`, are `unmeasured`
against the debug records, and its `--write` keeps a record of its own beside them.
**Counts are ours, never Metal's.** Metal has no counterpart for any of them and a host with no
Metal can have no answer, so a count never enters the comparison with Metal and never produces a
correctness verdict. The cost half has its own four verdicts — `within`, `over`, `under`,
@@ -1738,6 +1738,29 @@ impl std::fmt::Display for CostVerdict {
}
}
/// The venue a cost run on `device` names, and so the record it is held to or writes: the device's
/// name, and the build's profile where the build is not the one the suite measures in.
///
/// A count is the build's as much as the device's. A build with debug assertions takes paths of
/// its own: a kept draw rebound again takes the whole check at its first and every second hit
/// (the runtime's `render/draw_again.rs` and `render/draw_again/rebound.rs`), so
/// `point-viewport-coverage`'s rebinds read 1 there where a release build of the same tree read 3
/// (the M3 Max, 11-07). Every committed record was measured by the suite's debug binary (the
/// bless runs `cost --write` from `target/debug`), and a release build's runs name their venue
/// apart: held to no record of the other profile, they are [`CostVerdict::Unmeasured`], and a
/// release build's `--write` keeps a record of its own beside the debug one.
pub fn venue(device: &str) -> String {
venue_of(device, cfg!(debug_assertions))
}
/// [`venue`]'s name for a build with debug assertions where `debug`, else a release build's.
pub(crate) fn venue_of(device: &str, debug: bool) -> String {
match debug {
true => device.to_owned(),
false => format!("{device}, release build"),
}
}
/// Hold `observed` to the bounds `records` holds for `venue`.
///
/// `whole_set` says whether the run was of the whole case set, which is the measurement's own
+2 -2
View File
@@ -72,7 +72,7 @@ fn one_replay_pass(
// because the two readings must be of the same run, and it is cheap: two reads of
// `WorkCounts` a case. Nothing here enters a correctness verdict.
let whole_set = cases.len() == crate::cases::all().len();
let venue_label = device.name().to_owned();
let venue_label = cost::venue(device.name());
for case in cases {
let before = read_counts(device);
// The Metal pipeline states the case creates: the denominator of the ratio bound
@@ -251,7 +251,7 @@ pub fn cost_on_under(
let device = device::open_counted(venues, policy, &notices, &cache, device::SLOT_WAIT)?;
// The device's own notices, read off so no case's scope ever holds them.
notices.venue();
venue = device.name().to_owned();
venue = cost::venue(device.name());
for (index, case) in cases.iter().enumerate() {
let before = read_counts(&device)?;
let states_before = crate::states::made();
@@ -6343,6 +6343,59 @@ fn a_count_whose_ceiling_is_the_lone_run_is_gated_there() {
assert_eq!(record.gated(), 0);
}
/// A release build's cost runs name their venue apart from the debug binary's, which measured every
/// committed record: a debug build's assertions take paths of their own (a kept draw rebound again
/// takes the whole check at its first and every second hit), so the two builds' counts differ, and
/// a release run held to a debug record read `point-viewport-coverage`'s 3 rebinds against the
/// debug build's 1. Held to no record of its own profile, the release run is unmeasured.
#[test]
fn a_release_build_s_cost_runs_name_their_venue_apart() {
let (debug, release) = (
crate::cost::venue_of("A device", true),
crate::cost::venue_of("A device", false),
);
assert_eq!(debug, "A device");
assert_ne!(debug, release);
assert_eq!(
crate::cost::venue("A device"),
crate::cost::venue_of("A device", cfg!(debug_assertions))
);
let counts =
crate::cost::Counts::read("WorkCounts {\n render_passes_made: 3,\n}").expect("it reads");
let record = crate::cost::CaseCost {
states: 0,
case: "a case".to_owned(),
counts: crate::cost::Counts::read("WorkCounts {\n render_passes_made: 1,\n}")
.expect("it reads"),
least: crate::cost::Counts::read("WorkCounts {\n render_passes_made: 1,\n}")
.expect("it reads"),
runs: 8,
stopped: None,
degraded: Vec::new(),
nanos: 1_000,
}
.record(&debug, "eight runs".to_owned());
let judged = |venue: &str| {
crate::cost::judge(
std::slice::from_ref(&record),
venue,
true,
&counts,
0,
None,
&[],
)
};
assert!(matches!(
judged(&debug),
crate::cost::CostVerdict::Over { .. }
));
assert!(matches!(
judged(&release),
crate::cost::CostVerdict::Unmeasured { .. }
));
}
/// A ceiling is the lone run's reading, taken again at each lone measurement: one the tree no
/// longer reaches comes down, with the bound it set.
///