diff --git a/scripts/e2e/decode/parity-audit-ab.sh b/scripts/e2e/decode/parity-audit-ab.sh new file mode 100755 index 00000000..9b225b76 --- /dev/null +++ b/scripts/e2e/decode/parity-audit-ab.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# STRA-245 parity audit (docs/experiments/parity-audit-5090.md): paired settings A/B on the 5-turn 245k Codex-shaped session of the 5090 decode gap. +# One arm = one engine start (load ~9 min) + the session (~2 min). It is a HOLDER JOB: run it through the holder queue (it needs the sealed KAR memfd +# fd and MODEL.lock exactly like run-e2e.sh), after the DEV decode-tail dt-profile-ab arms. It takes /data/leleka-e2e/gpu.lock per arm, never two arms at once. +# +# ARMS="pa-base pa-pcie35 pa-base pa-pcie35 pa-base pa-pcie35" bash parity-audit-ab.sh # interleaved pairs, 3 repeats (the order IS the repeat order) +# +# Every arm starts from the SAME base as s1-decode/o-def (pinned bin-e2e4, shipped-shape env) EXCEPT that the expert profile is the ranked upstream one +# (the run-e2e.sh default is a placeholder, see the DEV decode-tail note of 2026-10-29T00:07Z). Only the listed variable changes per arm. +# pa-base reference: upstream profile, trace env as o-def (BRINGUP_TRACE, PREFIX_TRACE) +# pa-pcie35 LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.35 vanilla 0.2.6 PcieAuto settles at 0.35 on this machine (v-def-t, v-nsk-prof engine logs); ours is a fixed 0.45 +# pa-pcie40 LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.40 +# pa-notrace no LELEKA_BRINGUP_TRACE / LELEKA_PREFIX_TRACE (run-e2e.sh still exports LELEKA_SERVE_PROFILE=1; span timing only) +# pa-dres100 LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=100 (ours leaves 563 MiB free at decode, vanilla 315-389; about +100 expert slots) +# pa-gather STRATA_IQ_GATHER=1 (AVX-512 grid gathers in the CPU IQ kernels; upstream default is ON only on Intel server cores; same words, same results) +# pa-lto E2E_BIN=$LTO_BIN (a build with `cargo build --profile release-lto`, directory with the four binaries; required for this arm) +# Lossless class: pa-notrace, pa-lto, pa-gather are bitwise/no placement change; pa-pcie*, pa-dres100 move which device computes an expert or how many +# are resident (placement class, "unknown-until-q_pair" in docs/experiments/2026-10-28-s6-1-lossy-audit.md): a quality result (q_tail_gate) is required +# before either becomes a default. +# Metric: per-turn decode_tok_s of the client (long-session.json), same prompts per turn index; compare means of the repeats per turn, never a single run. +set -uo pipefail +LOCK=/data/leleka-e2e/gpu.lock +ARMS=${ARMS:?set ARMS, e.g. "pa-base pa-pcie35 pa-base pa-pcie35 pa-base pa-pcie35"} +UP=/data/leleka-e2e/decode/assets/expert-profile-upstream.bin # sha256 8f59b4aa..., the file crates/deploy pins as EXPERT_PROFILE_SHA256 +OUTROOT=/data/leleka-e2e/runs/parity-audit +[ -r "$UP" ] || { echo "missing $UP" >&2; exit 3; } +n=0 +for arm in $ARMS; do + n=$((n + 1)); tag="$arm-r$n" + got=0 + for _ in $(seq 1 1080); do + if mkdir "$LOCK" 2>/dev/null; then echo "parity-audit $tag $(date -u +%FT%TZ)" >"$LOCK/owner"; got=1; break; fi + sleep 5 + done + [ $got = 1 ] || { echo "GPU lock held by: $(cat $LOCK/owner 2>/dev/null)"; exit 3; } + echo "=== $tag $(date -u +%FT%TZ)"; free -g | sed -n 2p + ( export E2E_BIN=$HOME/work/leleka-rest/bin-e2e4 + export E2E_OUT=$OUTROOT/$tag + mkdir -p "$E2E_OUT" + export LELEKA_BRINGUP_TRACE=1 LELEKA_PREFIX_TRACE=1 + export LELEKA_ORIGINAL_SERVE_EXPERT_SLOTS=auto E2E_GPU_BUDGET=32212254720 + export E2E_ENGINE_ARGS="--prefix-cache-mib auto --prefix-cache-tail reply --original-prefill-capacity 8192 --prefix-cache-block 8192 --spec-min-p 0" + export E2E_SAMPLE_S=10 LELEKA_CHAIN=all + export LELEKA_ORIGINAL_SERVE_EXPERT_PROFILE=$UP + case $arm in + pa-base) ;; + pa-pcie35) export LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.35 ;; + pa-pcie40) export LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.40 ;; + pa-notrace) unset LELEKA_BRINGUP_TRACE LELEKA_PREFIX_TRACE ;; + pa-dres100) export LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=100 ;; + pa-gather) export STRATA_IQ_GATHER=1 ;; + pa-lto) : "${LTO_BIN:?pa-lto needs LTO_BIN=}"; export E2E_BIN=$LTO_BIN ;; + *) echo "unknown arm $arm" >&2; exit 2 ;; + esac + { echo "arm=$arm tag=$tag"; date -u +%FT%TZ; sha256sum "$UP" "$E2E_BIN/leleka-inference"; env | grep -E '^(LELEKA_|STRATA_|E2E_)' | sort; } >"$E2E_OUT/env-arm.txt" + export E2E_RUN_CMD="python3 -I $HOME/work/codex-e2e/long-session.py --src $HOME/work/leleka-head/src/crates --turns 5 --target-tokens 245000 --max-output 300" + bash "$HOME/work/leleka-e2e/scripts/e2e/run-e2e.sh" 2>&1 | grep -a -E "^\{|expert cache|PREFILL-PROFILE|request outcome|ready after|rc=|refus|error|Error" | cut -c1-400 + echo "run-e2e done $tag $(date -u +%FT%TZ)" ) + rm -f "$LOCK/owner"; rmdir "$LOCK" 2>/dev/null + sleep 15 +done +# summary: decode tok/s per turn per run +python3 -I - "$OUTROOT" <<'PY' +import json, sys, glob, os +root = sys.argv[1] +for d in sorted(glob.glob(os.path.join(root, "*"))): + f = os.path.join(d, "long-session.json") + if not os.path.exists(f): + continue + t = json.load(open(f)) + print(os.path.basename(d), " ".join(f"{x.get('decode_tok_s', 0):.1f}" for x in t)) +PY