From 6b613b1a85cd7fba80a45631bf1fcd29a17b30ff Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Thu, 12 Nov 2026 01:09:13 +0100 Subject: [PATCH] A/A guard: engine-log switch line is checked after the arm ran (it appears with the first request); at ready only the engine-environment line. Rerun stubs for pb-vs-pg, slots/adapt, tail CUPTI windows Co-Authored-By: Claude Sonnet 5.5 --- ...de-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun.sh | 8 ++++++++ .../decode-stage-group-ab-profile-set-pb-vs-pg-rerun.sh | 8 ++++++++ scripts/e2e/codex/speed/spd_ab_job.sh | 6 ++++-- scripts/e2e/codex/speed/spd_arm_guard.py | 8 ++++++-- .../speed/verify-tail-head-chain-cupti-windows-rerun.sh | 7 +++++++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 scripts/e2e/codex/speed/decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun.sh create mode 100644 scripts/e2e/codex/speed/decode-stage-group-ab-profile-set-pb-vs-pg-rerun.sh create mode 100644 scripts/e2e/codex/speed/verify-tail-head-chain-cupti-windows-rerun.sh diff --git a/scripts/e2e/codex/speed/decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun.sh b/scripts/e2e/codex/speed/decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun.sh new file mode 100644 index 00000000..ac4e85c2 --- /dev/null +++ b/scripts/e2e/codex/speed/decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# RERUN 2026-11-12: the first run's arms were all refused by a faulty A/A guard (it looked for the engine-log switch line at ready, which appears with the first request); guard fixed, no data from the first run. +# Group A/B of two env-only tier levers against the final profile set PG (placement class, experiments 1 and 2 of docs/experiments/vram-hit-share-gap.md), n = 5 pairs each, one binary bin-pcie-auto (both switches off in it): +# PS = PG + LELEKA_PROMPT_EMBED_ALIAS=1 + LELEKA_ORIGINAL_SERVE_DECODE_RESERVE_MIB=130 (12,384 slots against 12,192; free VRAM at decode must stay >= 315 MiB: read DBG vram lines / status), PW = PG + LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=2. +# Report: ab_report.py RUN_DIR PG PS ; ab_report.py RUN_DIR PG PW ; plus `expert cache N slots` from each engine.log. +unset SPD_VARIANTS SPD_CELLS SPD_OUT SPD_MAX SPD_TUNES SPD_BIN +export SPD_BIN=/data/leleka-e2e/spd-gap/bin-pcie-auto SPD_VARIANTS="PG.1 PS.1 PW.1 PW.2 PS.2 PG.2 PG.3 PS.3 PW.3 PW.4 PS.4 PG.4 PG.5 PS.5 PW.5" SPD_MAX=30 SPD_CELLS=/data/leleka-e2e/codex-compare/runs/main/VANL/nestng-crm-r2 SPD_OUT=/data/leleka-e2e/spd-gap/runs/decode-slots-and-adapt-every-group-ab-pg-vs-ps-pw-rerun +exec bash /data/leleka-e2e/spd-gap/tools/spd_ab_job_x.sh diff --git a/scripts/e2e/codex/speed/decode-stage-group-ab-profile-set-pb-vs-pg-rerun.sh b/scripts/e2e/codex/speed/decode-stage-group-ab-profile-set-pb-vs-pg-rerun.sh new file mode 100644 index 00000000..9e1ca5be --- /dev/null +++ b/scripts/e2e/codex/speed/decode-stage-group-ab-profile-set-pb-vs-pg-rerun.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# RERUN 2026-11-12: the first run's arms were all refused by a faulty A/A guard (it looked for the engine-log switch line at ready, which appears with the first request); guard fixed, no data from the first run. +# Group A/B at the end of the stage (owner rule 2026-11-10, n = 5 pairs): PB = the 5090 profile set before the QSA prelude, the fused commit and the combine vec4; +# PG = the final profile set of the stage as the profiles carry it (+ prelude, fused commit, combine vec4, down sub16, hits in combine). Same binary bin-ffn-switches (the switches come from the variant, not from a profile file). Re-measures the decode step of R1 after the whole stage: how many ms/round of the +1.98 are closed. +# First 30 requests of VANL nestng-crm-r2, floor profile, order ABBA-like to cancel drift. Report: ab_report.py RUN_DIR PB PG. +unset SPD_VARIANTS SPD_CELLS SPD_OUT SPD_MAX SPD_TUNES SPD_BIN +export SPD_BIN=/data/leleka-e2e/spd-gap/bin-ffn-switches SPD_VARIANTS="PB.1 PG.1 PG.2 PB.2 PB.3 PG.3 PG.4 PB.4 PB.5 PG.5" SPD_MAX=30 SPD_CELLS=/data/leleka-e2e/codex-compare/runs/main/VANL/nestng-crm-r2 SPD_OUT=/data/leleka-e2e/spd-gap/runs/decode-stage-group-ab-profile-set-pb-vs-pg-rerun +exec bash /data/leleka-e2e/spd-gap/tools/spd_ab_job_x.sh diff --git a/scripts/e2e/codex/speed/spd_ab_job.sh b/scripts/e2e/codex/speed/spd_ab_job.sh index 277845f2..f0e8e7c6 100644 --- a/scripts/e2e/codex/speed/spd_ab_job.sh +++ b/scripts/e2e/codex/speed/spd_ab_job.sh @@ -134,8 +134,8 @@ for v in $VARS; do # A/A guard (2026-11-11): the engine_env of a profile embedded in the binary OVERRIDES the shell env (pkg-s14+). Record what the engine really got and # refuse an arm whose switches differ from what it exports (SPD_AA_GUARD=0 disables). Details: spd_arm_guard.py grep -hE "requested Sm120Switches|expert cache [0-9]+ slots" "$ST/logs/engine.log" >"$D/effective-switches.txt" 2>/dev/null; grep -h "engine environment" "$D/up-foreground.txt" >>"$D/effective-switches.txt" 2>/dev/null - if [ "${SPD_AA_GUARD:-1}" = 1 ] && ! python3 -I "$SPD/tools/spd_arm_guard.py" check "$ST/logs/engine.log" "$D/up-foreground.txt" >"$D/aa-guard.txt" 2>&1; then - log "variant $v NOT VALID (A/A guard): $(head -3 "$D/aa-guard.txt" | tr '\n' ' ')"; stop_stack; kill "$MON_PID" 2>/dev/null; continue + if [ "${SPD_AA_GUARD:-1}" = 1 ] && ! python3 -I "$SPD/tools/spd_arm_guard.py" env "$D/up-foreground.txt" >"$D/aa-guard-env.txt" 2>&1; then + log "variant $v NOT VALID (A/A guard): $(head -3 "$D/aa-guard-env.txt" | tr '\n' ' ')"; stop_stack; kill "$MON_PID" 2>/dev/null; continue fi args=(); for c in $CELLS; do args+=(--cell "$c"); done if [ "$vb" = S ]; then @@ -155,6 +155,8 @@ for v in $VARS; do if [ $cupti_arm = 1 ]; then for _ in $(seq 1 60); do [ -e "$D/cupti.trigger.done" ] && break; sleep 1; done; kill "$WATCH_PID" 2>/dev/null; fi fi cp "$ST/logs/engine.log" "$D/engine.log" 2>/dev/null; cp "$ST/logs/requests.log" "$D/requests.log" 2>/dev/null + # the switch line of the engine log appears with the first request: check it after the arm ran and mark the arm, never abort it + if [ "${SPD_AA_GUARD:-1}" = 1 ]; then python3 -I "$SPD/tools/spd_arm_guard.py" check "$D/engine.log" "$D/up-foreground.txt" >"$D/aa-guard.txt" 2>&1 || log "variant $v INVALID (A/A guard): $(head -3 "$D/aa-guard.txt" | tr '\n' ' ')"; fi stop_stack; kill "$MON_PID" 2>/dev/null; MON_PID= sleep 5 done diff --git a/scripts/e2e/codex/speed/spd_arm_guard.py b/scripts/e2e/codex/speed/spd_arm_guard.py index 753fed5e..49a2a498 100644 --- a/scripts/e2e/codex/speed/spd_arm_guard.py +++ b/scripts/e2e/codex/speed/spd_arm_guard.py @@ -7,7 +7,8 @@ variable key is also in the profile compares the same engine twice. Two modes: make < profile.json > arm-profile.json Drop every guarded switch key from the profile's engine_env and set the ones this arm exports (the arm's shell env, LELEKA_* keys). Use with `leleka up --profile FILE` (SPD_ARM_PROFILE=1). - check ENGINE_LOG UP_FOREGROUND + env UP_FOREGROUND (at ready: the engine log has no switch line yet, it appears with the first request) + check ENGINE_LOG UP_FOREGROUND (after the arm has run) Compare what the engine really got with what this arm exports; exit 1 on any mismatch: 1. the "requested Sm120Switches" line of the engine log: an exported switch must be true, an unexported one false (unless it is in SPD_SWITCH_DEFAULT_ON, comma separated field names); @@ -87,7 +88,8 @@ def check_environment(up_foreground, errors): def check(engine_log, up_foreground): errors = [] - check_switches(engine_log, errors) + if engine_log: + check_switches(engine_log, errors) check_environment(up_foreground, errors) for e in errors: print("A/A GUARD:", e) @@ -100,5 +102,7 @@ if __name__ == "__main__": make() elif sys.argv[1:2] == ["check"] and len(sys.argv) == 4: check(sys.argv[2], sys.argv[3]) + elif sys.argv[1:2] == ["env"] and len(sys.argv) == 3: + check(None, sys.argv[2]) else: sys.exit(__doc__) diff --git a/scripts/e2e/codex/speed/verify-tail-head-chain-cupti-windows-rerun.sh b/scripts/e2e/codex/speed/verify-tail-head-chain-cupti-windows-rerun.sh new file mode 100644 index 00000000..ccd1e958 --- /dev/null +++ b/scripts/e2e/codex/speed/verify-tail-head-chain-cupti-windows-rerun.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# RERUN 2026-11-12: the first run's arms were all refused by a faulty A/A guard (it looked for the engine-log switch line at ready, which appears with the first request); guard fixed, no data from the first run. +# CUPTI windows (request 29, 15 s) of the final 5090 profile set (QP, control) and + LELEKA_SM120_HEAD_CHAIN_BATCH (QT, ledger R8: the 6T tail launches batched to 6). Binary bin-tail. +# Look at: tail launch count 6T+4 -> 10, mtp_full_gr_norm / mmvf256 / mmvf160 / pre_final -> 0 in the tail, new leleka_verify_final_write_rows / head_norm_rows / head_pre_final_rows; time from the last add_hits end to head_quant start per T. +unset SPD_VARIANTS SPD_CELLS SPD_OUT SPD_MAX SPD_TUNES SPD_BIN +export SPD_BIN=/data/leleka-e2e/spd-gap/bin-tail SPD_VARIANTS="QP.1 QT.1" SPD_MAX=30 SPD_CELLS=/data/leleka-e2e/codex-compare/runs/main/VANL/nestng-crm-r2 SPD_OUT=/data/leleka-e2e/spd-gap/runs/verify-tail-head-chain-cupti-windows-rerun SPD_TRIG_AT=28 SPD_WIN_S=15 +exec bash /data/leleka-e2e/spd-gap/tools/spd_ab_job_x.sh