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_bf16_gemv_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_bf16_gemv_chip.sh EVIDENCE_DIR [PHYSICS_DIR] |
| 18 | # OWN-30B chip gate for omega_gpu_bf16_gemv_api (bf16 streaming GEMV, the lm_head 151936 x 2048). |
| 19 | # Caller holds the GB10 lock: flock /tmp/aien-gb10.lock tools/run_gpu_bf16_gemv_chip.sh EVID |
| 20 | # 0. host proofs first (never hardware results): --host-only and --sim (bit-identical to the f32 emulation, mutants 1-3 caught) |
| 21 | # 1. baseline: the proven matmul API chip timing |
| 22 | # 2. main: all 151936 logits bit-identical to the host emulation, within 1e-5 of the double oracle, second call |
| 23 | # bit-identical, bf16-x entry, mutants 1-3 caught on the chip, timing medians (evicted host caches) |
| 24 | # 3. informational, one variable per run: --no-evict, --depth 4, --warps 32, --ctas 48; then the report-only |
| 25 | # fp8-vs-bf16 argmax study on the real checkpoint (nothing is switched) |
| 26 | # Verdict line last: "GPU_BF16_GEMV_CHIP: PASS|FAIL". Steps 0 and 2 decide. |
| 27 | set -u |
| 28 | EVID="${1:?evidence dir}"; PHYS="${2:-$HOME/workspace/physics-own30b-k}" |
| 29 | "$(dirname "$0")/require_physics_pin.sh" "$PHYS" || exit 2 # omega#456: refuse a Physics checkout other than physics.lock |
| 30 | MODEL="${MODEL_DIR:-$HOME/models/qwen3-30b-a3b-instruct-2507-fp8}" |
| 31 | HERE="$(cd "$(dirname "$0")/.." && pwd)" |
| 32 | mkdir -p "$EVID"; cd "$HERE" || exit 2 |
| 33 | { |
| 34 | 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)" |
| 35 | uname -a; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null; free -g | head -2 |
| 36 | } > "$EVID/device.txt" |
| 37 | make PHYSICS_DIR="$PHYS" -j10 build/gpu_bf16_gemv_test build/gpu_matmul_api_test build/gpu_lmhead_fp8_study > "$EVID/build.log" 2>&1 || { echo "GPU_BF16_GEMV_CHIP: FAIL build"; exit 1; } |
| 38 | T=./build/gpu_bf16_gemv_test; fail=0 |
| 39 | $T --host-only 2>&1 | tee "$EVID/host-only.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1 |
| 40 | $T --sim 2>&1 | tee "$EVID/sim.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1 |
| 41 | ./build/gpu_matmul_api_test --timing --out "$EVID/receipt-baseline-matmul.json" 2>&1 | tee "$EVID/baseline-matmul.log" |
| 42 | echo "baseline exit ${PIPESTATUS[0]} (recorded)" | tee -a "$EVID/baseline-matmul.log" |
| 43 | $T --reps 50 --out "$EVID/receipt-main.json" 2>&1 | tee "$EVID/main.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1 |
| 44 | for v in "--no-evict:noevict" "--depth 4:d4" "--warps 32:w32" "--ctas 48:c48"; do |
| 45 | a="${v%%:*}"; n="${v##*:}" |
| 46 | $T --reps 30 $a --out "$EVID/receipt-$n.json" 2>&1 | tee "$EVID/$n.log"; echo "$a exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/$n.log" |
| 47 | done |
| 48 | ./build/gpu_lmhead_fp8_study "$MODEL" --out "$EVID/argmax-study.txt" 2>&1 | tee "$EVID/argmax-study.log"; echo "study exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/argmax-study.log" |
| 49 | echo "end $(date -u +%FT%TZ)" >> "$EVID/device.txt" |
| 50 | (cd "$EVID" && sha256sum *.json *.log *.txt > SHA256SUMS) |
| 51 | if [ $fail = 0 ]; then echo "GPU_BF16_GEMV_CHIP: PASS"; else echo "GPU_BF16_GEMV_CHIP: FAIL"; exit 1; fi |