#!/bin/bash # A/B helper: bench.py (device trace ms, served stages, 4-sample PCC) + acc.py (32 real-ckpt crops) # under the current environment (TT_FUSED_* knobs). usage: [VAR=val ...] scripts/ab.sh [tag] ROOT=/home/ttuser/experiments/tt-models M=${M:-$(cd "$(dirname "$0")/../.." && pwd)} VENV=${VENV:-$ROOT/models/hamer-p150/.venv} source $ROOT/tools/chipenv.sh ${CHIP:?set CHIP=} $VENV >/dev/null || exit 1 cd $M/code echo "== $1" timeout -k 10 -s INT 900 python scripts/bench.py --dispatch ${DISPATCH:-eth} --grid 12x10 --iters 100 > /tmp/ab_bench_$$.log 2>&1 rc=$? grep -E "device_trace_ms=.*served|stages|autotune" /tmp/ab_bench_$$.log # a timeout / hang must NOT be followed by another device run on the same chip (HANG PROTOCOL) [ $rc -eq 0 ] || { echo "bench.py rc=$rc: stop, do not reopen the chip (write chipstate/chip$CHIP/FAULT)"; exit 1; } [ -n "$NO_ACC" ] || timeout -k 10 -s INT 900 python scripts/acc.py 2>&1 | grep "^ACC"