omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / run_gpu_l2_stale_chip.sh
| 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # run_gpu_l2_stale_chip.sh EVIDENCE_DIR [PHYSICS_DIR] |
| 18 | # omega #457 chip gate: after the host rewrites a GPU-cached (CPU_WRITE | GPU_READ) buffer the GPU already read, the next |
| 19 | # launches must read the new bytes. tests/gpu_l2_stale_test.c, 5 rounds of 4 cases: |
| 20 | # rewrite --cached 1 the case under test (unfixed platform: 4096 of 4096 lines stale on every launch, 5/5) |
| 21 | # rewrite --cached 0 negative control (uncached mapping, nvos.h:1117-1118): FRESH on any platform |
| 22 | # realloc --cached 0|1 free + fresh upload: FRESH on any platform |
| 23 | # Every case first proves the GEMV sees A's bytes (+2048 on every row) before judging B. |
| 24 | # Caller holds the GB10 lock: flock /tmp/aien-gb10.lock tools/run_gpu_l2_stale_chip.sh EVID |
| 25 | # Verdict line last: "GPU_L2_STALE_CHIP: PASS|FAIL". PASS = all 20 runs FRESH (exit 0). |
| 26 | set -u |
| 27 | EVID="${1:?evidence dir}"; PHYS="${2:-$HOME/workspace/physics-own30b-k}" |
| 28 | "$(dirname "$0")/require_physics_pin.sh" "$PHYS" || exit 2 # omega#456: refuse a Physics checkout other than physics.lock |
| 29 | HERE="$(cd "$(dirname "$0")/.." && pwd)" |
| 30 | mkdir -p "$EVID" |
| 31 | cd "$HERE" || exit 2 |
| 32 | { |
| 33 | echo "start $(date -u +%FT%TZ) omega=$(git rev-parse HEAD) branch=$(git rev-parse --abbrev-ref HEAD) dirty=$(git status --porcelain | wc -l) physics=$PHYS physics_commit=$(git -C "$PHYS" rev-parse HEAD) physics_lock=$(cat physics.lock 2>/dev/null | head -1)" |
| 34 | uname -a; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null; free -g | head -2 |
| 35 | } > "$EVID/device.txt" |
| 36 | make PHYSICS_DIR="$PHYS" -j10 build/gpu_l2_stale_test > "$EVID/build.log" 2>&1 || { echo "GPU_L2_STALE_CHIP: FAIL build"; exit 1; } |
| 37 | T=./build/gpu_l2_stale_test |
| 38 | fail=0 |
| 39 | for r in 1 2 3 4 5; do for m in rewrite realloc; do for c in 0 1; do |
| 40 | f="$EVID/$m-c$c-r$r.log" |
| 41 | $T --mode "$m" --cached "$c" --reps 3 > "$f" 2>&1; e=$? |
| 42 | echo "# exit $e" >> "$f" |
| 43 | [ "$e" = 0 ] || fail=1 |
| 44 | echo "r$r $(grep -h '^STALE\|INVALID\|^FAIL' "$f" | tail -1) exit=$e" |
| 45 | done; done; done | tee "$EVID/summary.txt" |
| 46 | grep -q 'exit=[^0]' "$EVID/summary.txt" && fail=1 |
| 47 | ( cd "$EVID" && sha256sum device.txt build.log summary.txt *-r*.log > SHA256SUMS ) |
| 48 | if [ $fail = 0 ]; then echo "GPU_L2_STALE_CHIP: PASS"; else echo "GPU_L2_STALE_CHIP: FAIL"; exit 1; fi |