merzleckeier measured what a bigger limit buys and it is not enough: at a 1024x
slowdown the 1000x draft still failed 0/3, while comparing the run's baseline
back against the file it was given passed 3/3. A limit measures the runner;
the numbers do not.
So the case now reads the measured values out of the baseline it just wrote and
asserts the second run used exactly those, with no --max-slowdown on that
invocation. The over-limit behaviour keeps its own deterministic test
(--max-slowdown 0.01 must report one), untouched.
Verified here: 10 passed, 5 subtests; and substituting a different baseline
makes the case fail (1 failed), which is what the assertion is for.
Written with an AI assistant.
test_a_local_baseline_replaces_the_committed_one asks that a locally written
baseline replaces the committed one; the 5x limit was incidental to that, and on
a shared runner it turned the case into a performance test whose only observed
failure was a contended box (macos-python on #2641: returncode 1 with empty
stderr, i.e. the tool's own over-limit verdict).
The over-limit behaviour keeps its deterministic coverage: --max-slowdown 0.01
must report one, and that case asserts it.
Written with an AI assistant.
Reported by @SamuelReeder on #7056. --compare ignored --json, --write-baseline and --baseline; a --baseline path that
does not exist was accepted and produced empty numbers; and naming one file for both baseline flags let a run that
failed the limit replace the reference it failed against, so the same workload passed on the retry. All three are now
parser errors, with the reason in the message.
--compare also refuses to compare two trees whose measurements do not cover the same programs (a skipped program read
as a ratio that looks like a win) and reports an empty corpus instead of dividing by nothing.
Tests: the three refusals, an aliased baseline, a missing baseline file.
Both reported by @YordiLorenzo on #7056. --compare returned 0 whatever the limit said, although the help promises it in
every output format: the ratios are candidate/reference, so the limit now applies to them directly and a measurement
over it exits 1 with the factor printed. A baseline holding only some of the measurements raised KeyError in the text
output: the per-program line reads the baseline with .get() and says so when a measurement has none.
Two regression tests: --compare with --max-slowdown 0.01 over identical trees exits 1, and a corpus-only baseline
still prints every row. 7 tests, OK.
Reported on #7056: --json returned before the limit was evaluated, so a job that collects JSON read a success code for
a run whose numbers were all over the limit. The limit is now evaluated once, before either format prints, and the
JSON carries over_limit; both formats return 1.
The committed BASELINE is one machine's numbers, so --max-slowdown against it fails on any other machine with no
regression in it. --write-baseline FILE records this run, --baseline FILE compares against it (JSON reports
baseline_source), and the text output names which baseline it used.
Tests: the limit is checked in both formats (exit 1, over_limit non-empty), and a written baseline round-trips
(exit 0 at 5x, baseline keys equal to measured keys).
A single-tree measurement cannot separate a real speedup from the machine drifting between runs: the same code
measured minutes apart moved by 40% here. --compare loads each tree in its own subprocess (LEONIDA_TOOLS_DIR, as
tests/semantic/support.py does), alternates the order every round so whoever runs first does not pay the cold file
cache, discards a warm-up round, and keeps the best per side.
Control: --compare tools tools --rounds 3 --runs 2 gives 1.01x / 1.00x / 0.99x on the three measurements.
The repository tests what rdna2spirv.py emits and nothing about how long it takes, so a change to the parser or
the instruction table can cost a large share of a build (26,503 shaders) and still pass every test.
The script times translate() on the hand-written semantic fixtures and on two generated straight-line programs
(ALU work, s_nop dispatch), reports best-of-N us per instruction against a recorded baseline, prints JSON for
tooling, and can fail a --max-slowdown check. No game data, no LLVM, no SPIRV-Tools.