open-standards/wai/research/determinism-cost/runs/macos-decodes.sh
Transaction Science 89cc4bfdfe wai: the determinism-cost runs, and the record's summary of divergent float decodes
The per-host scripts that took the readings (build host, two x86_64
hosts) go beside the record, with how each platform is tagged. The
summary gains the integer decodes' total across platforms and the PSNR
change of float decodes whose entropy decode diverged, in both the tool
and its independent verifier; per-decode energy is stated in joules.
wai_det_energy reads each accelerator client's GPU time per registry
node. The conformance workflow's independent-verifiers job checks the
record, the texts quoting it, and the decoder bin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 13:32:56 -04:00

32 lines
2.4 KiB
Shell

# The decodes on the build host's platforms. Integer: CPU (all threads, one thread), GPU (Metal),
# wasm32-wasip2. Float: CPU (one thread, the library's default), GPU (Metal), each in a fresh process.
set -euo pipefail
W=$RB_ROOT/det1/work; B=$RB_ROOT/det1/bin; PY=$RB_ROOT/venvs/sota-int/bin/python; X=$W/xplat; mkdir -p $X
$PY -I wai/tools/wai_determinism_cost.py jobs $W - > $W/jobs.dash.tsv
OS="macOS $(sw_vers -productVersion)"; HW="arm64 desktop SoC, 24 performance and 8 efficiency cores"
meta() { printf '{"system": "%s", "hardware": "%s", "target": "%s", "fabric": "%s", "kernels": "%s", "threads": "%s", "rustc": "%s", "runtime": "%s"}\n' "$OS" "$HW" "$1" "$2" "$3" "$4" "$(rustc --version | cut -d" " -f2)" "$5"; }
case "${1:-all}" in
cpu)
$B/wai_det_cost.native decode $W/jobs.dash.tsv > $X/macos-arm64-cpu.tsv
meta aarch64-apple-darwin CPU fast "all (32)" native > $X/macos-arm64-cpu.json
WAI_INT_THREADS=1 $B/wai_det_cost.native decode $W/jobs.dash.tsv > $X/macos-arm64-cpu-1t.tsv
meta aarch64-apple-darwin CPU fast 1 native > $X/macos-arm64-cpu-1t.json ;;
gpu)
$B/wai_det_cost.gpu --gpu decode $W/jobs.dash.tsv > $X/macos-arm64-gpu-metal.raw 2> $X/macos-arm64-gpu-metal.err
cut -f1-4 $X/macos-arm64-gpu-metal.raw > $X/macos-arm64-gpu-metal.tsv
meta aarch64-apple-darwin "GPU, Metal, integrated (80 cores)" fast "all (32) for graphs off the device" "wgpu 30.0.1, $(grep -o 'key=[^ ]*' $X/macos-arm64-gpu-metal.err | head -1)" > $X/macos-arm64-gpu-metal.json ;;
wasm)
# Eight decoder processes side by side, each over every eighth job, each single-threaded.
S=$RB_ROOT/det1/wasm-shards; rm -rf $S; mkdir -p $S
awk "{print > (\"$S/jobs.\" (NR-1)%8)}" $W/jobs.dash.tsv
for f in $S/jobs.?; do wasmtime run --dir $W::$W --dir $S::$S $B/wai_det_cost.wasm decode $f > $f.out & done; wait
cat $S/jobs.?.out > $X/wasm32-wasip2.tsv
meta wasm32-wasip2 "CPU, WebAssembly" fast "1 (eight decoder processes side by side)" "$(wasmtime --version | cut -d' ' -f1-2)" > $X/wasm32-wasip2.json ;;
float)
mkdir -p $W/fdecode
$PY -I wai/tools/wai_determinism_cost.py fdecode $W macos-arm64-cpu-1t --device cpu --threads 1
$PY -I wai/tools/wai_determinism_cost.py fdecode $W macos-arm64-cpu --device cpu
$PY -I wai/tools/wai_determinism_cost.py fdecode $W macos-arm64-gpu-mps --device mps
for t in macos-arm64-cpu-1t macos-arm64-cpu macos-arm64-gpu-mps; do printf '{"system": "%s", "hardware": "%s"}\n' "$OS" "$HW" > $W/fdecode/$t.meta; done ;;
esac
ls $X $W/fdecode 2>/dev/null