diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index fdea396ac..015dba3aa 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -386,19 +386,22 @@ runtimes: those records are judged. A short second run on the same directory and `harness-new-warm//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-/creates/device/...`; of each later process, only the -creation rows' first samples (`/first`, `/first_call`, `/first_one_thread`, `/first_take`, -`/next_take`, `/first_allocation_total`, `/device_first`, one sample per process), as -`harness-first///`, -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-/creates/device/...`; of each later +process, only the creation rows' first samples (`/first`, `/first_call`, +`/first_one_thread`, `/first_take`, `/next_take`, `/first_allocation_total`, `/device_first`, +one sample per process), as `harness-first///`, 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 diff --git a/scripts/matrix/matrix b/scripts/matrix/matrix index c92829914..00a1c19b1 100755 --- a/scripts/matrix/matrix +++ b/scripts/matrix/matrix @@ -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--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} diff --git a/scripts/matrix/results.py b/scripts/matrix/results.py index 0ffd72260..58b653ea3 100644 --- a/scripts/matrix/results.py +++ b/scripts/matrix/results.py @@ -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 (`/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///`. 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///`. A first sample alone is never past its #: limit. FIRST_RUNS = 5 HARNESS_FIRST = "harness-first/" diff --git a/scripts/matrix/test_matrix.py b/scripts/matrix/test_matrix.py index f4c1fa06d..bfbda6670 100644 --- a/scripts/matrix/test_matrix.py +++ b/scripts/matrix/test_matrix.py @@ -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])