harness: a workload's steady time is the lowest mean of its windows of 10 runs

A workload's time was the lowest nearest-rank median of its timed runs' windows of 10. Where a
runtime reports two runs' completions together, one run's wait takes both runs' GPU time and the
next run's wait returns at once, and the nearest-rank median of 10 such alternating runs is the
5th sorted value: the short wait's. On ms01's Iris Xe the old runtime's grouped submissions did
this in whole-harness runs: zero_products recorded 174 us while every run's GPU time was 4367 us
and its 200 timed walls had p10 174, p50 4388, p90 9454 (job m3-max-45343, probe f5be885e3f);
narrow_ints, constant_private and image_filter likewise, on the old runtime only. A window's mean
is the time its 10 runs took over 10, which the pairing does not move; the lowest window still
leaves out a window a clock drop or a hiccup slowed. Fewer than 10 runs take their mean.

Every matrix time record goes through steady (matrix_time, the creation rows), and the matrix's
re-timed pairs are the same records, so one statistic serves both.

Verified: the new unit test's alternating 9454/174 runs give 4814 where a window's nearest-rank
median is 174; the existing cases keep their values. Build, clippy and the harness's tests in the
check job named in the report.
This commit is contained in:
Anees Iqbal committed 2026-11-18 02:24:57 -08:00
1 parent 0a894e85fe
commit 000dfa9a07
3 files changed
+21 -9

No files matched your search

+1 -1
View File
@@ -84,7 +84,7 @@
//! ```
//!
//! where a plan workload's time is what a program waits on, timed on the host
//! ([`run::matrix_time`]): the steady time ([`run::steady`]: the lowest median of the timed runs'
//! ([`run::matrix_time`]): the steady time ([`run::steady`]: the lowest mean of the timed runs'
//! consecutive windows of 10, with at least 5 timed runs) of each run's last command buffer's
//! commit-to-complete time where the workload times its command buffers'
//! ([`plan::Plan::commit_to_complete`]), the lateness of the others a column that decides nothing, else
+10 -6
View File
@@ -51,21 +51,25 @@ const SETTLE_LEAST: Duration = Duration::from_millis(500);
/// The longest settling warm-up; the timed runs start then, settled or not.
const SETTLE_MOST: Duration = Duration::from_secs(5);
/// The fewest timed runs whose median is a workload's time.
/// The fewest timed runs that give a workload a time ([`steady`]).
pub const LEAST_TIMED: usize = 5;
/// A workload's time from its timed runs' `times`: the lowest median of their consecutive
/// windows of 10 runs, so that a clock that drops partway through the runs does not move it; with
/// fewer than 10 runs, their median; `None` with fewer than [`LEAST_TIMED`].
/// A workload's time from its timed runs' `times`: the lowest mean of their consecutive windows
/// of 10 runs, the time 10 runs took over 10, so that a clock that drops partway through the runs
/// does not move it; with fewer than 10 runs, their mean; `None` with fewer than [`LEAST_TIMED`].
/// A mean, not a median: where a runtime reports two runs' completions together, one run's wait
/// takes both runs' time and the next run's none, and a median of such alternating runs is the
/// short one's, while their mean is the time each run took.
pub fn steady(times: &[f64]) -> Option<f64> {
if times.len() < LEAST_TIMED {
return None;
}
let mean = |window: &[f64]| window.iter().sum::<f64>() / window.len() as f64;
if times.len() < WINDOW {
return percentile(times, 50);
return Some(mean(times));
}
(times.as_chunks::<WINDOW>().0.iter())
.filter_map(|window| percentile(window, 50))
.map(|window| mean(window))
.min_by(f64::total_cmp)
}
+10 -2
View File
@@ -879,12 +879,12 @@ fn without_settling_a_warm_up_runs_its_least_count() {
}
#[test]
fn a_steady_time_is_the_lowest_median_of_windows_of_ten() {
fn a_steady_time_is_the_lowest_mean_of_windows_of_ten() {
assert_eq!(steady(&[1.0; 4]), None, "fewer than 5 runs");
assert_eq!(
steady(&[3.0, 1.0, 2.0, 5.0, 4.0]),
Some(3.0),
"their median below 10"
"their mean below 10"
);
// A clock that drops partway through: the faster windows' level, not the mix.
let mut times = vec![100.0; 20];
@@ -892,6 +892,14 @@ fn a_steady_time_is_the_lowest_median_of_windows_of_ten() {
times[3] = 400.0;
assert_eq!(steady(&times), Some(100.0));
assert_eq!(percentile(&times, 50), Some(105.0));
// Two runs' completions reported together: each pair's first wait takes both runs' GPU time
// and its second none (the old runtime's grouped submissions on ms01's Iris Xe, 4367 us of GPU
// a run). The time a run took, not the short wait's: a median of each window of 10 is 174.
let paired: Vec<f64> = (0..200)
.map(|run| if run % 2 == 0 { 9454.0 } else { 174.0 })
.collect();
assert_eq!(steady(&paired), Some(4814.0));
assert_eq!(percentile(&paired[..10], 50), Some(174.0));
}
#[test]