interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / om / qwen-native / flash / build.sh

67 lines · 2912 bytes Raw Blame History
1#!/bin/sh
2# Usage: build.sh OUTPUT_DIRECTORY PINNED_FLASH_DIRECTORY.
3# Build tool only; the executables are static seeded Omega programs bound to the attested shards.
4set -eu
5[ "$#" = 2 ] || { echo "usage: build.sh OUTPUT_DIRECTORY MODEL38" >&2; exit 2; }
6mkdir -p "$1"
7out=$(cd "$1" && pwd)
8m38=$(cd "$2" && pwd)
9src=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
10work=$(mktemp -d "$out/build.XXXXXXXX")
11trap "rm -rf \"$work\"" EXIT
12cd "$src"
13OUT="$work/gpu" sh linear/build.sh >/dev/null
14cc=$work/gpu/omc
15store=${IPL_STORE:-$HOME/interplane-store-owner}/projects
16omega=c4bf9d002f7dc4aec66b2b719804d71316177ee4
17for f in http notls; do git --git-dir="$store/omega-mv/repo.git" show "$omega:seed/net/$f.om" > "$work/$f.om"; done
18{
19 echo om2
20 cat tokenizer/tokio.om ../vendor/sha256.om flash/checkpoint-pins.om flash/attest.om
21} > "$work/attest.om"
22"$cc" < "$work/attest.om" > "$work/attest" || { echo "compile failed: attest" >&2; exit 4; }
23chmod 755 "$work/attest"
24pids=""
25for p in 0:17 17:17 34:17 51:16 67:16 83:16 99:16 115:16; do
26 s=${p%:*}
27 c=${p#*:}
28 nice -n 19 "$work/attest" "$m38" "$s" "$c" > "$work/part-$s.om" &
29 pids="$pids $!"
30done
31fail=0
32for pid in $pids; do
33 if ! wait "$pid"; then fail=1; fi
34done
35[ "$fail" = 0 ] || { echo "shard attestation failed" >&2; exit 4; }
36{
37 echo "global qdiskpin ulong 917"
38 echo "fn qdisk38 to void"
39 for s in 0 17 34 51 67 83 99 115; do
40 cat "$work/part-$s.om"
41 rm "$work/part-$s.om"
42 done
43 echo "end"
44} > "$work/install.om"
45cat "$work/gpu/library.om" tokenizer/tokio.om ../vendor/json.om ../vendor/sha256.om \
46 tokenizer/model.om tokenizer/unicode.om tokenizer/unicode-data.om tokenizer/tokenizer.om \
47 blocks/math.om blocks/gdn.om blocks/attention.om "$work/install.om" flash/weights.om \
48 flash/profile.om flash/diskcheck.om flash/project.om flash/graph.om flash/common.om > "$work/model.om"
49cat "$work/model.om" flash/session.om flash/main.om > "$work/engine.om"
50cat "$work/model.om" "$work/http.om" "$work/notls.om" flash/serve.om > "$work/serve.om"
51for t in engine serve; do
52 "$cc" < "$work/$t.om" > "$work/flash-$t" || { echo "compile failed: $t" >&2; cp "$work/$t.om" "$out/$t.failed.om"; head -c 300 "$work/flash-$t" >&2; exit 4; }
53 chmod 755 "$work/flash-$t"
54 readelf -lWd "$work/flash-$t" > "$work/$t-elf.txt"
55 if grep -Eq "INTERP|DYNAMIC|NEEDED" "$work/$t-elf.txt"; then echo "foreign runtime dependency" >&2; exit 3; fi
56done
57rm "$work/model.om" "$work/http.om" "$work/notls.om"
58(cd "$work" && sha256sum attest.om attest install.om engine.om serve.om flash-engine flash-serve engine-elf.txt serve-elf.txt > SHA256SUMS)
59id=$(sha256sum "$work/flash-serve" | cut -c1-64)
60if [ -d "$out/$id" ]; then
61 (cd "$out/$id" && sha256sum --quiet -c SHA256SUMS)
62 cmp "$work/SHA256SUMS" "$out/$id/SHA256SUMS"
63else
64 rm -r "$work/gpu"
65 mv -T "$work" "$out/$id"
66fi
67printf "%s\n" "$out/$id"