Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/helix/ollm_factory/build-ollm-jit.sh # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / helix / ollm_factory / build-ollm-jit.sh` 100 lines ยท 4660 bytes Raw Blame History 1 #!/bin/sh 2 # seed/helix/ollm_factory/build-ollm-jit.sh 3 # Build dual-strand zero-CUDA Omega LLM CPU (`ollm`) and Proof-Carrying SM121 Evolutionary 4 # Training JIT (`ollm-helix-gb10`) binaries WITHOUT modifying any file under `train/omega-llm/native/`. 5 # 6 # Usage: 7 # sh seed/helix/ollm_factory/build-ollm-jit.sh OMC_A OMC_B OUT_DIR 8 set -eu 9 OMC_A=${1:?usage: build-ollm-jit.sh OMC_A OMC_B OUT_DIR} 10 OMC_B=${2:?usage: build-ollm-jit.sh OMC_A OMC_B OUT_DIR} 11 OUT=${3:?usage: build-ollm-jit.sh OMC_A OMC_B OUT_DIR} 12 mkdir -p "$OUT" 13 14 sha() { sha256sum "$1" | cut -d' ' -f1; } 15 16 COMMON="si/directives/om2.om \ 17 train/omega-llm/native/net/http.om \ 18 train/omega-llm/native/net/json.om \ 19 train/omega-llm/native/net/jsonw.om \ 20 train/omega-llm/native/math.om \ 21 train/omega-llm/native/data.om \ 22 train/omega-llm/native/lpool.om \ 23 train/omega-llm/native/model.om \ 24 train/omega-llm/native/adam.om \ 25 train/omega-llm/native/ckpt.om \ 26 train/omega-llm/native/bpe.om \ 27 train/omega-llm/native/spec.om \ 28 train/omega-llm/native/cli.om \ 29 train/omega-llm/native/lio.om \ 30 train/omega-llm/native/serve.om" 31 32 # 1. Dual-strand CPU `ollm` (bit-for-bit identical across Strand A & Strand B) 33 cat $COMMON train/omega-llm/native/nogpu.om > "$OUT/ollm_cpu.om" 34 "$OMC_A" < "$OUT/ollm_cpu.om" > "$OUT/ollm.A" 35 "$OMC_B" < "$OUT/ollm_cpu.om" > "$OUT/ollm.B" 36 cmp -s "$OUT/ollm.A" "$OUT/ollm.B" || { echo "FAIL: ollm diverged across strands" >&2; exit 1; } 37 mv "$OUT/ollm.A" "$OUT/ollm" 38 rm -f "$OUT/ollm.B" 39 chmod +x "$OUT/ollm" 40 printf 'PASS ollm dual-strand identical (%s, %s bytes)\n' "$(sha "$OUT/ollm")" "$(wc -c < "$OUT/ollm" | tr -d ' ')" 41 42 # 2. Prepare clean non-invasive hooks for `ollm-helix-gb10`: 43 # - strip `hxEvolveQ36Buf` from `seed/helix/helix_jit.om` so `helix_jit_core.om` has zero q36 references 44 # - hook `otjRecSlot id` at the end of `gkemitb`, `gkemit`, and `grall` slot loop 45 # - hook `otjEvolveAll` right before `mapwrite get gbmem 4 0 gkcode 0 `1048576`` in `gkopen` 46 awk '/^fn hxEvolveQ36Buf/{exit} {print}' seed/helix/helix_jit.om | sed 's/\bow\b/hxow/g' > "$OUT/helix_jit_core.om" 47 48 awk ' 49 /^put gkthr id 128$/ { print "otjRecSlot id"; print; next } 50 /^put gkthr id 64$/ { print "otjRecSlot id"; print; next } 51 /^r = mapwrite get gbmem 4 0 gkcode 0 `1048576`$/ { print "otjEvolveAll"; print; next } 52 { print } 53 ' train/omega-llm/native/gpu/gk.om > "$OUT/gk_hx.om" 54 55 awk ' 56 /^put gkthr id 64$/ { print "otjRecSlot id"; print; next } 57 { print } 58 ' train/omega-llm/native/gpu/gr.om > "$OUT/gr_hx.om" 59 60 # Verify hooks actually fired cleanly (fail-closed!) 61 grep -q "otjEvolveAll" "$OUT/gk_hx.om" || { echo "FAIL: gkopen hook did not match" >&2; exit 1; } 62 grep -q "otjRecSlot id" "$OUT/gr_hx.om" || { echo "FAIL: grall hook did not match" >&2; exit 1; } 63 64 # 3. Compose `ollm-helix-gb10`: place `bw_hazard.om` + `helix_jit_core.om` + `ollm_train_jit.om` 65 # right after `gk.om`'s global declarations? No: `otjRecSlot` reads `gkat` and `otjEvolveAll` 66 # reads `gkcode`, so put `gk_globals`? Better: `gk_hx.om` calls `otjRecSlot`/`otjEvolveAll`, 67 # so declare `gkcode` & `gkat`? Wait: in OM-2 functions can be called before definition! 68 # Only globals must be declared before use! Placing `ollm_train_jit.om` AFTER `gk_hx.om` 69 # guarantees `gkcode` and `gkat` are already declared AND OM-2 allows forward calls to `otjRecSlot`/`otjEvolveAll`! 70 cat $COMMON \ 71 train/omega-llm/native/gpu/context.om \ 72 train/omega-llm/native/gpu/vector.om \ 73 train/omega-llm/native/gpu/launch.om \ 74 train/omega-llm/native/gpu/batch.om \ 75 gpu/nvidia/om/codegen/bw_hazard.om \ 76 "$OUT/helix_jit_core.om" \ 77 "$OUT/gk_hx.om" \ 78 seed/helix/ollm_factory/ollm_train_jit.om \ 79 "$OUT/gr_hx.om" \ 80 train/omega-llm/native/gpu/gb.om \ 81 train/omega-llm/native/gpu/gg.om > "$OUT/ollm_helix_gb10.om" 82 83 "$OMC_A" < "$OUT/ollm_helix_gb10.om" > "$OUT/ollm-helix-gb10.A" 84 "$OMC_B" < "$OUT/ollm_helix_gb10.om" > "$OUT/ollm-helix-gb10.B" 85 cmp -s "$OUT/ollm-helix-gb10.A" "$OUT/ollm-helix-gb10.B" || { echo "FAIL: ollm-helix-gb10 diverged across strands" >&2; exit 1; } 86 mv "$OUT/ollm-helix-gb10.A" "$OUT/ollm-helix-gb10" 87 rm -f "$OUT/ollm-helix-gb10.B" 88 chmod +x "$OUT/ollm-helix-gb10" 89 printf 'PASS ollm-helix-gb10 dual-strand identical (%s, %s bytes)\n' "$(sha "$OUT/ollm-helix-gb10")" "$(wc -c < "$OUT/ollm-helix-gb10" | tr -d ' ')" 90 91 # Confirm zero dynamic libraries on both ELFs 92 if command -v ldd >/dev/null 2>&1; then 93 for bin in "$OUT/ollm" "$OUT/ollm-helix-gb10"; do 94 out=$(ldd "$bin" 2>&1 || true) 95 case "$out" in 96 *"not a dynamic executable"*|*"statically linked"*) ;; 97 *) echo "FAIL: $bin is not a static zero-CUDA ELF: $out" >&2; exit 1 ;; 98 esac 99 done 100 fi