matrix: each runtime's creation rows run in a process of their own, cold against cold

The planner's rule: a cold first sample is compared cold against cold. The creation rows ran in
five processes that each timed both runtimes, the new runtime first, so the driver's
process-wide setup fell on the new runtime's first pipeline and the old runtime's first samples
came after it, warm. Measured on the Iris Xe (job 48650, ms01 alone, both runtimes from the
harness at cb25e3a83e, five processes each): the old runtime's create_state/first was 5265.8 us
behind the new runtime in one process and 16732.8 us in a process of its own (0.315x);
device_first 0.167x, first_call 0.099x. The one-process ratio new/old 1.302 at first was a
cold-against-warm ratio; cold against cold it is 0.410.

Of the two forms the planner allowed, each runtime's own fresh process is the cheaper: the
harness does not change, and the extra five processes a leg runs take about a second each
(create_state's processes on the Iris ran in under one second). The other form, one unrelated
pipeline before either runtime in a shared process, would need harness code and leaves the
first samples process-warm, not cold. So each of the five rounds now runs `--runtime new` and
`--runtime old` in processes of their own, each on a fresh driver cache and store, the order
alternating from round to round (new first in rounds 1, 3 and 5); the first round's two outputs
are kept whole, the later rounds' first samples as before. The records, their names and the
budget's medians do not change.

Verified: the matrix's Python tests in the job named in the landing message (the harness-runs
test now pins the processes and their order).
This commit is contained in:
Anees Iqbal committed 2026-11-18 16:35:27 -08:00
1 parent ebfc68ebb7
commit 5849a7f029
4 files changed
+47 -36

No files matched your search

+13 -10
View File
@@ -386,19 +386,22 @@ runtimes: those records are judged. A short second run on the same directory and
`harness-new-warm/<set>/first_use_*`, the same first uses with both warm; they are parked.
Both runs skip the creation rows (the harness's `--skip 'create_*'`): those run alone after them,
`--only 'create_*'`, in five processes of their own, each timing both runtimes in the same order
on a fresh empty cache directory and store, so no row before them moves their times: a
creation's first sample on the new runtime is cold, and the old runtime's follows it on the same
cache. The first process's records are kept whole, its devices' gauges at drop as `harness-<runtime>/creates/device/...`; of each later process, only the
creation rows' first samples (`<row>/first`, `/first_call`, `/first_one_thread`, `/first_take`,
`/next_take`, `/first_allocation_total`, `/device_first`, one sample per process), as
`harness-first/<row>/<n>/<runtime>`,
parked for the `time` rule.
`--only 'create_*'`, in five rounds, each round one process per runtime (`--runtime new`,
`--runtime old`, the order alternating from round to round), each process on a fresh empty cache
directory and store. A cold first sample is so compared cold against cold: no row before it, and
no work of the other runtime in its process, warms the driver for it. On an Iris Xe the driver's
process-wide setup, paid by whichever runtime makes the process's first pipeline, took the old
runtime's `create_state/first` from 16.7 ms alone to 5.3 ms behind the new runtime's in one
process, which a shared process charged to the new runtime alone. The first round's records are
kept whole, their devices' gauges at drop as `harness-<runtime>/creates/device/...`; of each later
process, only the creation rows' first samples (`<row>/first`, `/first_call`,
`/first_one_thread`, `/first_take`, `/next_take`, `/first_allocation_total`, `/device_first`,
one sample per process), as `harness-first/<row>/<n>/<runtime>`, parked for the `time` rule.
The harness budget compares the two runtimes rather than two commits, apart from the `time` rule
and the parked records. The old runtime, frozen, is its noise meter: on each GPU, the old
runtime's time a row is judged on (its GPU time where it is judged on that, a creation row's
median of five processes) is compared with the same time in the leg's base, the previous round,
median of five rounds) is compared with the same time in the leg's base, the previous round,
and a row whose old time moved more than 10% either way is VOID for the round on that GPU: it is
named on the leg's line and judged on nothing, and its comparison comes only from a re-time in
one process with both runtimes interleaved. The report shows that move on every row the base has
@@ -438,7 +441,7 @@ is never taken from a measured ratio, and the greater of a row's ceiling and flo
A listed row fails its leg past its ceiling times 1.03, the noise allowance parity gets, and one
within that is named on the leg's line. A fix lowers its row's ceiling to the ratio it reaches,
and a row within 1.03 leaves the list. A creation row's first sample is judged by the ratio of
the medians of its five processes, the new runtime's over the old's; a first sample alone is
the medians of its five rounds, the new runtime's over the old's; a first sample alone is
never past its limit. A compute pipeline state row's `/first` is its creation and one dispatch
through to completion, one threadgroup of 64 by 1 by 1, the replay streams' commonest compute
dispatch size (24% of their dispatches), since Metal compiles at the creation and a runtime may
+23 -19
View File
@@ -347,14 +347,15 @@ def harness_runs(manifest_dir, command, leg, windows=False):
as in a process of its own. For HARNESS_WARM, a short second run on the same cache follows,
before the suite's line, and its first-use records are kept under harness-<runtime>-warm/: the
same first uses with the driver's cache warm. These runs skip the creation rows
(results.HARNESS_CREATES): those run alone after them, in results.FIRST_RUNS processes of
their own, each timing both runtimes in the same order on a fresh empty driver cache and
store, so no row before them moves their times: each creation's first sample on the new
runtime is cold, and the old runtime's follows it on the same cache. The first process's
output is kept whole, its devices' gauges apart (results.CREATES_APART); of each later one's,
only the first
samples (results.FIRST_KEEP), which results.harness_budget judges by the median of the
processes. Then the rows over their limits (results.RETIME_SELECT, at most
(results.HARNESS_CREATES): those run alone after them, in results.FIRST_RUNS rounds, each
round one process per runtime, the runtimes' order alternating from round to round, each
process on a fresh empty driver cache and store. So a creation's first sample is cold against
cold: no row before it, and no work of the other runtime in its process, warms the driver
for it (a driver's process-wide setup, paid by whichever runtime makes the process's first
pipeline, took one runtime's first state from 16.7 ms cold to 5.3 ms behind the other's on an
Iris Xe). The first round's two outputs are kept whole, their devices' gauges apart
(results.CREATES_APART); of each later process's, only the first samples
(results.FIRST_KEEP), which results.harness_budget judges by the median of the rounds. Then the rows over their limits (results.RETIME_SELECT, at most
results.RETIME_ROWS, the furthest over first) are each re-timed alone in results.RETIME_PAIRS
pairs, old then new, then new then old, their times and GPU times kept (results.RETIME_KEEP)
for results.harness_budget; a frames workload's latency from idle row (results.FROM_IDLE)
@@ -392,17 +393,20 @@ def harness_runs(manifest_dir, command, leg, windows=False):
sed -n "{rename}"
done
for n in $(seq {results.FIRST_RUNS}); do
rm -rf "$cache" "$store"
cache=$(mktemp -d) && store=$(mktemp -d) || exit 3
export MESA_SHADER_CACHE_DIR="$cache" __GL_SHADER_DISK_CACHE_PATH="$cache"
{point} if [ $n -eq 1 ]; then
CARGO_MANIFEST_DIR={manifest_dir} {command} --runtime {runtimes} --only {creates} --store {store} 2>&1 |
sed "{results.CREATES_APART}" | tee -a "$out/timed"
else
CARGO_MANIFEST_DIR={manifest_dir} {command} --runtime {runtimes} --only {creates} --store {store} 2>&1 |
sed -n "{results.FIRST_KEEP}"
fi
[ ${{PIPESTATUS[0]}} -eq 0 ] || r=1
case $((n % 2)) in 1) order="{" ".join(HARNESS_RUNTIMES)}" ;; *) order="{" ".join(reversed(HARNESS_RUNTIMES))}" ;; esac
for runtime in $order; do
rm -rf "$cache" "$store"
cache=$(mktemp -d) && store=$(mktemp -d) || exit 3
export MESA_SHADER_CACHE_DIR="$cache" __GL_SHADER_DISK_CACHE_PATH="$cache"
{point} if [ $n -eq 1 ]; then
CARGO_MANIFEST_DIR={manifest_dir} {command} --runtime $runtime --only {creates} --store {store} 2>&1 |
sed "{results.CREATES_APART}" | tee -a "$out/timed"
else
CARGO_MANIFEST_DIR={manifest_dir} {command} --runtime $runtime --only {creates} --store {store} 2>&1 |
sed -n "{results.FIRST_KEEP}"
fi
[ ${{PIPESTATUS[0]}} -eq 0 ] || r=1
done
done
case "{leg}" in
{limits}
+5 -4
View File
@@ -590,13 +590,14 @@ def past_limit(leg_id, row, gpu=False):
#: The harness's creation rows, by the start of their names. A leg times them apart from the
#: other rows (the matrix's harness_runs): the process that times the others on both runtimes
#: skips them, and they run alone after it, in FIRST_RUNS processes of their own, each timing both
#: runtimes on a fresh driver cache and store, so no row before them moves their times.
#: skips them, and they run alone after it, in FIRST_RUNS rounds, each round one process per
#: runtime on a fresh driver cache and store, so no row before them and no work of the other
#: runtime moves their times: a cold first sample is compared cold against cold.
HARNESS_CREATES = "create_"
#: A creation row's first samples (`<row>/first`, `/first_take`, `/next_take`,
#: `/first_allocation_total`, `/device_first`) are one sample per process, so harness_budget judges
#: each by the median of FIRST_RUNS processes per runtime: the first process's own record and the
#: later processes' `harness-first/<row>/<n>/<runtime>`. A first sample alone is never past its
#: each by the median of FIRST_RUNS rounds' processes per runtime: the first round's own records
#: and the later rounds' `harness-first/<row>/<n>/<runtime>`. A first sample alone is never past its
#: limit.
FIRST_RUNS = 5
HARNESS_FIRST = "harness-first/"
+6 -3
View File
@@ -160,7 +160,7 @@ done
class HarnessRunTests(unittest.TestCase):
def test_both_runtimes_are_timed_in_one_process_and_so_are_the_creation_rows_in_each_of_theirs(self):
def test_both_runtimes_are_timed_in_one_process_and_each_runtime_s_creation_rows_in_its_own(self):
with tempfile.TemporaryDirectory() as work:
fake, log = Path(work) / "harness", Path(work) / "log"
fake.write_text(FAKE_HARNESS)
@@ -171,8 +171,11 @@ class HarnessRunTests(unittest.TestCase):
self.assertEqual(run.returncode, 0, run.stderr)
calls = log.read_text().splitlines()
# One process times both runtimes, the new runtime's pass first in each workload; the warm
# run is the new runtime's; each of the five creation processes times both too.
self.assertEqual(calls, ["new,old all", "new all"] + ["new,old create_*"] * 5)
# run is the new runtime's; each of the five creation rounds times each runtime in a
# process of its own, cold against cold, the order alternating.
self.assertEqual(calls, ["new,old all", "new all"] + ["new create_*", "old create_*",
"old create_*", "new create_*"] * 2
+ ["new create_*", "old create_*"])
legs = matrix.results.parse_job("M2V-LEG a begin\n" + run.stdout)
suites = legs["a"]["suites"]
self.assertEqual(list(suites), [matrix.HARNESS_SUITE])