diff --git a/scripts/e2e/decode/parity-audit-ab.sh b/scripts/e2e/decode/parity-audit-ab.sh index 9b225b76..ac438307 100755 --- a/scripts/e2e/decode/parity-audit-ab.sh +++ b/scripts/e2e/decode/parity-audit-ab.sh @@ -1,29 +1,38 @@ #!/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. +# STRA-245 parity audit (docs/experiments/parity-audit-5090.md): paired settings A/B, ours against ours, on the 5-turn 245k Codex-shaped session of the 5090 decode gap. +# HOLDER JOB. Queue stub: ~/work/gpu-runs/holder2/jobs/parity-audit-ab.sh = `exec bash /data/leleka-e2e/parity-audit/jobs/parity-audit-ab.sh`, entry LAST in jobs/PRIORITY +# (after dt-ab3, dt-profile-ab, sm120-replay-id, sm120-e2e-ab). It needs the sealed KAR memfd fd of the holder exactly like run-e2e.sh; no second holder is ever started. +# It takes /data/leleka-e2e/gpu.lock per arm (one arm at a time) and skips an arm when something else uses the GPU. # -# 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) +# ARMS="pa-base pa-pcie35 pa-base pa-pcie35 pa-base pa-pcie35" bash parity-audit-ab.sh # the order IS the repeat order; default ARMS below # -# 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. +# Workload (the only valid one): the FROZEN corpus /data/leleka-e2e/decode/corpus/src/crates (MANIFEST.txt, sha256 1152f45a...), 5 turns, target 245000 tokens, --max-output 300. +# The old ~/work/leleka-head corpus no longer exists: a run on it is a ~300-token session. Guards in this script: long-session.py is the DEV decode-tail guarded copy +# (refuses an empty corpus, exits 3 when the final turn has fewer than --min-final-tokens input tokens) and this script re-checks the final-turn input tokens >= 200000 +# and "no error in any turn" from long-session.json and marks the arm INVALID otherwise. An INVALID arm is never used in a comparison. +# Base for every arm = ours, pinned bin-e2e4 (hardlinks of the DEV decode-tail copy), the shipped-shape env of s1-decode/o-def, the RANKED upstream expert profile +# (run-e2e.sh refuses any other digest). Comparisons are only between arms of this job (same corpus, same binary, same profile). One variable changes per arm: +# pa-base reference (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; ours is a fixed 0.45 EXPERIMENTAL, placement class +# pa-pcie40 LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.40 EXPERIMENTAL, placement class +# pa-dres100 LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=100 (ours leaves 563 MiB free at decode, vanilla 315-389; about +100 expert slots) EXPERIMENTAL, placement class +# pa-notrace no LELEKA_BRINGUP_TRACE / LELEKA_PREFIX_TRACE (run-e2e.sh still exports LELEKA_SERVE_PROFILE=1; span timing only) lossless +# pa-gather STRATA_IQ_GATHER=1 (AVX-512 grid gathers in the CPU IQ kernels; same words, same results) lossless +# pa-lto E2E_BIN=$LTO_BIN, a `cargo build --profile release-lto` build (only if one exists; none is built on the server) lossless +# Placement-class arms (PCIe share, decode reserve) change which device computes an expert or how many experts are resident. They are experimental flags: they stay OFF by +# default in every profile and in the engine until a q_tail_gate result exists for them (docs/experiments/2026-10-28-s6-1-lossy-audit.md, finding F4). +# Metric: per-turn decode_tok_s of the client (long-session.json), same prompts per turn index; compare per-turn means of the repeats, never a single run. set -uo pipefail +D=/data/leleka-e2e/parity-audit 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; } +CORPUS=/data/leleka-e2e/decode/corpus/src/crates +UP=/data/leleka-e2e/decode/assets/expert-profile-upstream.bin # sha256 8f59b4aa..., the file crates/deploy pins as EXPERT_PROFILE_SHA256 +ARMS=${ARMS:-"pa-base pa-pcie35 pa-base pa-pcie35 pa-base pa-pcie35 pa-notrace pa-base pa-dres100 pa-base pa-gather pa-base"} +SESSION_ARGS="--turns 5 --target-tokens 245000 --max-output 300 --min-final-tokens 200000" +for f in "$UP" "$D/tools/long-session.py" "$D/scripts/e2e/run-e2e.sh" "$D/bin-e2e4/leleka-inference" "$CORPUS/backend-api/src/lib.rs"; do + [ -r "$f" ] || { echo "missing $f" >&2; exit 3; } +done n=0 for arm in $ARMS; do n=$((n + 1)); tag="$arm-r$n" @@ -34,7 +43,10 @@ for arm in $ARMS; do 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 + if [ -n "$(nvidia-smi --query-compute-apps=pid --format=csv,noheader)" ]; then + echo "GPU busy, skipping $tag"; rm -f "$LOCK/owner"; rmdir "$LOCK" 2>/dev/null; continue + fi + ( export E2E_BIN=$D/bin-e2e4 export E2E_OUT=$OUTROOT/$tag mkdir -p "$E2E_OUT" export LELEKA_BRINGUP_TRACE=1 LELEKA_PREFIX_TRACE=1 @@ -52,21 +64,56 @@ for arm in $ARMS; do pa-lto) : "${LTO_BIN:?pa-lto needs LTO_BIN=