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/tools/e1_manifest.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 / tools / e1_manifest.sh` 107 lines ยท 8070 bytes Raw Blame History 1 #!/bin/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 # e1_manifest.sh -- E1 candidate-to-main artifact equivalence manifest. 18 # 19 # tools/e1_manifest.sh --candidate SHA --main SHA [--physics-dir DIR] [--out FILE] 20 # 21 # The E1 chip campaign ran on one commit (the candidate); the squash merge is 22 # another (main). This tool does not claim the chip ran on main. It records, 23 # for every E1 artifact, the SHA-256 of the file's content at both commits 24 # (ABSENT when a commit lacks it), and whether they are equal. With 25 # --physics-dir it also rebuilds the four E1 chip binaries from the main tree 26 # with exactly the gcc lines of the gate scripts (named per entry) and records 27 # their SHA-256, so a reviewer can compare them with the binary digests the 28 # chip receipts carry. Read-only on git; writes only the manifest. 29 # 30 # Artifact classes: 31 # chip compiled into a chip binary or run as a chip gate script; must be equal 32 # host host-side build system or host tests; may differ only if the host 33 # tier was rerun on main (tools/e1_combine.sh enforces this) 34 # 35 # Shell + git + coreutils + jq + gcc. No Python. 36 set -u 37 HERE=$(cd -P "$(dirname "$0")/.." && pwd) 38 CAND= MAIN= PHYS= OUT= 39 while [ $# -gt 0 ]; do 40 case $1 in 41 --candidate) CAND=$2; shift 2;; 42 --main) MAIN=$2; shift 2;; 43 --physics-dir) PHYS=$2; shift 2;; 44 --out) OUT=$2; shift 2;; 45 *) echo "usage: $0 --candidate SHA --main SHA [--physics-dir DIR] [--out FILE]" >&2; exit 2;; 46 esac 47 done 48 [[ $CAND =~ ^[0-9a-f]{40}$ && $MAIN =~ ^[0-9a-f]{40}$ ]] || { echo "candidates must be full 40-hex SHAs" >&2; exit 2; } 49 cd "$HERE" || exit 2 50 git cat-file -e "$CAND^{commit}" 2>/dev/null || { echo "unknown commit $CAND" >&2; exit 2; } 51 git cat-file -e "$MAIN^{commit}" 2>/dev/null || { echo "unknown commit $MAIN" >&2; exit 2; } 52 53 # Chip-class patterns: sources of the four chip binaries (Gate 5, reduce, ldst, 54 # transc), the chip gate scripts and manifests, the physics pin. Host-class: 55 # the Makefile and host-only tests the host tier runs. 56 CHIP_RE='^(src/omega_numeric.*|src/omega_blackwell_(codegen|encoder|matmul|qmd)\.[ch]|src/forge_realization\.[ch]|src/aegis_verification\.[ch]|src/sha256\.[ch]|src/omega_program_fp32\.[ch]|src/omega_unwritten_trap.*|tests/test_omega_numeric.*|tests/test_omega_reduce\.c|tests/test_omega_ldst_gb10\.c|tests/test_omega_divsqrt_gb10\.c|tests/numeric_oracle\.h|tests/tensor_reduce_multi_tests\.inc|tests/numeric_native/.*|tests/run_numeric_gates\.sh|tests/run_reduce_chip\.sh|tests/chip_run_transc_receipt_allowlist\.txt|tools/chip_run\.sh|tools/run_numeric_ldst_chip\.sh|tools/run_numeric_transc_gate\.sh|tools/run_divsqrt_gate\.sh|tools/run_unwritten_trap\.sh|tools/ldst_nvdisasm_check\.sh|tools/divsqrt_nvdisasm_check\.sh|tools/manifests/.*|physics\.lock)$' 57 HOST_RE='^(Makefile|mk/numeric-.*\.mk|mk/program-fp32\.mk|tests/test_omega_transc\.c|tests/test_numeric_lifecycle\.c|tests/test_omega_unwritten_trap\.c|tests/test_chip_run.*\.sh|tools/numeric_check_sweep\.sh|tools/divsqrt_check_sweep\.sh)$' 58 59 sha_at() { git cat-file -e "$1:$2" 2>/dev/null && git show "$1:$2" | sha256sum | cut -c1-64 || echo ABSENT; } 60 61 files=$( (git ls-tree -r --name-only "$CAND"; git ls-tree -r --name-only "$MAIN") | sort -u | grep -E "$CHIP_RE|$HOST_RE") 62 entries= n_eq=0 n_ne=0 chip_ne=0 63 for f in $files; do 64 a=$(sha_at "$CAND" "$f"); b=$(sha_at "$MAIN" "$f") 65 if echo "$f" | grep -Eq "$CHIP_RE"; then cls=chip; else cls=host; fi 66 if [ "$a" = "$b" ]; then eq=true; n_eq=$((n_eq+1)); else eq=false; n_ne=$((n_ne+1)); [ $cls = chip ] && chip_ne=$((chip_ne+1)); fi 67 entries+="${entries:+,}{\"path\":\"$f\",\"class\":\"$cls\",\"sha256_candidate\":\"$a\",\"sha256_main\":\"$b\",\"equal\":$eq}" 68 done 69 70 # Rebuild the four chip binaries from the main tree (gcc lines copied from the 71 # gate scripts; the source list of each is what the chip ran). 72 bins= 73 if [ -n "$PHYS" ]; then 74 [ -d "$PHYS/nvrm" ] || { echo "no physics tree at $PHYS" >&2; exit 2; } 75 [ "$(git rev-parse HEAD)" = "$MAIN" ] || { echo "checkout must be at --main $MAIN to rebuild" >&2; exit 2; } 76 [ -z "$(git status --porcelain --untracked-files=no)" ] || { echo "tracked files are modified; refusing to rebuild" >&2; exit 2; } 77 NV=$PHYS/third_party/nvidia-open-580.173.02 78 INC=(-Isrc -I"$PHYS/nvrm" -I"$PHYS/m16" -I"$NV/src/common/sdk/nvidia/inc" -I"$NV/kernel-open/common/inc" -I"$NV/kernel-open/nvidia-uvm" -I"$NV/src/nvidia/arch/nvalloc/unix/include") 79 FORGE="src/forge_realization.c src/aegis_verification.c src/omega_om_units.c $PHYS/forge/forge_descriptor.c $PHYS/forge/forge_realize.c $PHYS/sha256_clean.c $PHYS/nvrm/nvrm.c $PHYS/m16/m16_native.c" 80 BLK="src/omega_blackwell_codegen.c src/omega_blackwell_encoder.c src/omega_blackwell_matmul.c src/omega_blackwell_qmd.c" 81 TMPB=$(mktemp -d "${TMPDIR:-/tmp}/e1manifest.XXXXXX") || exit 2 82 trap 'rm -rf "$TMPB"' EXIT 83 build() { # NAME SOURCE_SCRIPT FLAGS... -- SOURCES... 84 local name=$1 script=$2; shift 2; local flags=() s 85 while [ "$1" != "--" ]; do flags+=("$1"); shift; done; shift 86 if gcc -std=gnu11 -O2 -Wall -Wextra -Werror -ffp-contract=off "${flags[@]}" "${INC[@]}" -o "$TMPB/$name" "$@" > "$TMPB/$name.log" 2>&1; then 87 s=$(sha256sum "$TMPB/$name" | cut -c1-64) 88 else s=BUILD_FAILED; fi 89 bins+="${bins:+,}{\"gate\":\"$name\",\"build_line_of\":\"$script\",\"sha256_main\":\"$s\"}" 90 } 91 # shellcheck disable=SC2086 92 build GATE5 tests/run_numeric_gates.sh -I"$PHYS/forge" -- tests/test_omega_numeric.c src/omega_numeric.c src/omega_numeric_gb10.c src/omega_numeric_divsqrt_gb10.c src/omega_numeric_provenance.c $BLK $FORGE 93 # shellcheck disable=SC2086 94 build REDUCE tests/run_reduce_chip.sh -I"$PHYS/forge" -- tests/test_omega_reduce.c src/omega_numeric_reduce.c src/omega_numeric_reduce_gb10.c src/omega_numeric.c src/omega_numeric_gb10.c src/omega_numeric_divsqrt_gb10.c src/omega_numeric_provenance.c $BLK $FORGE 95 # shellcheck disable=SC2086 96 build LDST tools/run_numeric_ldst_chip.sh -pthread -- tests/test_omega_ldst_gb10.c src/omega_numeric_ldst_gb10.c src/omega_numeric_divsqrt_gb10.c src/omega_numeric.c src/omega_numeric_provenance.c src/omega_blackwell_encoder.c src/omega_blackwell_codegen.c src/omega_blackwell_matmul.c src/omega_blackwell_qmd.c src/omega_om_units.c $PHYS/nvrm/nvrm.c $PHYS/m16/m16_native.c 97 # shellcheck disable=SC2086 98 build TRANSC tools/chip_run.sh+tools/manifests/numeric_transc.chiprun -fno-fast-math -pthread -- tests/test_omega_numeric_transc_gb10.c src/omega_numeric_divsqrt_gb10.c src/omega_numeric_transc.c src/omega_numeric.c src/omega_numeric_provenance.c src/omega_blackwell_encoder.c src/omega_blackwell_codegen.c src/omega_blackwell_matmul.c src/omega_blackwell_qmd.c src/omega_om_units.c $PHYS/nvrm/nvrm.c $PHYS/m16/m16_native.c 99 fi 100 101 body="{\"schema\":\"AIEN_E1_EQUIVALENCE_MANIFEST_V1\",\"candidate_git_commit\":\"$CAND\",\"main_git_commit\":\"$MAIN\"" 102 body+=",\"whole_tree_identical\":$([ "$(git rev-parse "$CAND^{tree}")" = "$(git rev-parse "$MAIN^{tree}")" ] && echo true || echo false)" 103 body+=",\"files_equal\":$n_eq,\"files_differ\":$n_ne,\"chip_files_differ\":$chip_ne,\"files\":[$entries]" 104 [ -z "$bins" ] || body+=",\"rebuilt_chip_binaries\":[$bins]" 105 body+=",\"timestamp_utc\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" 106 if [ -n "$OUT" ]; then printf '%s\n' "$body" | jq . > "$OUT" && echo "manifest: $OUT (equal=$n_eq differ=$n_ne chip_differ=$chip_ne)" 107 else printf '%s\n' "$body" | jq .; fi