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_cut4b_chip.sh

69 lines · 4024 bytes Raw Blame History
1#!/bin/sh
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# tools/run_gpu_cut4b_chip.sh [OUT_ROOT] [PROBE_N]
18# FB-1 cut 4b chip gate: the three native GPU APIs on ONE persistent session.
19# 1. elementwise parity battery (cut 4, unchanged cases) + --timing
20# (rmsnorm 1x2048 and swiglu 5632: median of 100 calls under 0.5 ms, one open)
21# 2. attention: host simulator first, then the chip parity battery (cut 5, unchanged
22# cases) + --timing (1 query x 32 heads x 2048 ctx: median of 100 calls under 3 ms)
23# 3. matmul sweep + --timing (cut 1b regression on the shared session)
24# 4. fresh-process device-open probe (flake investigation, tools/probe_gpu_open.sh)
25# Sealed receipt folder OUT_ROOT/FB1-CUT4B-<sha>/ (default ~/workspace/evidence-out):
26# elementwise.json elementwise_timing.json attention.json attention_timing.json
27# matmul.json matmul_timing.json + the matching *.log, probe/ (probe.log, failures.txt),
28# device.txt build.log, copies of the sources the verdict depends on, SHA256SUMS.
29# Every step runs even when an earlier one fails (the receipt records all of them).
30# Run it through the heavy queue only (lanes.sh queue --heavy); never kill it.
31set -u
32cd "$(dirname "$0")/.." || exit 2
33P=${PHYSICS_DIR:-../physics}
34SHA=$(git rev-parse --short HEAD)
35OUT=${1:-$HOME/workspace/evidence-out}/FB1-CUT4B-$SHA
36PROBE_N=${2:-30}
37mkdir -p "$OUT"
38if ! make PHYSICS_DIR="$P" build/gpu_elementwise_test build/gpu_attention_test build/gpu_matmul_api_test build/gpu_session_probe > "$OUT/build.log" 2>&1; then
39 echo "FB1-CUT4B BUILD FAIL (see $OUT/build.log)"; exit 1
40fi
41{
42 uname -a
43 nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null || echo "nvidia-smi: unavailable"
44 echo "omega $(git rev-parse HEAD) ($(git status --porcelain | wc -l) uncommitted paths)"
45 echo "physics $(git -C "$P" rev-parse HEAD)"
46 date -u +%FT%TZ
47} > "$OUT/device.txt"
48fail=0
49step() { # name command...
50 name=$1; shift
51 "$@" > "$OUT/$name.log" 2>&1; rc=$?
52 echo "$name rc=$rc :: $(grep -E '^(PASS|FAIL)' "$OUT/$name.log" | tail -1)"
53 [ "$rc" -eq 0 ] || fail=$((fail+1))
54}
55step elementwise ./build/gpu_elementwise_test --out "$OUT/elementwise.json"
56step elementwise_timing ./build/gpu_elementwise_test --timing --out "$OUT/elementwise_timing.json"
57step attention_sim ./build/gpu_attention_test --sim
58step attention ./build/gpu_attention_test --out "$OUT/attention.json"
59step attention_timing ./build/gpu_attention_test --timing --out "$OUT/attention_timing.json"
60step matmul ./build/gpu_matmul_api_test --out "$OUT/matmul.json"
61step matmul_timing ./build/gpu_matmul_api_test --timing --out "$OUT/matmul_timing.json"
62./tools/probe_gpu_open.sh "$OUT/probe" "$PROBE_N" > "$OUT/probe.log" 2>&1; prc=$?
63tail -1 "$OUT/probe.log"
64echo "end $(date -u +%FT%TZ)" >> "$OUT/device.txt"
65cp src/omega_gpu_session.c src/omega_gpu_session.h src/omega_gpu_platform.c src/omega_gpu_platform_linux.c src/omega_gpu_fmt.c src/omega_gpu_matmul_api.c src/omega_gpu_elementwise_api.c src/omega_gpu_elementwise_api.h \
66 src/omega_gpu_attention_api.c src/omega_gpu_attention_api.h tests/gpu_elementwise_test.c tests/bw_mufu_ftz.h tests/gpu_attention_test.c tests/gpu_matmul_api_test.c "$OUT/"
67(cd "$OUT" && sha256sum -- * probe/* 2>/dev/null > SHA256SUMS)
68echo "FB1-CUT4B chip gate failed_steps=$fail probe_rc=$prc receipt=$OUT"
69[ "$fail" -eq 0 ] && [ "$prc" -ne 3 ]