omega-helix
This project has not described itself yet.
Brought by drakestapleton
omega-helix / scripts / verify.sh
| 1 | #!/bin/sh |
| 2 | # Independent verification suite for Omega Helix. |
| 3 | # Runs all host-verifiable builds, CPU engine self-checks, Python f64 referee oracle |
| 4 | # cross-checks, OpenWALDO dataset & provenance negative controls, tool suites, SM121 |
| 5 | # SASS disassembly checks (when nvdisasm is available), and Lean 4 proofs (when lean |
| 6 | # is available). Does NOT touch the GB10 GPU hardware (safe outside a GPU window). |
| 7 | # |
| 8 | # Usage: |
| 9 | # sh scripts/verify.sh |
| 10 | # Env: |
| 11 | # OMC Path to seeded omc compiler (auto-detected if unset) |
| 12 | # OUT Build directory (default: ./build/verify) |
| 13 | set -eu |
| 14 | |
| 15 | here=$(cd "$(dirname "$0")/.." && pwd) |
| 16 | OUT=${OUT:-$here/build/verify} |
| 17 | mkdir -p "$OUT" |
| 18 | |
| 19 | OS=$(uname -s) |
| 20 | ARCH=$(uname -m) |
| 21 | echo "=== Omega Helix Independent Verification ($OS $ARCH) ===" |
| 22 | |
| 23 | is_omega_ng() { |
| 24 | cand=$1 |
| 25 | [ -n "$cand" ] && [ -x "$cand" ] || return 1 |
| 26 | hdr=$(printf '@ng front-ir\nfn main to int\nret 0\nend\n' | "$cand" 2>/dev/null | dd bs=1 count=6 2>/dev/null | tr -d '\0' || true) |
| 27 | [ "$hdr" = "OSC1IR" ] |
| 28 | } |
| 29 | |
| 30 | has_ng_backend() { |
| 31 | if [ -n "${NG:-}" ]; then |
| 32 | if is_omega_ng "$NG"; then return 0; fi |
| 33 | return 1 |
| 34 | fi |
| 35 | if is_omega_ng "$OUT/ng"; then |
| 36 | return 0 |
| 37 | fi |
| 38 | if [ -n "${OMEGA_MV:-}" ]; then |
| 39 | [ -f "$OMEGA_MV/seed/ng/src/ir.om" ] && [ -f "$OMEGA_MV/seed/ng/src/a64.om" ] |
| 40 | return $? |
| 41 | fi |
| 42 | for cand in \ |
| 43 | "$HOME/.local/bin/ng" \ |
| 44 | "$(command -v ng 2>/dev/null || true)" |
| 45 | do |
| 46 | if is_omega_ng "$cand"; then |
| 47 | return 0 |
| 48 | fi |
| 49 | done |
| 50 | for root in \ |
| 51 | "$HOME/workspace/omega-mv-macos" \ |
| 52 | "$HOME/canon/omega-mv" \ |
| 53 | "$here/../omega-mv" \ |
| 54 | "$here/../omega-mv-macos" |
| 55 | do |
| 56 | if [ -f "$root/seed/ng/src/ir.om" ] && [ -f "$root/seed/ng/src/a64.om" ]; then |
| 57 | return 0 |
| 58 | fi |
| 59 | done |
| 60 | return 1 |
| 61 | } |
| 62 | |
| 63 | echo "--- 1. Build native CPU, universal zero-cap engine, interchange & OpenWALDO ingestor ---" |
| 64 | if [ "$OS" = Darwin ]; then |
| 65 | OUT="$OUT" TARGET=macos sh "$here/scripts/build.sh" |
| 66 | if [ "$ARCH" = arm64 ] && has_ng_backend; then |
| 67 | OUT="$OUT" TARGET=macos-metal sh "$here/scripts/build.sh" |
| 68 | METAL_BIN="$OUT/ollm-metal" |
| 69 | else |
| 70 | METAL_BIN="" |
| 71 | fi |
| 72 | OUT="$OUT" TARGET=tok sh "$here/scripts/build.sh" |
| 73 | OUT="$OUT" TARGET=openwaldo sh "$here/scripts/build.sh" |
| 74 | OUT="$OUT" TARGET=univ sh "$here/scripts/build.sh" |
| 75 | OUT="$OUT" TARGET=interchange sh "$here/scripts/build.sh" |
| 76 | OUT="$OUT" TARGET=dna sh "$here/scripts/build.sh" |
| 77 | BIN="$OUT/ollm-macos" |
| 78 | elif [ "$ARCH" = x86_64 ] || [ "$ARCH" = amd64 ]; then |
| 79 | OUT="$OUT" TARGET=x86linux sh "$here/scripts/build.sh" |
| 80 | OUT="$OUT" TARGET=tok sh "$here/scripts/build.sh" |
| 81 | OUT="$OUT" TARGET=openwaldo sh "$here/scripts/build.sh" |
| 82 | OUT="$OUT" TARGET=univ sh "$here/scripts/build.sh" |
| 83 | OUT="$OUT" TARGET=interchange sh "$here/scripts/build.sh" |
| 84 | OUT="$OUT" TARGET=dna sh "$here/scripts/build.sh" |
| 85 | BIN="$OUT/ollm-x86linux" |
| 86 | if command -v ldd >/dev/null 2>&1; then |
| 87 | if ldd "$BIN" 2>&1 | grep -qiE 'libc|libcuda|cublas'; then |
| 88 | echo "ERROR: $BIN must be statically linked with zero CUDA/libc" >&2 |
| 89 | exit 1 |
| 90 | fi |
| 91 | echo "STATIC_ELF_ZERO_CUDA_OK" |
| 92 | fi |
| 93 | else |
| 94 | OUT="$OUT" TARGET=aarch64 sh "$here/scripts/build.sh" |
| 95 | OUT="$OUT" TARGET=gb10 sh "$here/scripts/build.sh" |
| 96 | OUT="$OUT" TARGET=x86linux sh "$here/scripts/build.sh" |
| 97 | OUT="$OUT" TARGET=x86efi sh "$here/scripts/build.sh" |
| 98 | OMC_TMP=${OMC:-$(command -v omc 2>/dev/null || ([ -x "$HOME/.local/bin/omc" ] && echo "$HOME/.local/bin/omc") || echo "$HOME/canon/omega-mv/seed/out/omc")} |
| 99 | if [ -f "${EFIRT:-$(dirname "$OMC_TMP")/../a64efi/efirt.om}" ]; then |
| 100 | OUT="$OUT" TARGET=a64efi sh "$here/scripts/build.sh" |
| 101 | else |
| 102 | echo "--- a64efi build skipped: efirt.om not present alongside standalone omc ---" |
| 103 | fi |
| 104 | OUT="$OUT" TARGET=tok sh "$here/scripts/build.sh" |
| 105 | OUT="$OUT" TARGET=wtrain sh "$here/scripts/build.sh" |
| 106 | OUT="$OUT" TARGET=openwaldo sh "$here/scripts/build.sh" |
| 107 | OUT="$OUT" TARGET=univ sh "$here/scripts/build.sh" |
| 108 | OUT="$OUT" TARGET=interchange sh "$here/scripts/build.sh" |
| 109 | OUT="$OUT" TARGET=dna sh "$here/scripts/build.sh" |
| 110 | OUT="$OUT" TARGET=dna-gb10 sh "$here/scripts/build.sh" |
| 111 | BIN="$OUT/ollm" |
| 112 | if command -v ldd >/dev/null 2>&1; then |
| 113 | if ldd "$OUT/ollm-gb10" 2>&1 | grep -qiE 'libc|libcuda|cublas'; then |
| 114 | echo "ERROR: ollm-gb10 must be statically linked with zero CUDA/libc" >&2 |
| 115 | exit 1 |
| 116 | fi |
| 117 | echo "STATIC_ELF_ZERO_CUDA_OK" |
| 118 | fi |
| 119 | fi |
| 120 | |
| 121 | echo "--- 2. End-to-end CPU smoke suite (adamck, gcheck, train, eval, BPE, kvcmp, DNA, loop) ---" |
| 122 | sh "$here/scripts/quickstart-cpu.sh" "$BIN" |
| 123 | |
| 124 | echo "--- 3. Python f64 referee oracle selftests & binary cross-checks ---" |
| 125 | python3 "$here/tests/oracle.py" selftest |
| 126 | python3 "$here/tests/oracle.py" selftest-v1 |
| 127 | |
| 128 | xdir=$(mktemp -d "${TMPDIR:-/tmp}/omega-helix-oracle.XXXXXX") |
| 129 | trap 'rm -rf "$xdir"' EXIT |
| 130 | python3 - "$xdir/raw.txt" <<'PY' |
| 131 | import sys |
| 132 | s = "Once upon a time there was a verifiable pure-Omega language model.\n<|endoftext|>\n" * 30 |
| 133 | open(sys.argv[1], "w", encoding="utf-8").write(s) |
| 134 | PY |
| 135 | python3 "$here/tests/oracle.py" xprep --ollm "$BIN" --data "$xdir/raw.txt" --outdir "$xdir" |
| 136 | python3 "$here/tests/oracle.py" xbase --ollm "$BIN" --train "$xdir/ollm-train.bin" --held "$xdir/ollm-held.bin" |
| 137 | python3 "$here/tests/oracle.py" xinit --ollm "$BIN" --cfg small |
| 138 | python3 "$here/tests/oracle.py" xgrad --ollm "$BIN" --data "$xdir/ollm-train.bin" --cfg small |
| 139 | python3 "$here/tests/oracle.py" xstep --ollm "$BIN" --data "$xdir/ollm-train.bin" --cfg small |
| 140 | python3 "$here/tests/oracle.py" xeval --ollm "$BIN" --held "$xdir/ollm-held.bin" --cfg small |
| 141 | |
| 142 | echo "--- 3b. Universal zero-cap engine oracle (llama/qwen2/qwen3/mistral/gemma/gpt/gelu/loop/u32/caps) ---" |
| 143 | python3 "$here/tests/oracle_universal.py" --bin "$OUT/ollm-univ" |
| 144 | |
| 145 | echo "--- 3c. Safetensors / GGUF v3 / CK01-03 upgrade interchange suite ---" |
| 146 | IX_BIN="$OUT/ollm-interchange" UNIV_BIN="$OUT/ollm-univ" LEGACY_BIN="$BIN" \ |
| 147 | python3 -W error::ResourceWarning "$here/tests/test_interchange.py" -v |
| 148 | |
| 149 | echo "--- 3c2. OLLMBF01 BF16 4B-8B streaming import, ollm-dna & Studio integration suite ---" |
| 150 | OLLM_INTERCHANGE_BIN="$OUT/ollm-interchange" OLLM_DNA_BIN="$OUT/ollm-dna" \ |
| 151 | python3 -W error::ResourceWarning "$here/tests/test_ollmbf01_dna.py" -v |
| 152 | |
| 153 | echo "--- 3c3. OLLMCK05 fast binary checkpoint & mmap cold-start suite ---" |
| 154 | OLLM_BIN="$BIN" OLLM_GB10_LIVE=0 OUT="$OUT" \ |
| 155 | python3 -W error::ResourceWarning "$here/tests/test_fast_ckpt.py" -v |
| 156 | |
| 157 | echo "--- 3d. Adaptive looped core (per-token exit & inter-pass messages) suite ---" |
| 158 | OLLM_BIN="$BIN" python3 -W error::ResourceWarning "$here/tests/test_adaptive_loop.py" |
| 159 | |
| 160 | echo "--- 3e. 8-Pillar Post-Tensor Runtime (SM121 SASS/Megakernel, Reversible, Rings/Arboris, Evo-JIT, Closed-Form SP, OMG) ---" |
| 161 | python3 -W error::ResourceWarning "$here/tests/test_gpu_ternary_sass.py" |
| 162 | python3 -W error::ResourceWarning "$here/tests/test_megakernel.py" |
| 163 | if [ "$ARCH" = aarch64 ] || [ "$OS" = Darwin ]; then |
| 164 | python3 -W error::ResourceWarning "$here/tests/test_reversible.py" |
| 165 | fi |
| 166 | python3 -W error::ResourceWarning "$here/tests/test_split_bypass.py" |
| 167 | python3 -W error::ResourceWarning "$here/tests/test_evo_jit.py" |
| 168 | python3 -W error::ResourceWarning "$here/tests/test_sp_closed_form.py" |
| 169 | python3 -W error::ResourceWarning "$here/tests/test_omg_graph.py" |
| 170 | OLLM_BIN="$BIN" OLLM_METAL_BIN="${METAL_BIN:-}" \ |
| 171 | python3 -W error::ResourceWarning "$here/tests/test_gpu_metal_macos.py" -v |
| 172 | |
| 173 | echo "--- 3f. Spiral-2048 Razor MoE, Full-APU Co-Execution Fabric & GB10 Scaling Suites ---" |
| 174 | OLLM_BIN="$BIN" python3 -W error::ResourceWarning "$here/tests/test_spiral_weave.py" -v |
| 175 | OLLM_BIN="$BIN" OLLM_GB10_LIVE=0 python3 -W error::ResourceWarning "$here/tests/test_apu_weave.py" -v |
| 176 | OLLM_BIN="$BIN" OLLM_GB10_LIVE=0 python3 -W error::ResourceWarning "$here/tests/test_gpu_spiral_gb10.py" -v |
| 177 | |
| 178 | echo "--- 3g. Serve continuous batching, shared-trunk KV prefix cache, 8K-32K context ---" |
| 179 | OLLM_GB10_LIVE=0 python3 -W error::ResourceWarning "$here/tests/test_serve_scaling.py" |
| 180 | |
| 181 | echo "--- 4. OpenWALDO dataset verifier, pure-Omega ingestor, multi-arch backend & BOM ---" |
| 182 | OLLM_WALDO_BIN="$OUT/ollm-waldo" OLLM_UNIV_BIN="$OUT/ollm-univ" \ |
| 183 | OLLM_INTERCHANGE_BIN="$OUT/ollm-interchange" OLLM_BIN="$BIN" \ |
| 184 | python3 -m unittest discover -s "$here/tools/openwaldo" -p "test_*.py" -v |
| 185 | |
| 186 | echo "--- 4b. Omega Studio, OpenWALDO catalog, installer CLI & SSE forge suite ---" |
| 187 | OLLM_WALDO_BIN="$OUT/ollm-waldo" OLLM_UNIV_BIN="$OUT/ollm-univ" \ |
| 188 | OLLM_INTERCHANGE_BIN="$OUT/ollm-interchange" OLLM_BIN="$BIN" \ |
| 189 | python3 -W error::ResourceWarning -m unittest discover -s "$here/tools/studio" -p "test_*.py" -v |
| 190 | OMEGA_HELIX_BIN_DIR="$OUT" "$here/bin/omega-helix" doctor --json >/dev/null |
| 191 | OMEGA_HELIX_BIN_DIR="$OUT" "$here/bin/omega-helix" catalog --search permissive --json >/dev/null |
| 192 | |
| 193 | echo "--- 4c. Sovereign Distillation Pipeline Network (OLLMDK01, verifiers, teachers, Studio API, CLI) ---" |
| 194 | OLLM_WALDO_BIN="$OUT/ollm-waldo" OLLM_UNIV_BIN="$OUT/ollm-univ" \ |
| 195 | OLLM_INTERCHANGE_BIN="$OUT/ollm-interchange" OLLM_BIN="$BIN" \ |
| 196 | python3 -W error::ResourceWarning -m unittest discover -s "$here/tools/distill" -p "test_*.py" -v |
| 197 | OMEGA_HELIX_BIN_DIR="$OUT" "$here/bin/omega-helix" distill probe --json >/dev/null |
| 198 | |
| 199 | echo "--- 4d. Sovereign Runtime Firewalls, Grammar Decoding, Sleep Cycle, Compile-Until-Green & HF Demo ---" |
| 200 | OLLM_WALDO_BIN="$OUT/ollm-waldo" OLLM_UNIV_BIN="$OUT/ollm-univ" \ |
| 201 | OLLM_INTERCHANGE_BIN="$OUT/ollm-interchange" OLLM_BIN="$BIN" \ |
| 202 | python3 -W error::ResourceWarning -m unittest discover -s "$here/tools/runtime" -p "test_*.py" -v |
| 203 | WORK="$xdir/demo10s" OUT="$OUT" sh "$here/scripts/demo-10s-wow.sh" >/dev/null |
| 204 | |
| 205 | echo "--- 4e. Sovereign Commons, Trust Audit, Memory Migration, Porting Kit, Leases & USB Bundle ---" |
| 206 | OLLM_BIN="$BIN" OMEGA_HELIX_BIN_DIR="$OUT" \ |
| 207 | python3 -W error::ResourceWarning -m unittest discover -s "$here/tools/commons" -p "test_*.py" -v |
| 208 | OMEGA_HELIX_BIN_DIR="$OUT" "$here/bin/omega-helix" verify --json >/dev/null |
| 209 | OUT="$OUT/verify30s" sh "$here/scripts/verify-30s.sh" >/dev/null |
| 210 | |
| 211 | if [ "$OS" = Linux ] && [ "$ARCH" = aarch64 ]; then |
| 212 | GSL_WORK="$xdir/gsl" sh "$here/tests/test_gpu_spec_loop.sh" build |
| 213 | GSL_WORK="$xdir/gsl" sh "$here/tests/test_gpu_spec_loop.sh" host |
| 214 | fi |
| 215 | |
| 216 | echo "--- 5. Combined experiment Python controls ---" |
| 217 | python3 -m unittest discover -s "$here/tools/combined/experiment" -p "test_*.py" -v |
| 218 | |
| 219 | if [ "$OS" = Linux ] && [ "$ARCH" = aarch64 ]; then |
| 220 | OMC_BIN=${OMC:-$(command -v omc 2>/dev/null || ([ -x "$HOME/.local/bin/omc" ] && echo "$HOME/.local/bin/omc") || echo "$HOME/canon/omega-mv/seed/out/omc")} |
| 221 | echo "--- 6. 165-task Omega coding benchmark integrity check ---" |
| 222 | "$OMC_BIN" < "$here/tools/bench/bench.om" > "$OUT/bench.tmp" |
| 223 | chmod +x "$OUT/bench.tmp" && mv -f "$OUT/bench.tmp" "$OUT/bench" |
| 224 | mkdir -p "$xdir/bench" |
| 225 | "$OUT/bench" check "$here/tools/bench/tasks.om" "$here/tools/bench/expect.txt" "$OMC_BIN" "$xdir/bench" |
| 226 | |
| 227 | if command -v jq >/dev/null 2>&1; then |
| 228 | echo "--- 7. Contrast tool build & replay ---" |
| 229 | make -C "$here/tools/contrast" OMC="$OMC_BIN" OUT="$OUT/omega-contrast" replay |
| 230 | if command -v xxd >/dev/null 2>&1; then |
| 231 | echo "--- 8. Controller tool build & replay ---" |
| 232 | OMC="$OMC_BIN" OUT="$OUT/omega-controller" bash "$here/tools/controller/build.sh" |
| 233 | OMC="$OMC_BIN" OUT="$OUT/omega-controller" bash "$here/tools/controller/replay.sh" |
| 234 | fi |
| 235 | fi |
| 236 | |
| 237 | NVDISASM=${NVDISASM:-$(command -v nvdisasm 2>/dev/null || echo /usr/local/cuda/bin/nvdisasm)} |
| 238 | if [ -x "$NVDISASM" ]; then |
| 239 | echo "--- 9. SM121 Blackwell SASS disassembly & GPR ceiling check (all 78 kernel slots) ---" |
| 240 | OMC="$OMC_BIN" OUT="$OUT/gpu-disasm" NVDISASM="$NVDISASM" sh "$here/tests/gpu-disasm.sh" --all |
| 241 | else |
| 242 | echo "--- 9. SM121 SASS disassembly: NOT_RUN (nvdisasm not installed) ---" |
| 243 | fi |
| 244 | fi |
| 245 | |
| 246 | if command -v lean >/dev/null 2>&1 || [ -x "$HOME/.elan/bin/lean" ]; then |
| 247 | echo "--- 10. Lean 4 proof check (tools/combined/experiment/Budget.lean) ---" |
| 248 | PATH="$HOME/.elan/bin:$PATH" lean "$here/tools/combined/experiment/Budget.lean" |
| 249 | else |
| 250 | echo "--- 10. Lean 4 proof check: NOT_RUN (lean not installed) ---" |
| 251 | fi |
| 252 | |
| 253 | echo "OMEGA_HELIX_VERIFY_ALL_PASS" |