From 67d9be4cd63ebba2c8fedc2fc457eb043dba47ee Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 10 Nov 2026 04:04:05 -0800 Subject: [PATCH] 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, ', 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) --- crates/metal2vulkan-conformance/README.md | 6 +++ crates/metal2vulkan-conformance/src/cost.rs | 23 +++++++++ crates/metal2vulkan-conformance/src/run.rs | 4 +- crates/metal2vulkan-conformance/src/tests.rs | 53 ++++++++++++++++++++ 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan-conformance/README.md b/crates/metal2vulkan-conformance/README.md index 6dc65866f..869e2be1f 100644 --- a/crates/metal2vulkan-conformance/README.md +++ b/crates/metal2vulkan-conformance/README.md @@ -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 `, 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`, diff --git a/crates/metal2vulkan-conformance/src/cost.rs b/crates/metal2vulkan-conformance/src/cost.rs index d99dbe54b..b5bf90279 100644 --- a/crates/metal2vulkan-conformance/src/cost.rs +++ b/crates/metal2vulkan-conformance/src/cost.rs @@ -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 diff --git a/crates/metal2vulkan-conformance/src/run.rs b/crates/metal2vulkan-conformance/src/run.rs index 0426ad59a..faa37ad90 100644 --- a/crates/metal2vulkan-conformance/src/run.rs +++ b/crates/metal2vulkan-conformance/src/run.rs @@ -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, ¬ices, &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(); diff --git a/crates/metal2vulkan-conformance/src/tests.rs b/crates/metal2vulkan-conformance/src/tests.rs index c500edab5..92768c1f3 100644 --- a/crates/metal2vulkan-conformance/src/tests.rs +++ b/crates/metal2vulkan-conformance/src/tests.rs @@ -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. ///