From 4cc796300508ce9002acef7066bd1d0956428b96 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 18 Nov 2026 02:23:30 -0800 Subject: [PATCH] harness: an untimed run after each gauge read, so the next timed run waits for a run in flight The timed loop reads the gauges after its 100th and 200th runs with the device idle. The 101st run's wait was then for the 100th, already complete, so it timed the encoding alone: on ms01's Iris Xe 61 us of waves' 2191 us of GPU a run, 196 us of zero_products' 4367 (job m3-max-45380, probe cb18fded59, every timed wall in order). A median of 10 runs ignored that one short run; the lowest mean of windows of 10 takes it: the window holding it read 6% under every other unpaired window (waves 2090, zero_products 4115 against GPU times of 2191 and 4367), on every runtime. An untimed run after the read puts two runs in flight again, and the next timed run waits for one the GPU was running. Without the 101st run, the same walls' lowest window mean is 2188 and 4377. Verified: the arithmetic above on job m3-max-45380's sequences; build, clippy and the harness's tests in the check job named in the report. --- crates/metal2vulkan-harness/src/run.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-harness/src/run.rs b/crates/metal2vulkan-harness/src/run.rs index 613ab251f..7bcb0bfe7 100644 --- a/crates/metal2vulkan-harness/src/run.rs +++ b/crates/metal2vulkan-harness/src/run.rs @@ -149,7 +149,8 @@ pub struct Report { /// Each timed run's host wall time, from the start of its encoding until the wait for the run /// before it returned, in microseconds: with two runs in flight, the time each run adds. The /// 100th and 200th runs' times leave out the wait for the device to go idle that reads the - /// gauges. + /// gauges, and an untimed run follows that wait, so the next timed run waits for a run in + /// flight, as every other does. pub wall_us: Vec, /// The runtime's counts of its work ([`Device::counts`]) over one run after the timed ones, /// committed alone and waited for, so nothing else is in flight. @@ -916,6 +917,12 @@ impl Session for Harness { // work in flight at that moment, which moves with completion timing. wait_run::(&in_flight)?; report.gauges.push((run, self.device.gauges())); + // An untimed run, so two are in flight again: the next timed run's wait is then + // for a run the GPU was running, not for this idle device's last one, whose wait + // returns at once and would time the encoding alone. + if run < runs.timed { + self.next(plan, &made, &mut in_flight, None)?; + } } } wait_run::(&in_flight)?;