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_numeric_ldst_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_numeric_ldst_chip.sh -- E1 row 2 chip run: every spec of the load/store table |
| 18 | # (tests/test_omega_ldst_gb10.c) executed on the GB10 and compared byte for byte with the host model. |
| 19 | # Meant to run only from the heavy forge lane (which serializes chip work); it also takes |
| 20 | # /tmp/aien-gb10.lock. It never raises the quiet flag and never kills or times out the run. |
| 21 | # A FAIL whose RESULT lines show "unwritten" > 0 (bytes still holding the fill pattern where the |
| 22 | # host model wrote) is the C3 unwritten-output signature and must be classified as C3. |
| 23 | # Usage: PHYSICS_DIR=<physics checkout at physics.lock> tools/run_numeric_ldst_chip.sh |
| 24 | # Shell + gcc only. No Python. |
| 25 | set -u |
| 26 | HERE=$(cd -P "$(dirname "$0")/.." && pwd) |
| 27 | PHYSICS=${PHYSICS_DIR:-$HOME/workspace/hive-worktrees/physics-pin-e95e3ed} |
| 28 | QUIET=$HOME/workspace/.spark-quiet |
| 29 | refuse() { echo "REFUSED: $*"; echo "VERDICT NOT_RUN"; exit 1; } |
| 30 | [ -z "$(git -C "$HERE" status --porcelain)" ] || refuse "omega tree $HERE is dirty" |
| 31 | PIN=$(tr -d '[:space:]' < "$HERE/physics.lock") |
| 32 | [ "$(git -C "$PHYSICS" rev-parse HEAD 2>/dev/null)" = "$PIN" ] || refuse "physics checkout $PHYSICS is not at physics.lock pin $PIN" |
| 33 | [ -e "$QUIET" ] && refuse "quiet flag is up: $(cat "$QUIET")" |
| 34 | [ -n "$(pgrep est_load)" ] && refuse "an est_load process is running" |
| 35 | RUN=$(mktemp -d /tmp/ldst-chip.XXXXXX) |
| 36 | echo "omega $(git -C "$HERE" rev-parse HEAD) physics $PIN" |
| 37 | echo "== host tier" |
| 38 | make -s -C "$HERE" build/test_omega_ldst_gb10_cpu > "$RUN/host-build.log" 2>&1 || refuse "host build failed" |
| 39 | "$HERE/build/test_omega_ldst_gb10_cpu" > "$RUN/host.log" 2>&1 || { tail -5 "$RUN/host.log"; refuse "host tier failed"; } |
| 40 | tail -2 "$RUN/host.log" |
| 41 | echo "== nvdisasm provenance" |
| 42 | "$HERE/tools/ldst_nvdisasm_check.sh" > "$RUN/nvdisasm.log" 2>&1 || { cat "$RUN/nvdisasm.log"; refuse "nvdisasm check failed"; } |
| 43 | tail -3 "$RUN/nvdisasm.log" |
| 44 | exec 9> /tmp/aien-gb10.lock || refuse "cannot open /tmp/aien-gb10.lock" |
| 45 | flock -x 9 || refuse "cannot take /tmp/aien-gb10.lock" |
| 46 | echo "== chip build" |
| 47 | NV=$PHYSICS/third_party/nvidia-open-580.173.02 |
| 48 | BIN=$RUN/test_omega_ldst_gb10 |
| 49 | (cd "$HERE" && gcc -std=gnu11 -O2 -Wall -Wextra -Werror -ffp-contract=off -pthread \ |
| 50 | -Isrc -I"$PHYSICS/nvrm" -I"$PHYSICS/m16" \ |
| 51 | -I"$NV/src/common/sdk/nvidia/inc" -I"$NV/kernel-open/common/inc" \ |
| 52 | -I"$NV/kernel-open/nvidia-uvm" -I"$NV/src/nvidia/arch/nvalloc/unix/include" \ |
| 53 | -o "$BIN" tests/test_omega_ldst_gb10.c src/omega_numeric_ldst_gb10.c src/omega_numeric_divsqrt_gb10.c src/omega_numeric.c \ |
| 54 | src/omega_numeric_provenance.c src/omega_blackwell_encoder.c src/omega_blackwell_codegen.c \ |
| 55 | src/omega_blackwell_matmul.c src/omega_blackwell_qmd.c src/omega_om_units.c \ |
| 56 | "$PHYSICS/nvrm/nvrm.c" "$PHYSICS/m16/m16_native.c") > "$RUN/chip-build.log" 2>&1 || { cat "$RUN/chip-build.log"; refuse "chip build failed"; } |
| 57 | echo "== chip run (not killed, not timed out)" |
| 58 | # LDST_CHIP_ARGS (optional) e.g. "--spec 129 --repeats 500" reruns one spec; default is the whole table. |
| 59 | "$BIN" --chip ${LDST_CHIP_ARGS:-} > "$RUN/chip.log" 2>&1; RC=$? |
| 60 | exec 9>&- |
| 61 | grep -h OMEGA_DEVERR "$RUN/chip.log" | sort | uniq -c | head -20 |
| 62 | grep -c '^RESULT chip .*verdict=PASS' "$RUN/chip.log" | sed 's/^/specs passed: /' |
| 63 | grep '^RESULT chip .*verdict=FAIL' "$RUN/chip.log" | head -20 |
| 64 | UNW=$(sed -n 's/.* unwritten=\([0-9]*\) .*/\1/p' "$RUN/chip.log" | awk '{s+=$1} END {print s+0}') |
| 65 | [ "$UNW" = 0 ] || echo "NOTE: $UNW unwritten bytes in total: C3 signature (unwritten output), classify as C3 not as a load/store bug" |
| 66 | grep '^VERDICT' "$RUN/chip.log" | tail -1 |
| 67 | echo "log: $RUN/chip.log" |
| 68 | [ "$RC" = 0 ] |