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 / seed / tensix / gate-tensix.sh

336 lines · 17898 bytes Raw Blame History
1#!/bin/sh
2# Host-only check of the Tenstorrent Tensix RISC-V vecadd (seed/tensix). Two producers of the
3# same RV32IM kernel: (1) the unchanged rung-2 assembler seed/rung2/asm2.bin with the plain-text
4# table rv32im.tbl and hand-written listings; (2) seeded Omega: seed/out/omc builds irrv32.om,
5# which lifts the OSC IR v1 of a scalar uint unit (vecadd.unit.om, mix.unit.om) into the
6# elementwise loop. Every checker below is an interop oracle, not Omega-native: GNU objdump and
7# LLVM objdump disassemble; ttsim (Tenstorrent's open simulator, Wormhole and Blackhole
8# libraries) and qemu-riscv32 execute; oracle.py only moves bytes in and out. None of them
9# generates or edits an instruction. Nothing here touches a Tenstorrent card.
10# Optional: TTSIM_DIR (holds libttsim_wh_aarch64.so and libttsim_bh_aarch64.so of ttsim v1.15.0),
11# RISCV_OBJDUMP, RISCV_OBJCOPY, LLVM_OBJDUMP, QEMU_RISCV32, PYTHON.
12# Exit 0 PASS, 1 FAIL, 3 NOT_RUN (some oracle absent, nothing failed). Artifacts: build/seed/tensix.
13set -u
14cd "$(dirname "$0")/../.."
15R=seed/tensix
16B=build/seed/tensix
17rm -rf "$B"
18mkdir -p "$B"
19: > "$B/gate.log"
20say() { printf '%s\n' "$*" | tee -a "$B/gate.log"; }
21fails=0
22notrun=0
23ok() { say "PASS $*"; }
24bad() { say "FAIL $*"; fails=$((fails + 1)); }
25nr() { say "NOT_RUN $*"; notrun=$((notrun + 1)); }
26sha() { sha256sum "$1" | cut -d ' ' -f 1; }
27first_diff() { cmp "$1" "$2" 2>&1 | sed -n 1p; }
28
29ASM=seed/rung2/asm2.bin
30TAB=$R/rv32im.tbl
31ASM_PIN=6988abe072fac3cdef2240d5ad13a3ecd8fb576fa09112d344b9e7c2315969c4
32OMC=seed/out/omc
33OMC_PIN=26540e6de62402d5784b30b24d7c6faae488137c1f8a4b3e784fd0b5d5528991
34TTSIM_VERSION=v1.15.0
35TTSIM_WH_PIN=e2a56ffe04072a10d477db1ef85cdbd5d392d9fc52043bb949b90a4c01ff6b4f
36TTSIM_BH_PIN=2367dccc964c0ce4a20b14520e5f7ac6191bb227fb20e87aca1e94bf7432ced2
37TTSIM_DIR=${TTSIM_DIR:-build/oracle/ttsim-$TTSIM_VERSION}
38GNU=${RISCV_OBJDUMP:-riscv64-unknown-elf-objdump}
39OBJCOPY=${RISCV_OBJCOPY:-riscv64-unknown-elf-objcopy}
40LLVM=${LLVM_OBJDUMP:-/usr/lib/llvm-18/bin/llvm-objdump}
41QEMU=${QEMU_RISCV32:-qemu-riscv32}
42PY=${PYTHON:-python3}
43have() { command -v "$1" >/dev/null 2>&1; }
44
45[ "$(uname -m)" = aarch64 ] || { say "NOT_RUN asm2.bin is an AArch64 Linux program"; exit 3; }
46[ -f "$ASM" ] && [ "$(sha "$ASM")" = "$ASM_PIN" ] || { say "FAIL assembler $ASM pin differs"; exit 1; }
47say "SOURCE $(git rev-parse HEAD 2>/dev/null || echo unknown)"
48say "COMPILER $ASM sha256=$ASM_PIN (unchanged rung-2 assembler); $OMC sha256=$(sha "$OMC" 2>/dev/null) (pin $OMC_PIN; builds irrv32.om)"
49say "TABLE $TAB sha256=$(sha "$TAB") entries=$(grep -c '^= ' "$TAB")"
50say "PLATFORM $(uname -srm)"
51
52# ---- 1. assemble twice; both builds must be identical and equal the committed vecadd.bin ----
53asm() { cat "$TAB" "$@" | nice -n 19 "$ASM"; }
54build() { # name listing...
55 n=$1
56 shift
57 asm "$@" > "$B/$n.bin" 2> "$B/$n.err" || { bad "asm2 refused $n: $(cat "$B/$n.err")"; return; }
58 asm "$@" > "$B/$n.again.bin" 2>/dev/null
59 cmp -s "$B/$n.bin" "$B/$n.again.bin" && ok "determinism $n ($(wc -c < "$B/$n.bin") bytes, sha256=$(sha "$B/$n.bin"))" ||
60 bad "determinism $n: two builds differ"
61}
62build vecadd $R/vecadd.s2
63build tt $R/boot-tt.s2 $R/vecadd.s2
64build qemu $R/boot-qemu.s2 $R/vecadd.s2
65build edges $R/edges.s2
66cmp -s "$B/vecadd.bin" $R/vecadd.bin && ok "vecadd.bin equals the committed bytes" || bad "vecadd.bin differs from committed $R/vecadd.bin"
67dd if="$B/tt.bin" bs=4 skip=9 2>/dev/null | cmp -s - "$B/vecadd.bin" && ok "tt image = boot-tt (36 bytes) + vecadd" || bad "tt image tail is not vecadd"
68dd if="$B/qemu.bin" bs=4 skip=15 2>/dev/null | cmp -s - "$B/vecadd.bin" && ok "qemu image = boot-qemu (60 bytes) + vecadd" || bad "qemu image tail is not vecadd"
69
70# Fixtures: little-endian uint32 words; expect = (a + b) mod 2^32, computed with Wolfram (see README).
71for f in a b expect; do xxd -r -p $R/$f.hex > "$B/$f.bin"; done
72N=$(grep -c . $R/a.hex)
73for f in a b expect; do
74 [ "$(wc -c < "$B/$f.bin")" -eq $((4 * N)) ] || bad "$f.hex does not hold $N words"
75done
76say "FIXTURE n=$N a=$(sha "$B/a.bin") b=$(sha "$B/b.bin") expect=$(sha "$B/expect.bin")"
77xxd -r -p $R/mix-expect.hex > "$B/mix-expect.bin"
78[ "$(wc -c < "$B/mix-expect.bin")" -eq $((4 * N)) ] || bad "mix-expect.hex does not hold $N words"
79
80# ---- 1b. seeded Omega path: omc builds irrv32.om; irrv32 lifts a scalar unit's OSC IR v1 ----
81# into the elementwise RV32 loop. The kernel bytes come from Omega; the checkers stay oracles.
82omir() { { printf 'ir\n'; cat "$1"; } | nice -n 19 "$OMC" > "$2" 2> "$2.err"; }
83OM_OK=
84if [ ! -x "$OMC" ]; then
85 nr "seeded Omega path: $OMC absent"
86elif [ "$(sha "$OMC")" != "$OMC_PIN" ]; then
87 bad "compiler $OMC pin differs"
88elif ! nice -n 19 "$OMC" < $R/irrv32.om > "$B/irrv32" 2> "$B/irrv32.err"; then
89 bad "omc refused irrv32.om: $(cat "$B/irrv32.err")"
90else
91 nice -n 19 "$OMC" < $R/irrv32.om > "$B/irrv32.again"
92 cmp -s "$B/irrv32" "$B/irrv32.again" && ok "determinism omc irrv32.om ($(wc -c < "$B/irrv32") bytes, sha256=$(sha "$B/irrv32"))" ||
93 bad "determinism: two omc builds of irrv32.om differ"
94 chmod +x "$B/irrv32"
95 OM_OK=1
96 for u in vecadd mix; do
97 if omir $R/$u.unit.om "$B/$u.ir" && "$B/irrv32" < "$B/$u.ir" > "$B/om-$u.bin" 2> "$B/om-$u.err"; then
98 "$B/irrv32" < "$B/$u.ir" > "$B/om-$u.again.bin"
99 cmp -s "$B/om-$u.bin" "$B/om-$u.again.bin" && ok "determinism irrv32 $u.unit.om ($(wc -c < "$B/om-$u.bin") bytes, sha256=$(sha "$B/om-$u.bin"), IR sha256=$(sha "$B/$u.ir"))" ||
100 bad "determinism irrv32 $u: two emissions differ"
101 dd if="$B/tt.bin" bs=4 count=9 2>/dev/null | cat - "$B/om-$u.bin" > "$B/om-$u-tt.bin"
102 dd if="$B/qemu.bin" bs=4 count=15 2>/dev/null | cat - "$B/om-$u.bin" > "$B/om-$u-qemu.bin"
103 else
104 bad "irrv32 path refused $u.unit.om: $(cat "$B/$u.ir.err" "$B/om-$u.err" 2>/dev/null)"
105 OM_OK=
106 fi
107 done
108 [ -n "$OM_OK" ] && { cmp -s "$B/om-vecadd.bin" $R/vecadd.bin && ok "irrv32 vecadd output is byte-identical to the asm2 vecadd.bin" ||
109 bad "irrv32 vecadd differs from asm2 vecadd.bin: $(first_diff "$B/om-vecadd.bin" $R/vecadd.bin)"; }
110fi
111
112# ---- 2. two independent disassemblers ----
113dis_gnu() { "$GNU" -D -b binary -m riscv:rv32 -M no-aliases,numeric "$1" | grep -E '^ +[0-9a-f]+:' | cut -f3- | sed 's/ *#.*//; s/[[:space:]]*$//'; }
114dis_llvm() {
115 "$OBJCOPY" -I binary -O elf32-littleriscv -B riscv --rename-section .data=.text,code,alloc,load,contents "$1" "$1.o" &&
116 "$LLVM" -d -M no-aliases -M numeric --mattr=+m "$1.o" | grep -E '^ +[0-9a-f]+:' | cut -f2- | sed 's/ <.*//; s/[[:space:]]*$//'
117}
118# mnemonic followed by its register operands, in order (immediates are printed in different bases)
119regs() { tr ',()' ' ' | awk '{ s = $1; for (i = 2; i <= NF; i++) if ($i ~ /^x[0-9]+$/) s = s " " $i; print s }'; }
120if have "$GNU"; then
121 say "ORACLE gnu $("$GNU" --version | sed -n 1p)"
122 for p in vecadd edges; do
123 dis_gnu "$B/$p.bin" > "$B/$p.gnu"
124 diff "$B/$p.gnu" $R/$p.expect > "$B/$p.gnu.diff" && ok "GNU objdump $p: $(wc -l < "$B/$p.gnu") words match $p.expect (written by hand)" ||
125 bad "GNU objdump $p differs from $p.expect: $(sed -n 2,3p "$B/$p.gnu.diff" | tr '\n' ' ')"
126 done
127 grep '^ ' $R/edges.s2 | awk '{ print $1 }' > "$B/edges.names"
128 cut -f1 "$B/edges.gnu" | diff - "$B/edges.names" > /dev/null && ok "edges.s2 covers every table entry: $(sort -u "$B/edges.names" | wc -l) of $(grep -c '^= ' "$TAB") names" ||
129 bad "GNU mnemonics differ from the edges.s2 names"
130 [ "$(sort -u "$B/edges.names" | wc -l)" -eq "$(grep -c '^= ' "$TAB")" ] || bad "edges.s2 misses a table entry"
131else
132 nr "GNU objdump ($GNU) absent"
133fi
134if have "$GNU" && [ -n "$OM_OK" ]; then
135 dis_gnu "$B/om-mix.bin" > "$B/om-mix.gnu"
136 diff "$B/om-mix.gnu" $R/mix.expect > "$B/om-mix.gnu.diff" && ok "GNU objdump om-mix (CONST lui+addi, MOV, mul, xor): $(wc -l < "$B/om-mix.gnu") words match mix.expect (written by hand)" ||
137 bad "GNU objdump om-mix differs from mix.expect: $(sed -n 2,3p "$B/om-mix.gnu.diff" | tr '\n' ' ')"
138fi
139if have "$LLVM" && have "$OBJCOPY" && have "$GNU"; then
140 say "ORACLE llvm $("$LLVM" --version | grep -i 'llvm version' | sed 's/^ *//')"
141 for p in vecadd edges; do
142 dis_llvm "$B/$p.bin" > "$B/$p.llvm" || bad "LLVM objdump failed on $p"
143 regs < "$B/$p.llvm" > "$B/$p.llvm.regs"
144 regs < "$B/$p.gnu" > "$B/$p.gnu.regs"
145 cmp -s "$B/$p.llvm.regs" "$B/$p.gnu.regs" && ok "LLVM objdump $p: mnemonics and registers equal GNU's on all $(wc -l < "$B/$p.llvm") words" ||
146 bad "LLVM and GNU disagree on $p"
147 done
148else
149 nr "LLVM objdump ($LLVM) or objcopy ($OBJCOPY) absent"
150fi
151
152# ---- 3. execution oracles ----
153ttsim_run() { # arch image out
154 timeout 600 nice -n 19 "$PY" $R/oracle.py ttsim "$TTSIM_DIR/libttsim_$1_aarch64.so" "$1" "$2" \
155 "$B/a.bin" "$B/b.bin" "$N" "$3" > "$3.log" 2>&1
156}
157qemu_run() { # image out
158 "$PY" $R/oracle.py elf "$1" "$B/a.bin" "$B/b.bin" "$N" "$1.elf" && chmod +x "$1.elf" &&
159 timeout 60 nice -n 19 "$QEMU" "$1.elf" > "$2" 2> "$2.err"
160}
161ttsim_ok() { # arch: 0 when the pinned library is present
162 lib=$TTSIM_DIR/libttsim_$1_aarch64.so
163 eval "pin=\$TTSIM_$(echo "$1" | tr a-z A-Z)_PIN"
164 [ -f "$lib" ] && [ "$(sha "$lib")" = "$pin" ]
165}
166have "$PY" || nr "Python ($PY) absent; ttsim and qemu oracles skipped"
167TT_DONE=
168for arch in wh bh; do
169 if have "$PY" && ttsim_ok $arch; then
170 say "ORACLE ttsim $TTSIM_VERSION libttsim_${arch}_aarch64.so sha256=$(sha "$TTSIM_DIR/libttsim_${arch}_aarch64.so") driver oracle.py sha256=$(sha $R/oracle.py) $("$PY" --version 2>&1)"
171 if ttsim_run $arch "$B/tt.bin" "$B/out-$arch.bin" && cmp -s "$B/out-$arch.bin" "$B/expect.bin"; then
172 ok "ttsim $arch: $N of $N sums equal expect ($(grep '^ttsim' "$B/out-$arch.bin.log"))"
173 TT_DONE=$arch
174 else
175 bad "ttsim $arch: $(tail -n 1 "$B/out-$arch.bin.log") $(first_diff "$B/out-$arch.bin" "$B/expect.bin")"
176 fi
177 else
178 nr "ttsim $arch: $TTSIM_DIR/libttsim_${arch}_aarch64.so absent or not the pinned $TTSIM_VERSION build"
179 fi
180done
181Q_DONE=
182if have "$PY" && have "$QEMU"; then
183 say "ORACLE qemu $("$QEMU" --version | sed -n 1p)"
184 if qemu_run "$B/qemu.bin" "$B/out-qemu.bin" && cmp -s "$B/out-qemu.bin" "$B/expect.bin"; then
185 ok "qemu-riscv32: $N of $N sums equal expect"
186 Q_DONE=1
187 else
188 bad "qemu-riscv32: $(first_diff "$B/out-qemu.bin" "$B/expect.bin") $(cat "$B/out-qemu.bin.err" 2>/dev/null)"
189 fi
190else
191 nr "qemu-riscv32 ($QEMU) absent"
192fi
193# Seeded Omega kernels: the same boot stubs followed by irrv32's output.
194if [ -n "$OM_OK" ]; then
195 for u in vecadd mix; do
196 want=$B/expect.bin
197 [ $u = mix ] && want=$B/mix-expect.bin
198 for arch in wh bh; do
199 if have "$PY" && ttsim_ok $arch; then
200 if ttsim_run $arch "$B/om-$u-tt.bin" "$B/om-$u-$arch.out" && cmp -s "$B/om-$u-$arch.out" "$want"; then
201 ok "ttsim $arch on Omega-emitted $u: $N of $N words equal $(basename "$want") ($(grep '^ttsim' "$B/om-$u-$arch.out.log"))"
202 else
203 bad "ttsim $arch on Omega-emitted $u: $(tail -n 1 "$B/om-$u-$arch.out.log") $(first_diff "$B/om-$u-$arch.out" "$want")"
204 fi
205 else
206 nr "ttsim $arch on Omega-emitted $u (library absent)"
207 fi
208 done
209 if have "$PY" && have "$QEMU"; then
210 if qemu_run "$B/om-$u-qemu.bin" "$B/om-$u-qemu.out" && cmp -s "$B/om-$u-qemu.out" "$want"; then
211 ok "qemu-riscv32 on Omega-emitted $u: $N of $N words equal $(basename "$want")"
212 else
213 bad "qemu-riscv32 on Omega-emitted $u: $(first_diff "$B/om-$u-qemu.out" "$want") $(cat "$B/om-$u-qemu.out.err" 2>/dev/null)"
214 fi
215 else
216 nr "qemu-riscv32 on Omega-emitted $u (absent)"
217 fi
218 done
219fi
220
221# ---- 4. negative controls: each mutation must be caught ----
222mutate() { # sed-expr in out: the edit must change the file
223 sed "$1" "$2" > "$3"
224 ! cmp -s "$2" "$3" || { bad "control edit '$1' did not change $2"; return 1; }
225}
226# C1: one bit flipped in the table (add's funct7 bit 30: add becomes sub).
227if mutate 's/^= add 0x00000033/= add 0x40000033/' "$TAB" "$B/c1.tbl"; then
228 cat "$B/c1.tbl" $R/vecadd.s2 | "$ASM" > "$B/c1.bin"
229 if have "$GNU"; then
230 dis_gnu "$B/c1.bin" | cmp -s - $R/vecadd.expect && bad "C1 table bit flip not seen by GNU objdump" ||
231 ok "C1 table bit flip (add->sub) caught by GNU objdump"
232 fi
233 if [ -n "$TT_DONE" ]; then
234 cat "$B/c1.tbl" $R/boot-tt.s2 $R/vecadd.s2 | "$ASM" > "$B/c1-tt.bin"
235 ttsim_run "$TT_DONE" "$B/c1-tt.bin" "$B/c1-out.bin"
236 cmp -s "$B/c1-out.bin" "$B/expect.bin" && bad "C1 table bit flip not seen by ttsim $TT_DONE" ||
237 ok "C1 table bit flip caught by ttsim $TT_DONE ($(first_diff "$B/c1-out.bin" "$B/expect.bin"))"
238 else
239 nr "C1 on ttsim (no ttsim run)"
240 fi
241fi
242# C2: one wrong expected value (last word) must fail against the real ttsim/qemu output.
243sed '$ s/^../00/' $R/expect.hex | xxd -r -p > "$B/c2-expect.bin"
244GOOD=
245[ -n "$TT_DONE" ] && GOOD=$B/out-$TT_DONE.bin
246[ -z "$GOOD" ] && [ -n "$Q_DONE" ] && GOOD=$B/out-qemu.bin
247if [ -n "$GOOD" ]; then
248 cmp -s "$GOOD" "$B/c2-expect.bin" && bad "C2 wrong expected value accepted" ||
249 ok "C2 wrong expected value caught ($(first_diff "$GOOD" "$B/c2-expect.bin"))"
250else
251 nr "C2 (no executed output)"
252fi
253# C3: wrong register in the listing (add t2,t0,t0) must change qemu's output.
254if mutate 's/^ add 7 5 6 / add 7 5 5 /' $R/vecadd.s2 "$B/c3.s2"; then
255 if [ -n "$Q_DONE" ]; then
256 asm $R/boot-qemu.s2 "$B/c3.s2" > "$B/c3.bin"
257 qemu_run "$B/c3.bin" "$B/c3-out.bin"
258 cmp -s "$B/c3-out.bin" "$B/expect.bin" && bad "C3 wrong register not seen by qemu" ||
259 ok "C3 wrong register caught by qemu-riscv32 ($(first_diff "$B/c3-out.bin" "$B/expect.bin"))"
260 else
261 nr "C3 (no qemu run)"
262 fi
263fi
264# C4: one branch-offset piece wrong (bne imm[11]) must stop ttsim from finishing correctly.
265if mutate 's/^ bne 13 0 -1 63 0 1 / bne 13 0 -1 63 0 0 /' $R/vecadd.s2 "$B/c4.s2"; then
266 if [ -n "$TT_DONE" ]; then
267 asm $R/boot-tt.s2 "$B/c4.s2" > "$B/c4.bin"
268 if ttsim_run "$TT_DONE" "$B/c4.bin" "$B/c4-out.bin" && cmp -s "$B/c4-out.bin" "$B/expect.bin"; then
269 bad "C4 wrong branch offset not seen by ttsim $TT_DONE"
270 else
271 ok "C4 wrong branch offset caught by ttsim $TT_DONE ($(tail -n 1 "$B/c4-out.bin.log"))"
272 fi
273 else
274 nr "C4 (no ttsim run)"
275 fi
276fi
277# C5: an immediate outside its 12-bit field must be refused by asm2.
278if mutate 's/^ lw 5 10 0 / lw 5 10 2048 /' $R/vecadd.s2 "$B/c5.s2"; then
279 asm "$B/c5.s2" > "$B/c5.bin" 2> "$B/c5.err" && bad "C5 out-of-range immediate accepted by asm2" ||
280 ok "C5 out-of-range immediate refused by asm2 ($(sed -n 1p "$B/c5.err"))"
281fi
282# C6: the scalar unit mutated (add -> sub) must change irrv32's bytes and ttsim's output.
283if [ -n "$OM_OK" ] && mutate 's/^ret add a b$/ret sub a b/' $R/vecadd.unit.om "$B/c6.unit.om"; then
284 omir "$B/c6.unit.om" "$B/c6.ir" && "$B/irrv32" < "$B/c6.ir" > "$B/c6.bin"
285 cmp -s "$B/c6.bin" $R/vecadd.bin && bad "C6 mutated unit gave the vecadd bytes" ||
286 ok "C6 mutated unit (add->sub) changes irrv32 output ($(first_diff "$B/c6.bin" $R/vecadd.bin))"
287 if [ -n "$TT_DONE" ]; then
288 dd if="$B/tt.bin" bs=4 count=9 2>/dev/null | cat - "$B/c6.bin" > "$B/c6-tt.bin"
289 ttsim_run "$TT_DONE" "$B/c6-tt.bin" "$B/c6-out.bin"
290 cmp -s "$B/c6-out.bin" "$B/expect.bin" && bad "C6 mutated unit not seen by ttsim $TT_DONE" ||
291 ok "C6 mutated unit caught by ttsim $TT_DONE ($(first_diff "$B/c6-out.bin" "$B/expect.bin"))"
292 else
293 nr "C6 on ttsim (no ttsim run)"
294 fi
295elif [ -z "$OM_OK" ]; then
296 nr "C6 (seeded Omega path did not run)"
297fi
298# C7: the emitter mutated (pointer a0 stride 4 -> 8) must change the kernel that qemu runs.
299if [ -n "$OM_OK" ] && mutate 's/^itype 4 10 0 10 19$/itype 8 10 0 10 19/' $R/irrv32.om "$B/c7.om"; then
300 if "$OMC" < "$B/c7.om" > "$B/c7-irrv32" && chmod +x "$B/c7-irrv32" && "$B/c7-irrv32" < "$B/vecadd.ir" > "$B/c7.bin"; then
301 if [ -n "$Q_DONE" ]; then
302 dd if="$B/qemu.bin" bs=4 count=15 2>/dev/null | cat - "$B/c7.bin" > "$B/c7-qemu.bin"
303 qemu_run "$B/c7-qemu.bin" "$B/c7-out.bin"
304 cmp -s "$B/c7-out.bin" "$B/expect.bin" && bad "C7 mutated emitter not seen by qemu" ||
305 ok "C7 mutated emitter (stride 8) caught by qemu-riscv32 ($(first_diff "$B/c7-out.bin" "$B/expect.bin"))"
306 else
307 nr "C7 (no qemu run)"
308 fi
309 else
310 bad "C7 mutated emitter did not build or run"
311 fi
312elif [ -z "$OM_OK" ]; then
313 nr "C7 (seeded Omega path did not run)"
314fi
315# C8: a unit irrv32 cannot lower faithfully (div traps on zero in Omega) must be refused, no bytes out.
316if [ -n "$OM_OK" ] && mutate 's/^ret add a b$/ret div a b/' $R/vecadd.unit.om "$B/c8.unit.om"; then
317 omir "$B/c8.unit.om" "$B/c8.ir"
318 "$B/irrv32" < "$B/c8.ir" > "$B/c8.bin" 2> "$B/c8.err"
319 rc=$?
320 [ "$rc" -ne 0 ] && [ ! -s "$B/c8.bin" ] && ok "C8 div unit refused by irrv32 (exit $rc, $(cat "$B/c8.err"), 0 bytes)" ||
321 bad "C8 div unit not refused (exit $rc, $(wc -c < "$B/c8.bin") bytes)"
322elif [ -z "$OM_OK" ]; then
323 nr "C8 (seeded Omega path did not run)"
324fi
325
326sha256sum $R/* "$ASM" "$OMC" > "$B/SHA256SUMS" 2>/dev/null
327if [ "$fails" -gt 0 ]; then
328 say "RESULT FAIL ($fails failed, $notrun not run)"
329 exit 1
330fi
331if [ "$notrun" -gt 0 ]; then
332 say "RESULT NOT_RUN ($notrun checks could not run; nothing failed)"
333 exit 3
334fi
335say "RESULT PASS (interop oracles, not Omega-native; no Tenstorrent hardware was used)"
336exit 0