← board

testmgr: opt-level differential tier + tracked benchmark runs

Why

The optimization campaign now ships passes at three tiers (-O0 reference, -O2 default, -O3 experimental), and promotions move passes between them (v194 -O2 flip, v196 W1-trio promotion). Two guarantees currently rest on one-off manual runs by the dev agent:

  1. Semantic equivalence across O levels. make test-opt covers ~21 hand-picked programs; the promotion gate for v196 was a manual 564-program corpus sweep (-O0 vs -O2 compile+run+output-compare) in a scratch script. That sweep should be a standing, per-SHA, offloaded tier — it is exactly the cheap oracle that catches optimizer miscompiles, and exactly what T exists to offload. The pending -O3→-O2 promotion of the register-lifetime passes (r8-r13 scratch, loop/float residency) is blocked on soak evidence this tier would produce.
  2. Performance tracking. Wins land with hyperfine numbers measured once, on the dev box, and are never re-checked — a silent perf REGRESSION (or a pass whose win evaporates after an unrelated change) goes unnoticed. Benchmarks also double as miscompile canaries (output checked before timing).

What (two additions to tools/testmgr.py)

1. --tier opt — O-level differential sweep

# v196 promotion harness (port me):
for t in test/*.pas; do
  CC "$t" d0 || skip; CC -O2 "$t" d2 || COMPILE-DIFF
  o0=$(timeout 10 ./d0 </dev/null 2>&1); r0=$?; [ $r0 -ge 124 ] && skip
  o2=$(timeout 10 ./d2 </dev/null 2>&1); r2=$?
  [ "$o0" != "$o2" ] || [ $r0 -ne $r2 ] && DIFF
done

2. --bench face — tracked benchmark timings per SHA

Gates / notes

Log