open-standards/wai/research/determinism-cost/runs/linux-a-narrow-decodes.sh
Transaction Science 61759c51b5 wai: the int_hyper decode on the narrow kernel sets, measured; determinism-tiers §7 quotes it
research/determinism-cost.md §4.6, in the same record and by the same
procedure: the 192 payloads decoded again on every platform with every
kernel set it runs (15 new runs, 0 decodes differing from the record's),
and the record's time and energy runs repeated in one session per host
beside the record's own build and the float decoder. On x86_64 host A the
integer decode on the narrow kernels took 144.8 ms and 12.43 J of marginal
package energy at quality 6 against 210.7 ms and 14.03 J for the float
decode beside it (the record's build: 728.0 ms, 92.14 J). On the build
host its own CPU energy fell from 11.01 J to 6.43 J at quality 6 and is
still above the float decode's 1.28 J by that count. Host B's integer
decode was measured before and after, without a float decode beside it.
The scripts that took the readings are in runs/; decode-throughput.md
notes the new sets; the changelog records the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 04:06:15 -04:00

23 lines
2.4 KiB
Shell

# The 192 integer decodes on x86_64 host A with each kernel set, its integrated GPU, and the build host's wasm.
set -euo pipefail
R=$HOME/wai-build/idf; W=$R/work; export CARGO_TARGET_DIR=$R/target # the toolchain: rustup 1.98.0 on PATH
TAG=${1:?tag}; shift
X=$R/xplat; mkdir -p $X
OS="Linux $(uname -r), $(ldd --version 2>&1 | sed -n '1s/.* //p') glibc"; HW="x86_64 SoC, 16 cores, 32 threads, AVX-512"
meta() { printf '{"system": "%s", "hardware": "%s", "target": "%s", "fabric": "%s", "kernels": "%s", "threads": "%s", "rustc": "%s", "runtime": "%s", "measured": "%s"}\n' "$OS" "$HW" "$1" "$2" "$3" "$4" "1.98.0" "$5" "$(date +%F)"; }
for step in "$@"; do case $step in
avx512-vnni|avx512|avx2-vnni|avx2|wide)
WAI_INT_ISA=$step nice -n 10 $R/bin/native.$TAG decode $W/jobs.all.tsv > $X/linux-x86_64-cpu-isa-$step.tsv
meta x86_64-unknown-linux-gnu CPU "fast, kernel set $step" "all (32)" native > $X/linux-x86_64-cpu-isa-$step.json ;;
gpu)
WAI_INT_ISA=avx512-vnni WAI_DET_GPU_KEY=gpu-vulkan-1002 nice -n 10 $R/bin/gpu.$TAG --gpu decode $W/jobs.all.tsv > $X/linux-x86_64-gpu-vulkan-isa-avx512-vnni.raw 2> $X/linux-x86_64-gpu-vulkan-isa-avx512-vnni.err
cut -f1-4 $X/linux-x86_64-gpu-vulkan-isa-avx512-vnni.raw > $X/linux-x86_64-gpu-vulkan-isa-avx512-vnni.tsv
meta x86_64-unknown-linux-gnu "GPU, Vulkan, integrated, PCI vendor 0x1002" "fast, kernel set avx512-vnni" "all (32) for graphs off the device" "wgpu 30.0.1, $(grep -o 'adapter: .*' $X/linux-x86_64-gpu-vulkan-isa-avx512-vnni.err | head -1 | sed 's/"/'"'"'/g')" > $X/linux-x86_64-gpu-vulkan-isa-avx512-vnni.json ;;
wasm)
WT=$R/wasmtime/wasmtime-v49.0.3-x86_64-linux/wasmtime; Sd=$R/wasm-shards
rm -rf $Sd; mkdir -p $Sd
awk "{print > (\"$Sd/jobs.\" (NR-1)%16)}" $W/jobs.all.tsv
for f in $Sd/jobs.*; do nice -n 10 $WT run --dir $W::$W --dir $Sd::$Sd $R/bin/wasm.$TAG decode $f > $f.out & done; wait
cat $Sd/jobs.*.out > $X/wasm32-wasip2-x86_64-isa-wide.tsv
printf '{"system": "Linux %s", "hardware": "x86_64 SoC, 16 cores, 32 threads, AVX-512", "target": "wasm32-wasip2", "fabric": "CPU, WebAssembly", "kernels": "fast, kernel set wide (the only set on wasm)", "threads": "1 (sixteen decoder processes side by side)", "rustc": "1.98.0", "runtime": "%s, the build host'"'"'s .wasm", "measured": "%s"}\n' "$(uname -r)" "$($WT --version | cut -d' ' -f1-2)" "$(date +%F)" > $X/wasm32-wasip2-x86_64-isa-wide.json ;;
esac; wc -l $X/*.tsv | tail -1; done