interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / tools / run_gpu_router_chip.sh

56 lines · 3969 bytes Raw Blame History
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_router_chip.sh EVIDENCE_DIR [PHYSICS_DIR]
18# OWN-30B cut 8 item 2 chip gate for omega_gpu_router_api (one-launch MoE router: RMSNorm, logits, top-8, weights,
19# x' row and the grouped FP8 GEMV's group tables written on the device).
20# Caller holds the GB10 lock: flock /tmp/aien-gb10.lock tools/run_gpu_router_chip.sh EVID
21# 0. host proofs first (never hardware results): --host-only (oracle, codegen budgets, refusals) and --sim
22# (warp-simulator parity at 8 warps, both fragment orders, norm_topk on and off, mutants 1-4 caught)
23# 1. baseline: the already-proven matmul API chip timing (chip and session path work before the new kernel is judged)
24# 2. main: parity against the double oracle on 36 random hidden states (layer 0; norm_topk on and off; x scales
25# 0.01 / 1 / 40; out_scale 1 and 2^64), second call bit-identical, mutants 1-4 at the chip, end-to-end on layer 1:
26# the grouped FP8 gate+up GEMV (128 x 1536 x 2048) reading the router-written table and x' equals the host-table
27# call bit for bit and one group matches the FP8 host oracle; chip medians of router + gate+up, host caches evicted
28# 3. one variable per run, informational: kernel shape (warps 32 depth 8; 16/8; 8/8) and --no-evict
29# Verdict line last: "GPU_ROUTER_CHIP: PASS|FAIL". Steps 0 and 2 decide; 1 and 3 are recorded.
30set -u
31EVID="${1:?evidence dir}"; PHYS="${2:-$HOME/workspace/physics-own30b-k}"
32"$(dirname "$0")/require_physics_pin.sh" "$PHYS" || exit 2 # omega#456: refuse a Physics checkout other than physics.lock
33HERE="$(cd "$(dirname "$0")/.." && pwd)"
34mkdir -p "$EVID"
35cd "$HERE" || exit 2
36{
37 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)"
38 uname -a; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null; free -g | head -2
39} > "$EVID/device.txt"
40make PHYSICS_DIR="$PHYS" -j10 build/gpu_router_test build/gpu_matmul_api_test > "$EVID/build.log" 2>&1 || { echo "GPU_ROUTER_CHIP: FAIL build"; exit 1; }
41T=./build/gpu_router_test
42fail=0
43$T --host-only 2>&1 | tee "$EVID/host-only.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
44$T --sim 2>&1 | tee "$EVID/sim.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
45./build/gpu_matmul_api_test --timing --out "$EVID/receipt-baseline-matmul.json" 2>&1 | tee "$EVID/baseline-matmul.log"
46echo "baseline exit ${PIPESTATUS[0]} (recorded)" | tee -a "$EVID/baseline-matmul.log"
47$T --reps 50 --out "$EVID/receipt-main.json" 2>&1 | tee "$EVID/main.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
48for shape in "32 8" "16 8" "8 8"; do
49 set -- $shape
50 $T --reps 50 --warps "$1" --depth "$2" --out "$EVID/receipt-w$1-d$2.json" 2>&1 | tee "$EVID/w$1-d$2.log"; echo "warps $1 depth $2 exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/w$1-d$2.log"
51done
52$T --reps 50 --no-evict --out "$EVID/receipt-noevict.json" 2>&1 | tee "$EVID/noevict.log"; echo "no-evict exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/noevict.log"
53
54echo "end $(date -u +%FT%TZ)" >> "$EVID/device.txt"
55(cd "$EVID" && sha256sum *.json *.log device.txt > SHA256SUMS)
56if [ $fail = 0 ]; then echo "GPU_ROUTER_CHIP: PASS"; else echo "GPU_ROUTER_CHIP: FAIL"; exit 1; fi