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_prefill_attn_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_prefill_attn_chip.sh EVIDENCE_DIR [PHYSICS_DIR] |
| 18 | # OWN-30B L1 attention chip gate for omega_gpu_prefill_attn_api (tensor-core causal prefill attention, chunked, in-kernel |
| 19 | # K/V append). Caller holds the GB10 lock: flock /tmp/aien-gb10.lock tools/run_gpu_prefill_attn_chip.sh EVID |
| 20 | # 0. host proofs first (never hardware results): --host-only (budgets, placeholder patches) and --sim (simulator parity, |
| 21 | # rows bit-equal to the emulation, mutants 1-4) |
| 22 | # 1. baseline: the already-proven decode attention chip gate binary at one quick point (the session path and the |
| 23 | # decode kernel the gate compares against work before the new kernel is judged) |
| 24 | # 2. main (warps 8): parity vs the double reference, gate 2 (rows bit-identical to m decode steps on a twin cache, |
| 25 | # outputs within tolerance), second call identical, out_scale 2^64, mutants 1-4, timing medians vs the decode loop |
| 26 | # 3. one variable, informational: warps 4 |
| 27 | # cut 3 (2026-10-13): main runs the default split path (APPEND + ATTEND launches) and the device-resident entry; |
| 28 | # main-fused (--fused --quick) re-proves the cut-1 path; 4. spread study at 2048 tokens (informational): an SM clock |
| 29 | # camera (nvidia-smi sampled every 100 ms, outside the measured path) over: fused cold (baseline), fused warm 5, |
| 30 | # split cold, split warm 5, 15 reps each, per-rep and per-launch times printed. |
| 31 | # Verdict line last: "GPU_PREFILL_ATTN_CHIP: PASS|FAIL". Steps 0 and 2 decide; 1 and 3 are recorded. |
| 32 | set -u |
| 33 | EVID="${1:?evidence dir}"; PHYS="${2:-$HOME/workspace/physics-own30b-k}" |
| 34 | "$(dirname "$0")/require_physics_pin.sh" "$PHYS" || exit 2 # omega#456: refuse a Physics checkout other than physics.lock |
| 35 | HERE="$(cd "$(dirname "$0")/.." && pwd)" |
| 36 | mkdir -p "$EVID" |
| 37 | cd "$HERE" || exit 2 |
| 38 | { |
| 39 | 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)" |
| 40 | uname -a; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null; free -g | head -2 |
| 41 | } > "$EVID/device.txt" |
| 42 | make PHYSICS_DIR="$PHYS" -j10 build/gpu_prefill_attn_test build/gpu_decode_attn_test > "$EVID/build.log" 2>&1 || { echo "GPU_PREFILL_ATTN_CHIP: FAIL build"; exit 1; } |
| 43 | T=./build/gpu_prefill_attn_test |
| 44 | fail=0 |
| 45 | $T --host-only 2>&1 | tee "$EVID/host-only.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1 |
| 46 | $T --sim 2>&1 | tee "$EVID/sim.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1 |
| 47 | ./build/gpu_decode_attn_test --reps 3 --only 1024 --out "$EVID/receipt-baseline-decode.json" 2>&1 | tail -20 | tee "$EVID/baseline-decode.log" |
| 48 | echo "baseline exit ${PIPESTATUS[0]} (recorded)" | tee -a "$EVID/baseline-decode.log" |
| 49 | $T --reps 9 --out "$EVID/receipt-main.json" 2>&1 | tee "$EVID/main.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1 |
| 50 | $T --reps 9 --warps 4 --quick --out "$EVID/receipt-warps4.json" 2>&1 | tee "$EVID/warps4.log"; echo "warps 4 exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/warps4.log" |
| 51 | $T --reps 9 --fused --quick --out "$EVID/receipt-main-fused.json" 2>&1 | tee "$EVID/main-fused.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1 |
| 52 | nvidia-smi --query-gpu=timestamp,clocks.sm,clocks.mem,utilization.gpu,power.draw,pstate --format=csv -lms 100 > "$EVID/clocks.csv" 2>&1 & |
| 53 | CAM=$! |
| 54 | for v in "fused-cold:--fused" "fused-warm5:--fused --warm 5" "split-cold:" "split-warm5:--warm 5"; do |
| 55 | name=${v%%:*}; flags=${v#*:} |
| 56 | echo "variant $name start $(date -u +%FT%T.%3NZ)" >> "$EVID/spread-marks.txt" |
| 57 | $T --timing-only --reps 15 $flags 2>&1 | tee "$EVID/spread-$name.log"; echo "$name exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/spread-$name.log" |
| 58 | echo "variant $name end $(date -u +%FT%T.%3NZ)" >> "$EVID/spread-marks.txt" |
| 59 | done |
| 60 | kill $CAM 2>/dev/null; wait $CAM 2>/dev/null |
| 61 | echo "end $(date -u +%FT%TZ)" >> "$EVID/device.txt" |
| 62 | (cd "$EVID" && sha256sum *.json *.log *.csv *.txt > SHA256SUMS) |
| 63 | if [ $fail = 0 ]; then echo "GPU_PREFILL_ATTN_CHIP: PASS"; else echo "GPU_PREFILL_ATTN_CHIP: FAIL"; exit 1; fi |