Commit Graph

7 Commits

Author SHA1 Message Date
45df09b843 chore: remove 13 dead one-off scripts, fix /home/nolan test paths, drop unused imports (CHORE-TIER2A-PYTHON-CLEANUP) 2026-11-30 04:00:53 -05:00
fa3847b075 tools/scripts: the four leftover __main__ blocks set errors=replace on stdout (TOOL-STDOUT-GUARD-LEFTOVER-FOUR) 2026-11-28 20:11:42 +00:00
f03dfe23ae bench_translate: refuse flag combinations that were silently ignored, and require a baseline that exists
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.
2026-11-25 11:33:51 +00:00
3bcb6212a2 bench_translate: --compare honours --max-slowdown, and a partial baseline no longer aborts
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.
2026-11-25 11:33:51 +00:00
4c70aeaf76 bench_translate: honour --max-slowdown in --json too, and let a run save its own baseline
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).
2026-11-25 11:33:51 +00:00
03a92eecd0 scripts: --compare A B, interleaved timing of two tools/ trees
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.
2026-11-25 11:33:51 +00:00
5ffdc50fed scripts: a throughput benchmark for the translator (us per instruction)
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.
2026-11-25 11:33:51 +00:00