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 / docs / campaigns / cand4-qualification / build-cpu-fault.sh

63 lines · 4354 bytes Raw Blame History
1#!/usr/bin/env 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# CAND-4 qualification: the `cpu-fault` test binary for Q2 (ACCEPTANCE-CAND4.md section 5).
18# Same recipe as NEXT-PHASE-2 (ACCEPTANCE-v2 section 4, receipt e401fffe build_env):
19# aien-cli release build with the composition archive linked, NO GPU archive, cargo
20# feature `fault-hold`; built with scripts/repro-build.sh (the release flags) from a
21# clean checkout of the frozen sovereign-core commit. Shell only.
22# Usage:
23# build-cpu-fault.sh SC_CHECKOUT OMEGA_DIR PHYSICS_DIR AIENOS_REPO OUT_DIR
24# SC_CHECKOUT must be clean; OMEGA_DIR HEAD must equal SC_CHECKOUT/omega.lock.
25# Writes OUT_DIR/aien-cli-cpu-fault, OUT_DIR/build-cpu-fault.json, OUT_DIR/build.log.
26set -u
27SCW=${1:?SC_CHECKOUT} OMW=${2:?OMEGA_DIR} PHW=${3:?PHYSICS_DIR} AO=${4:?AIENOS_REPO} OUT=${5:?OUT_DIR}
28mkdir -p "$OUT"; OUT=$(cd "$OUT" && pwd)
29SCW=$(cd "$SCW" && pwd); OMW=$(cd "$OMW" && pwd); PHW=$(cd "$PHW" && pwd); AO=$(cd "$AO" && pwd)
30die() { echo "build-cpu-fault: $*" >&2; exit 3; }
31[ -z "$(git -C "$SCW" status --porcelain --untracked-files=no)" ] || die "sovereign-core checkout not clean"
32pin=$(tr -d '[:space:]' <"$SCW/omega.lock")
33[ "$(git -C "$OMW" rev-parse HEAD)" = "$pin" ] || die "omega HEAD $(git -C "$OMW" rev-parse HEAD) != omega.lock $pin"
34[ -z "$(git -C "$OMW" status --porcelain --untracked-files=no)" ] || die "omega checkout not clean"
35T=$OUT/target
36export CARGO_HOME=${CARGO_HOME:-$OUT/cargo-home}
37(cd "$SCW" && cargo fetch --locked) >"$OUT/fetch.log" 2>&1 || die "cargo fetch failed (see $OUT/fetch.log)"
38(cd "$SCW" && env -u AIEN_DEV_FALLBACK -u AIEN_FORCE_CPU_STUB -u AIEN_OMEGA_DIR -u AIEN_OMEGA_GPU_LIB \
39 -u AIEN_OMEGA_COMPOSE_LIB -u AIEN_OMEGA_COMPOSE_SHA \
40 AIEN_OMEGA_COMPOSE_DIR="$OMW" AIEN_PHYSICS_DIR="$PHW" AIEN_AIENOS_LOCK_REPO="$AO" CARGO_TARGET_DIR="$T" \
41 bash scripts/repro-build.sh --offline -vv -p aien-cli --features aien-cli/fault-hold) >"$OUT/build.log" 2>&1
42rc=$?
43[ $rc = 0 ] || die "cargo build failed rc=$rc (see $OUT/build.log)"
44cp "$T/release/aien-cli" "$OUT/aien-cli-cpu-fault"
45B=$OUT/aien-cli-cpu-fault
46cnt() { strings -a "$B" | grep -c -- "$1"; }
47lib=$(find "$T/release/build" -path '*omega-compose-build/librx_compose.a' | head -1)
48jq -n --arg sc "$(git -C "$SCW" rev-parse HEAD)" --arg om "$pin" --arg ph "$(git -C "$PHW" rev-parse HEAD)" \
49 --arg sha "$(sha256sum "$B" | cut -d' ' -f1)" --arg lib "${lib:+$(sha256sum "$lib" | cut -d' ' -f1)}" \
50 --argjson c1 "$(cnt 'compose.candidate.0')" --argjson c2 "$(cnt 'compose.commit')" \
51 --argjson g "$(cnt 'NVIDIA_DGX_SPARK_GB10_SM121')" --argjson fh "$(cnt 'AIEN_FAULT_HOLD')" \
52 --argjson rp "$(cnt 'reconcile_panic')" --argjson re "$(cnt 'reconcile_error')" \
53 --argjson sw "$(grep -c 'building the stub' "$OUT/build.log")" \
54 --argjson hc "$(grep -c 'cargo:rustc-cfg=has_omega_compose' "$OUT/build.log")" \
55 --argjson hg "$(grep -c 'cargo:rustc-cfg=has_omega_gpu' "$OUT/build.log")" \
56 '{name:"cpu-fault", sovereign_core:$sc, omega:$om, physics:$ph, sha256:$sha, librx_compose_sha256:$lib,
57 command:"scripts/repro-build.sh --offline -vv -p aien-cli --features aien-cli/fault-hold (AIEN_OMEGA_COMPOSE_DIR set; AIEN_OMEGA_DIR, AIEN_OMEGA_GPU_LIB, AIEN_OMEGA_COMPOSE_LIB, AIEN_OMEGA_COMPOSE_SHA, AIEN_FORCE_CPU_STUB, AIEN_DEV_FALLBACK unset)",
58 link_proof:{compose_markers:($c1 + $c2), gpu_markers:$g, fault_hold_strings:$fh, reconcile_panic_strings:$rp,
59 reconcile_error_strings:$re, stub_warning_lines:$sw, has_omega_compose_lines:$hc, has_omega_gpu_lines:$hg},
60 ok:(($c1 > 0) and ($c2 > 0) and $g == 0 and $fh > 0 and $rp > 0 and $re > 0 and $hc > 0 and $hg == 0)}' \
61 >"$OUT/build-cpu-fault.json"
62cat "$OUT/build-cpu-fault.json"
63jq -e .ok "$OUT/build-cpu-fault.json" >/dev/null