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

53 lines · 4022 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_decode_attn_chip.sh EVIDENCE_DIR [PHYSICS_DIR]
18# OWN-30B cut 8 chip gate for omega_gpu_decode_attn_api (one-launch GQA decode attention, in-kernel KV append).
19# Caller holds the GB10 lock: flock /tmp/aien-gb10.lock tools/run_gpu_decode_attn_chip.sh EVID
20# 0. host proofs first (never hardware results): --host-only (bf16 rounding, RoPE rows, reference sanity, codegen
21# budgets, refusals) and --sim (warp-simulator parity on 8 contexts incl. multi-split and 2 chunks per CTA, mutants 1-4)
22# 1. baseline: the already-proven matmul API chip timing (chip and session path work before the new kernel is judged)
23# 2. main: parity against the double reference at contexts 1, 7, 256, 301 (sharp q), 1024, 4096, 8192, 32768; the appended
24# K/V rows read back; second call bit-identical; out_scale 2^64 path; mutants 1-4 at context 301; chip medians and
25# GB/s on the K+V bytes streamed, host caches evicted before each timing loop
26# 3. one variable per run, informational: --no-evict (host caches warm: the flattering number), --depth 1 (shallowest
27# prefetch), --per-split 1024 (4 chunks per CTA, a quarter of the CTAs)
28# Verdict line last: "GPU_DECODE_ATTN_CHIP: PASS|FAIL". Steps 0 and 2 decide; 1 and 3 are recorded.
29set -u
30EVID="${1:?evidence dir}"; PHYS="${2:-$HOME/workspace/physics-own30b-k}"
31"$(dirname "$0")/require_physics_pin.sh" "$PHYS" || exit 2 # omega#456: refuse a Physics checkout other than physics.lock
32HERE="$(cd "$(dirname "$0")/.." && pwd)"
33mkdir -p "$EVID"
34cd "$HERE" || exit 2
35{
36 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)"
37 uname -a; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null; free -g | head -2
38} > "$EVID/device.txt"
39make PHYSICS_DIR="$PHYS" -j10 build/gpu_decode_attn_test build/gpu_matmul_api_test > "$EVID/build.log" 2>&1 || { echo "GPU_DECODE_ATTN_CHIP: FAIL build"; exit 1; }
40T=./build/gpu_decode_attn_test
41fail=0
42$T --host-only 2>&1 | tee "$EVID/host-only.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
43$T --sim 2>&1 | tee "$EVID/sim.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
44./build/gpu_matmul_api_test --timing --out "$EVID/receipt-baseline-matmul.json" 2>&1 | tee "$EVID/baseline-matmul.log"
45echo "baseline exit ${PIPESTATUS[0]} (recorded)" | tee -a "$EVID/baseline-matmul.log"
46$T --reps 20 --out "$EVID/receipt-main.json" 2>&1 | tee "$EVID/main.log"; [ "${PIPESTATUS[0]}" = 0 ] || fail=1
47$T --reps 20 --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"
48$T --reps 20 --depth 1 --out "$EVID/receipt-depth1.json" 2>&1 | tee "$EVID/depth1.log"; echo "depth 1 exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/depth1.log"
49$T --reps 20 --per-split 1024 --out "$EVID/receipt-persplit1024.json" 2>&1 | tee "$EVID/persplit1024.log"; echo "per-split 1024 exit ${PIPESTATUS[0]} (informational)" | tee -a "$EVID/persplit1024.log"
50
51echo "end $(date -u +%FT%TZ)" >> "$EVID/device.txt"
52(cd "$EVID" && sha256sum *.json *.log device.txt > SHA256SUMS)
53if [ $fail = 0 ]; then echo "GPU_DECODE_ATTN_CHIP: PASS"; else echo "GPU_DECODE_ATTN_CHIP: FAIL"; exit 1; fi