sovereign-intelligence
Front door to Drake Stapleton's sovereign stack.
Brought by drakestapleton
Comparing e659ab3defe05c03ac1dd6cb39f8aa4626b905b1 ... 6e44b5cfc22cf2b9ba2c3a185d4f51c0db1d69cd
- Pin the downloadable GB10 preview to its archive digest
- Install signed project history and local models together on DGX Spark
- Qualify pinned open-model weight rows on the detected host CPU
19 files changed, +703 -0
portable-pack/LICENSE.llama
| new file mode 100644 | ||
| @@ -0,0 +1,21 @@ | ||
| 1 | +MIT License | |
| 2 | + | |
| 3 | +Copyright (c) 2023-2026 The ggml authors | |
| 4 | + | |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | +of this software and associated documentation files (the "Software"), to deal | |
| 7 | +in the Software without restriction, including without limitation the rights | |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | +copies of the Software, and to permit persons to whom the Software is | |
| 10 | +furnished to do so, subject to the following conditions: | |
| 11 | + | |
| 12 | +The above copyright notice and this permission notice shall be included in all | |
| 13 | +copies or substantial portions of the Software. | |
| 14 | + | |
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 21 | +SOFTWARE. |
portable-pack/README.md
| new file mode 100644 | ||
| @@ -0,0 +1,13 @@ | ||
| 1 | +# Sovereign Intelligence Pack for GB10 | |
| 2 | + | |
| 3 | +This preview brings the signed local Interplane store, the Omega compiler, the first-party round40 model, local tool calls, and a GGUF inference backend together. It targets an NVIDIA DGX Spark with ARM64 Linux, NVIDIA drivers and CUDA 13 runtime libraries. The first install fetches pinned tools and Git histories from Interplane. Use an account with the foundation installer prerequisites, GNU tar, gzip, sha256sum and curl. | |
| 4 | + | |
| 5 | +Extract the archive and run `./sovereign-intelligence/install` as your user. The installed command is `~/.local/bin/si-pack`. Run `si-pack verify` to check the installed files and signed project history. Run `si-pack demo` for the first-party model's one-file tool example. The model reads a packaged fixture through the tool runner. It does not have access to arbitrary personal files. | |
| 6 | + | |
| 7 | +Use `si-pack attach /path/to/model.gguf` to serve a compatible local model on 127.0.0.1:8091 through the bundled llama.cpp interoperability runtime. It uses the CPU and stays offline. Ctrl-C stops that server. Set SI_PACK_PORT to choose a different port. The two weight files in adapter/models.tsv also trigger native Omega compilation and reference checking of one quantized row for the detected ARM CPU. This probe does not accelerate the GGUF server. Other model families, GPU kernel synthesis and end-to-end native retrofit remain in development. | |
| 8 | + | |
| 9 | +The installer keeps each pack in a content-identified directory under ~/.local/share/sovereign-intelligence. Upgrades switch the current link only after staging. Interplane project history and owner keys have their own locations. The foundation installer verifies its own components and preserves existing user commands. This preview has no system service. | |
| 10 | + | |
| 11 | +The GGUF backend is llama.cpp build 11188 at e85e15cf6. Its packaged binaries are pinned in runtime.sha256. Its CUDA-linked build needs the NVIDIA driver and CUDA 13 shared libraries on the host, including when serving on CPU. The native adapter compiler comes from the seed and patch documented in seed/PROVENANCE.md at the Sovereign Intelligence source revision. See LICENSE.llama, LICENSE.omega, NOTICE.omega and the licenses inside round40 and adapter. | |
| 12 | + | |
| 13 | +For this preview the checkpoint and model runners were tested on one GB10. The attached GGUF models were Qwen2.5 0.5B Instruct Q8_0 and a TinyStories Llama Q8_0 fixture. GGUF files the bundled runtime cannot load produce a startup error. Tool calls on this release are limited to the first-party model's bundled read-file demo. |
portable-pack/SHA256SUMS
| new file mode 100644 | ||
| @@ -0,0 +1 @@ | ||
| 1 | +daf88ced333426a82f8fb2ebfb73a30c08a7199651c95fbbc58cb0fd1c1514b3 sovereign-intelligence-gb10.tar.gz |
portable-pack/bootstrap.in
| new file mode 100644 | ||
| @@ -0,0 +1,19 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +# All operations are inside main. An interrupted pipe before the final call installs nothing. | |
| 3 | +main() ( | |
| 4 | + set -eu | |
| 5 | + umask 077 | |
| 6 | + if [ "$(uname -s)/$(uname -m)" != Linux/aarch64 ] || ! command -v nvidia-smi >/dev/null 2>&1; then | |
| 7 | + echo 'This Sovereign Intelligence preview requires an NVIDIA DGX Spark running ARM64 Linux.' >&2 | |
| 8 | + exit 2 | |
| 9 | + fi | |
| 10 | + [ "$(nvidia-smi --query-gpu=name --format=csv,noheader)" = 'NVIDIA GB10' ] || { echo 'This preview requires one NVIDIA GB10.' >&2; exit 2; } | |
| 11 | + tmp=$(mktemp -d) | |
| 12 | + trap 'rm -rf -- "$tmp"' EXIT | |
| 13 | + cd "$tmp" | |
| 14 | + curl --proto '=https' --proto-redir '=https' -fLsS --retry 3 '@ARCHIVE_URL@' -o pack.tar.gz | |
| 15 | + printf '%s pack.tar.gz\n' '@ARCHIVE_SHA256@' | sha256sum -c - | |
| 16 | + tar -xzf pack.tar.gz | |
| 17 | + sh sovereign-intelligence/install | |
| 18 | +) | |
| 19 | +main "$@" |
portable-pack/build
| new file mode 100755 | ||
| @@ -0,0 +1,38 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +set -euo pipefail | |
| 3 | +if [[ $# != 6 ]]; then | |
| 4 | + echo 'Usage: build ROUND40.tar.gz INSTALLER-GIT ADAPTER-GIT ADAPTER-OMC LLAMA-RUNTIME NEW-OUT.tar.gz' >&2 | |
| 5 | + exit 2 | |
| 6 | +fi | |
| 7 | +base=$(cd "$(dirname "$0")" && pwd) | |
| 8 | +out=$(realpath -m -- "$6") | |
| 9 | +tmp=$(mktemp -d) | |
| 10 | +trap 'rm -rf -- "$tmp"' EXIT | |
| 11 | +p=$tmp/sovereign-intelligence | |
| 12 | +mkdir -p "$p/chat-runtime" | |
| 13 | +cp -- "$1" "$tmp/model.tar.gz" | |
| 14 | +echo "1d7bc1c1b076de048ce5e026ca908edeb9e071b6679ba980cb6b6ba1237e5a7c $tmp/model.tar.gz" | sha256sum -c - | |
| 15 | +tar -xzf "$tmp/model.tar.gz" -C "$p" | |
| 16 | +mv "$p/omega-round40-gb10" "$p/round40" | |
| 17 | +installer=8be4c26c3b89bfbe72157344c0e3c76884f55e9e | |
| 18 | +adapter=54617926168301fc3d1def943cfa2ef1b79c161f | |
| 19 | +git init -qb main "$tmp/foundation" | |
| 20 | +git -C "$tmp/foundation" fetch -q "$(realpath -- "$2")" "$installer" | |
| 21 | +git -C "$tmp/foundation" update-ref refs/heads/main "$installer" | |
| 22 | +git -C "$tmp/foundation" bundle create "$p/foundation.bundle" main | |
| 23 | +git -C "$3" archive "$adapter" tools/adapter | tar -x -C "$p" | |
| 24 | +mv "$p/tools/adapter" "$p/adapter" | |
| 25 | +rmdir "$p/tools" | |
| 26 | +cp -- "$4" "$p/adapter-omc" | |
| 27 | +echo "45442c7d517fd605507bda5d1ec52493ff182661301cda69a95fc4f77dc6080d $p/adapter-omc" | sha256sum -c - | |
| 28 | +while read -r sum name; do cp -L -- "$5/$name" "$p/chat-runtime/$name"; done < "$base/runtime.sha256" | |
| 29 | +(cd "$p/chat-runtime" && sha256sum -c "$base/runtime.sha256") | |
| 30 | +cp "$base"/{LICENSE.llama,install,si-pack,README.md} "$p/" | |
| 31 | +cp "$base/../seed/NOTICE" "$p/NOTICE.omega" | |
| 32 | +cp "$base/../LICENSE" "$p/LICENSE.omega" | |
| 33 | +chmod +x "$p"/{install,si-pack,adapter-omc} | |
| 34 | +(cd "$p" && find . -type f ! -name PACK.sha256 -print0 | LC_ALL=C sort -z | xargs -0 sha256sum > PACK.sha256) | |
| 35 | +stage=$(mktemp "$(dirname "$out")/.si-pack.XXXXXXXX") | |
| 36 | +trap 'rm -rf -- "$tmp"; rm -f -- "$stage"' EXIT | |
| 37 | +tar --format=ustar --sort=name --mtime=@0 --mode='u+rwX,go+rX,go-w' --owner=0 --group=0 --numeric-owner -C "$tmp" -cf - sovereign-intelligence | gzip -n -1 > "$stage" | |
| 38 | +ln -T -- "$stage" "$out" |
portable-pack/install
| new file mode 100755 | ||
| @@ -0,0 +1,38 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +set -eu | |
| 3 | +umask 077 | |
| 4 | +root=$(CDPATH='' cd -P "$(dirname "$0")" && pwd) | |
| 5 | +[ "$(uname -s)/$(uname -m)" = Linux/aarch64 ] || { echo 'This preview requires ARM64 Linux.' >&2; exit 2; } | |
| 6 | +(cd "$root" && sha256sum --quiet -c PACK.sha256) | |
| 7 | +"$root/round40/model" --help >/dev/null | |
| 8 | +parent=$HOME/.local/share/sovereign-intelligence | |
| 9 | +bin=$HOME/.local/bin | |
| 10 | +mkdir -p "$parent" "$bin" | |
| 11 | +exec 9>"$parent/install.lock" | |
| 12 | +flock -x 9 | |
| 13 | +id=$(sha256sum "$root/PACK.sha256" | cut -d' ' -f1) | |
| 14 | +dest=$parent/$id | |
| 15 | +if [ -e "$bin/si-pack" ] || [ -L "$bin/si-pack" ]; then | |
| 16 | + [ "$(readlink "$bin/si-pack")" = "$parent/current/si-pack" ] || { echo 'An existing si-pack command belongs to another installation.' >&2; exit 1; } | |
| 17 | +fi | |
| 18 | +if [ -e "$parent/current" ] && [ ! -L "$parent/current" ]; then | |
| 19 | + echo 'The current path is already in use.' >&2; exit 1 | |
| 20 | +fi | |
| 21 | +stage=$(mktemp -d "$parent/.staging.XXXXXXXX") | |
| 22 | +trap 'rm -rf -- "$stage"' EXIT | |
| 23 | +if [ -d "$dest" ]; then | |
| 24 | + cmp "$root/PACK.sha256" "$dest/PACK.sha256" | |
| 25 | + (cd "$dest" && sha256sum --quiet -c PACK.sha256) | |
| 26 | +else | |
| 27 | + cp -a -- "$root/." "$stage/payload" | |
| 28 | + (cd "$stage/payload" && sha256sum --quiet -c PACK.sha256) | |
| 29 | +fi | |
| 30 | +git clone --quiet "$root/foundation.bundle" "$stage/foundation" | |
| 31 | +git -C "$stage/foundation" checkout --quiet --detach 8be4c26c3b89bfbe72157344c0e3c76884f55e9e | |
| 32 | +sh "$stage/foundation/install.sh" | |
| 33 | +if [ ! -d "$dest" ]; then mv -T "$stage/payload" "$dest"; fi | |
| 34 | +ln -s "$id" "$stage/current" | |
| 35 | +mv -Tf "$stage/current" "$parent/current" | |
| 36 | +if [ ! -L "$bin/si-pack" ]; then ln -s "$parent/current/si-pack" "$bin/si-pack"; fi | |
| 37 | +"$bin/si-pack" verify | |
| 38 | +printf 'Installed %s\nRun %s/demo using: %s demo\n' "$id" "$dest/round40" "$bin/si-pack" |
portable-pack/runtime.sha256
| new file mode 100644 | ||
| @@ -0,0 +1,9 @@ | ||
| 1 | +1f02fabe1e24167b03581f73ea0dbfda4b555939153a5ae750af2ee56f2b1c2a llama-server | |
| 2 | +b8a04ce046c6b8e6c59c9efd623831da95bbf397b1b5e19bf76f581bc4f824ec libllama-server-impl.so | |
| 3 | +b8449f31d6c8d0813c017f16d7c12f8f5df234616f871ce5ee08e79cc7781bee libllama-common.so.0 | |
| 4 | +dab5ae16d3313680fb4c4c0fbabef53986631543520fed7b6bbbedd240abf4c5 libmtmd.so.0 | |
| 5 | +78c85c7b1d97beb6f4f72d55d50e7f4cfef17f1fdb23efaabdd4afc8145f215e libllama.so.0 | |
| 6 | +aa9f0c2c02158ce183c29c3a00dfcb40c411ea684e55a6c1b8f8a1fa03e35be7 libggml.so.0 | |
| 7 | +0d4a83d2c56a83fcc66c1a93b9105308bf4192885bf76492a894c6d1b11db45c libggml-base.so.0 | |
| 8 | +0a777eed1b09a4f28fa6298e4132f28bd29edaa870070950ed573236c984a205 libggml-cpu.so.0 | |
| 9 | +991c8602b347f0a63f9a849825e4d04f32562534343354a1b68e8c8c415657f9 libggml-cuda.so.0 |
portable-pack/si-pack
| new file mode 100755 | ||
| @@ -0,0 +1,30 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +set -eu | |
| 3 | +# Resolve the installed command even when invoked through ~/.local/bin. | |
| 4 | +program=$(readlink -f -- "$0") | |
| 5 | +root=$(dirname -- "$program") | |
| 6 | +case "${1:-help}" in | |
| 7 | + demo) shift; exec "$root/round40/demo" "$@" ;; | |
| 8 | + model) shift; exec "$root/round40/model" "$@" ;; | |
| 9 | + verify) (cd "$root" && sha256sum --quiet -c PACK.sha256); exec "$HOME/.local/bin/interplane" verify ;; | |
| 10 | + qualify) shift; OMC="$root/adapter-omc" exec "$root/adapter/qualify" "$@" ;; | |
| 11 | + attach) | |
| 12 | + [ "$#" -eq 2 ] || { echo 'Usage: si-pack attach /path/to/model.gguf' >&2; exit 2; } | |
| 13 | + [ -f "$2" ] && [ -r "$2" ] || { echo 'A readable local GGUF file is required.' >&2; exit 2; } | |
| 14 | + model=$(realpath -- "$2") | |
| 15 | + bytes=$(stat -c %s -- "$model") | |
| 16 | + if awk -v n="$bytes" '$1 == n {known=1} END {exit !known}' "$root/adapter/models.tsv"; then | |
| 17 | + hash=$(sha256sum < "$model" | cut -d' ' -f1) | |
| 18 | + if awk -v h="$hash" '$2 == h {known=1} END {exit !known}' "$root/adapter/models.tsv"; then | |
| 19 | + OMC="$root/adapter-omc" "$root/adapter/qualify" "$model" | |
| 20 | + fi | |
| 21 | + fi | |
| 22 | + # Existing GGUF interoperability backend. Stay offline and on loopback. | |
| 23 | + export LD_LIBRARY_PATH="$root/chat-runtime" | |
| 24 | + export CUDA_VISIBLE_DEVICES=-1 | |
| 25 | + exec "$root/chat-runtime/llama-server" --offline -m "$model" --device none -ngl 0 \ | |
| 26 | + --host 127.0.0.1 --port "${SI_PACK_PORT:-8091}" -t 2 -c 512 --no-webui | |
| 27 | + ;; | |
| 28 | + help|--help|-h) echo 'si-pack demo | model | attach FILE.gguf | qualify FILE.gguf | verify' ;; | |
| 29 | + *) echo "Unknown command: $1" >&2; exit 2 ;; | |
| 30 | +esac |
portable-pack/si.sh
| new file mode 100644 | ||
| @@ -0,0 +1,19 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +# All operations are inside main. An interrupted pipe before the final call installs nothing. | |
| 3 | +main() ( | |
| 4 | + set -eu | |
| 5 | + umask 077 | |
| 6 | + if [ "$(uname -s)/$(uname -m)" != Linux/aarch64 ] || ! command -v nvidia-smi >/dev/null 2>&1; then | |
| 7 | + echo 'This Sovereign Intelligence preview requires an NVIDIA DGX Spark running ARM64 Linux.' >&2 | |
| 8 | + exit 2 | |
| 9 | + fi | |
| 10 | + [ "$(nvidia-smi --query-gpu=name --format=csv,noheader)" = 'NVIDIA GB10' ] || { echo 'This preview requires one NVIDIA GB10.' >&2; exit 2; } | |
| 11 | + tmp=$(mktemp -d) | |
| 12 | + trap 'rm -rf -- "$tmp"' EXIT | |
| 13 | + cd "$tmp" | |
| 14 | + curl --proto '=https' --proto-redir '=https' -fLsS --retry 3 'https://interplane.io/drakestapleton/sovereign-intelligence/releases/download/gb10-preview-20261118.1/sovereign-intelligence-gb10.tar.gz' -o pack.tar.gz | |
| 15 | + printf '%s pack.tar.gz\n' 'daf88ced333426a82f8fb2ebfb73a30c08a7199651c95fbbc58cb0fd1c1514b3' | sha256sum -c - | |
| 16 | + tar -xzf pack.tar.gz | |
| 17 | + sh sovereign-intelligence/install | |
| 18 | +) | |
| 19 | +main "$@" |
tools/adapter/LICENSE.ggml-omega
| new file mode 100644 | ||
| @@ -0,0 +1,218 @@ | ||
| 1 | + | |
| 2 | + Apache License | |
| 3 | + Version 2.0, January 2004 | |
| 4 | + http://www.apache.org/licenses/ | |
| 5 | + | |
| 6 | + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
| 7 | + | |
| 8 | + 1. Definitions. | |
| 9 | + | |
| 10 | + "License" shall mean the terms and conditions for use, reproduction, | |
| 11 | + and distribution as defined by Sections 1 through 9 of this document. | |
| 12 | + | |
| 13 | + "Licensor" shall mean the copyright owner or entity authorized by | |
| 14 | + the copyright owner that is granting the License. | |
| 15 | + | |
| 16 | + "Legal Entity" shall mean the union of the acting entity and all | |
| 17 | + other entities that control, are controlled by, or are under common | |
| 18 | + control with that entity. For the purposes of this definition, | |
| 19 | + "control" means (i) the power, direct or indirect, to cause the | |
| 20 | + direction or management of such entity, whether by contract or | |
| 21 | + otherwise, or (ii) ownership of fifty percent (50%) or more of the | |
| 22 | + outstanding shares, or (iii) beneficial ownership of such entity. | |
| 23 | + | |
| 24 | + "You" (or "Your") shall mean an individual or Legal Entity | |
| 25 | + exercising permissions granted by this License. | |
| 26 | + | |
| 27 | + "Source" form shall mean the preferred form for making modifications, | |
| 28 | + including but not limited to software source code, documentation | |
| 29 | + source, and configuration files. | |
| 30 | + | |
| 31 | + "Object" form shall mean any form resulting from mechanical | |
| 32 | + transformation or translation of a Source form, including but | |
| 33 | + not limited to compiled object code, generated documentation, | |
| 34 | + and conversions to other media types. | |
| 35 | + | |
| 36 | + "Work" shall mean the work of authorship, whether in Source or | |
| 37 | + Object form, made available under the License, as indicated by a | |
| 38 | + copyright notice that is included in or attached to the work | |
| 39 | + (an example is provided in the Appendix below). | |
| 40 | + | |
| 41 | + "Derivative Works" shall mean any work, whether in Source or Object | |
| 42 | + form, that is based on (or derived from) the Work and for which the | |
| 43 | + editorial revisions, annotations, elaborations, or other modifications | |
| 44 | + represent, as a whole, an original work of authorship. For the purposes | |
| 45 | + of this License, Derivative Works shall not include works that remain | |
| 46 | + separable from, or merely link (or bind by name) to the interfaces of, | |
| 47 | + the Work and Derivative Works thereof. | |
| 48 | + | |
| 49 | + "Contribution" shall mean any work of authorship, including | |
| 50 | + the original version of the Work and any modifications or additions | |
| 51 | + to that Work or Derivative Works thereof, that is intentionally | |
| 52 | + submitted to Licensor for inclusion in the Work by the copyright owner | |
| 53 | + or by an individual or Legal Entity authorized to submit on behalf of | |
| 54 | + the copyright owner. For the purposes of this definition, "submitted" | |
| 55 | + means any form of electronic, verbal, or written communication sent | |
| 56 | + to the Licensor or its representatives, including but not limited to | |
| 57 | + communication on electronic mailing lists, source code control systems, | |
| 58 | + and issue tracking systems that are managed by, or on behalf of, the | |
| 59 | + Licensor for the purpose of discussing and improving the Work, but | |
| 60 | + excluding communication that is conspicuously marked or otherwise | |
| 61 | + designated in writing by the copyright owner as "Not a Contribution." | |
| 62 | + | |
| 63 | + "Contributor" shall mean Licensor and any individual or Legal Entity | |
| 64 | + on behalf of whom a Contribution has been received by Licensor and | |
| 65 | + subsequently incorporated within the Work. | |
| 66 | + | |
| 67 | + 2. Grant of Copyright License. Subject to the terms and conditions of | |
| 68 | + this License, each Contributor hereby grants to You a perpetual, | |
| 69 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |
| 70 | + copyright license to reproduce, prepare Derivative Works of, | |
| 71 | + publicly display, publicly perform, sublicense, and distribute the | |
| 72 | + Work and such Derivative Works in Source or Object form. | |
| 73 | + | |
| 74 | + 3. Grant of Patent License. Subject to the terms and conditions of | |
| 75 | + this License, each Contributor hereby grants to You a perpetual, | |
| 76 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |
| 77 | + (except as stated in this section) patent license to make, have made, | |
| 78 | + use, offer to sell, sell, import, and otherwise transfer the Work, | |
| 79 | + where such license applies only to those patent claims licensable | |
| 80 | + by such Contributor that are necessarily infringed by their | |
| 81 | + Contribution(s) alone or by combination of their Contribution(s) | |
| 82 | + with the Work to which such Contribution(s) was submitted. If You | |
| 83 | + institute patent litigation against any entity (including a | |
| 84 | + cross-claim or counterclaim in a lawsuit) alleging that the Work | |
| 85 | + or a Contribution incorporated within the Work constitutes direct | |
| 86 | + or contributory patent infringement, then any patent licenses | |
| 87 | + granted to You under this License for that Work shall terminate | |
| 88 | + as of the date such litigation is filed. | |
| 89 | + | |
| 90 | + 4. Redistribution. You may reproduce and distribute copies of the | |
| 91 | + Work or Derivative Works thereof in any medium, with or without | |
| 92 | + modifications, and in Source or Object form, provided that You | |
| 93 | + meet the following conditions: | |
| 94 | + | |
| 95 | + (a) You must give any other recipients of the Work or | |
| 96 | + Derivative Works a copy of this License; and | |
| 97 | + | |
| 98 | + (b) You must cause any modified files to carry prominent notices | |
| 99 | + stating that You changed the files; and | |
| 100 | + | |
| 101 | + (c) You must retain, in the Source form of any Derivative Works | |
| 102 | + that You distribute, all copyright, patent, trademark, and | |
| 103 | + attribution notices from the Source form of the Work, | |
| 104 | + excluding those notices that do not pertain to any part of | |
| 105 | + the Derivative Works; and | |
| 106 | + | |
| 107 | + (d) If the Work includes a "NOTICE" text file as part of its | |
| 108 | + distribution, then any Derivative Works that You distribute must | |
| 109 | + include a readable copy of the attribution notices contained | |
| 110 | + within such NOTICE file, excluding those notices that do not | |
| 111 | + pertain to any part of the Derivative Works, in at least one | |
| 112 | + of the following places: within a NOTICE text file distributed | |
| 113 | + as part of the Derivative Works; within the Source form or | |
| 114 | + documentation, if provided along with the Derivative Works; or, | |
| 115 | + within a display generated by the Derivative Works, if and | |
| 116 | + wherever such third-party notices normally appear. The contents | |
| 117 | + of the NOTICE file are for informational purposes only and | |
| 118 | + do not modify the License. You may add Your own attribution | |
| 119 | + notices within Derivative Works that You distribute, alongside | |
| 120 | + or as an addendum to the NOTICE text from the Work, provided | |
| 121 | + that such additional attribution notices cannot be construed | |
| 122 | + as modifying the License. | |
| 123 | + | |
| 124 | + You may add Your own copyright statement to Your modifications and | |
| 125 | + may provide additional or different license terms and conditions | |
| 126 | + for use, reproduction, or distribution of Your modifications, or | |
| 127 | + for any such Derivative Works as a whole, provided Your use, | |
| 128 | + reproduction, and distribution of the Work otherwise complies with | |
| 129 | + the conditions stated in this License. | |
| 130 | + | |
| 131 | + 5. Submission of Contributions. Unless You explicitly state otherwise, | |
| 132 | + any Contribution intentionally submitted for inclusion in the Work | |
| 133 | + by You to the Licensor shall be under the terms and conditions of | |
| 134 | + this License, without any additional terms or conditions. | |
| 135 | + Notwithstanding the above, nothing herein shall supersede or modify | |
| 136 | + the terms of any separate license agreement you may have executed | |
| 137 | + with Licensor regarding such Contributions. | |
| 138 | + | |
| 139 | + 6. Trademarks. This License does not grant permission to use the trade | |
| 140 | + names, trademarks, service marks, or product names of the Licensor, | |
| 141 | + except as required for reasonable and customary use in describing the | |
| 142 | + origin of the Work and reproducing the content of the NOTICE file. | |
| 143 | + | |
| 144 | + 7. Disclaimer of Warranty. Unless required by applicable law or | |
| 145 | + agreed to in writing, Licensor provides the Work (and each | |
| 146 | + Contributor provides its Contributions) on an "AS IS" BASIS, | |
| 147 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | |
| 148 | + implied, including, without limitation, any warranties or conditions | |
| 149 | + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | |
| 150 | + PARTICULAR PURPOSE. You are solely responsible for determining the | |
| 151 | + appropriateness of using or redistributing the Work and assume any | |
| 152 | + risks associated with Your exercise of permissions under this License. | |
| 153 | + | |
| 154 | + 8. Limitation of Liability. In no event and under no legal theory, | |
| 155 | + whether in tort (including negligence), contract, or otherwise, | |
| 156 | + unless required by applicable law (such as deliberate and grossly | |
| 157 | + negligent acts) or agreed to in writing, shall any Contributor be | |
| 158 | + liable to You for damages, including any direct, indirect, special, | |
| 159 | + incidental, or consequential damages of any character arising as a | |
| 160 | + result of this License or out of the use or inability to use the | |
| 161 | + Work (including but not limited to damages for loss of goodwill, | |
| 162 | + work stoppage, computer failure or malfunction, or any and all | |
| 163 | + other commercial damages or losses), even if such Contributor | |
| 164 | + has been advised of the possibility of such damages. | |
| 165 | + | |
| 166 | + 9. Accepting Warranty or Additional Liability. While redistributing | |
| 167 | + the Work or Derivative Works thereof, You may choose to offer, | |
| 168 | + and charge a fee for, acceptance of support, warranty, indemnity, | |
| 169 | + or other liability obligations and/or rights consistent with this | |
| 170 | + License. However, in accepting such obligations, You may act only | |
| 171 | + on Your own behalf and on Your sole responsibility, not on behalf | |
| 172 | + of any other Contributor, and only if You agree to indemnify, | |
| 173 | + defend, and hold each Contributor harmless for any liability | |
| 174 | + incurred by, or claims asserted against, such Contributor by reason | |
| 175 | + of your accepting any such warranty or additional liability. | |
| 176 | + | |
| 177 | + END OF TERMS AND CONDITIONS | |
| 178 | + | |
| 179 | + APPENDIX: How to apply the Apache License to your work. | |
| 180 | + | |
| 181 | + To apply the Apache License to your work, attach the following | |
| 182 | + boilerplate notice, with the fields enclosed by brackets "[]" | |
| 183 | + replaced with your own identifying information. (Don't include | |
| 184 | + the brackets!) The text should be enclosed in the appropriate | |
| 185 | + comment syntax for the file format. We also recommend that a | |
| 186 | + file or class name and description of purpose be included on the | |
| 187 | + same "printed page" as the copyright notice for easier | |
| 188 | + identification within third-party archives. | |
| 189 | + | |
| 190 | + Copyright [yyyy] [name of copyright owner] | |
| 191 | + | |
| 192 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
| 193 | + you may not use this file except in compliance with the License. | |
| 194 | + You may obtain a copy of the License at | |
| 195 | + | |
| 196 | + http://www.apache.org/licenses/LICENSE-2.0 | |
| 197 | + | |
| 198 | + Unless required by applicable law or agreed to in writing, software | |
| 199 | + distributed under the License is distributed on an "AS IS" BASIS, | |
| 200 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 201 | + See the License for the specific language governing permissions and | |
| 202 | + limitations under the License. | |
| 203 | + | |
| 204 | +---- LLVM Exceptions to the Apache 2.0 License ---- | |
| 205 | + | |
| 206 | + As an exception, if, as a result of your compiling your source code, portions | |
| 207 | + of this Software are embedded into an Object form of such source code, you | |
| 208 | + may redistribute such embedded portions in such Object form without complying | |
| 209 | + with the conditions of Sections 4(a), 4(b) and 4(d) of the License. | |
| 210 | + | |
| 211 | + In addition, if you combine or link compiled forms of this Software with | |
| 212 | + software that is licensed under the GPLv2 ("Combined Software") and if a | |
| 213 | + court of competent jurisdiction determines that the patent provision (Section | |
| 214 | + 3), the indemnity provision (Section 9) or other Section of the License | |
| 215 | + conflicts with the conditions of the GPLv2, you may retroactively and | |
| 216 | + prospectively choose to deem waived or otherwise exclude such Section(s) of | |
| 217 | + the License, but only in their entirety and only with respect to the Combined | |
| 218 | + Software. |
tools/adapter/README.md
| new file mode 100644 | ||
| @@ -0,0 +1,30 @@ | ||
| 1 | +# Open-model row qualification | |
| 2 | + | |
| 3 | +On Linux AArch64, run the following from the Sovereign Intelligence source checkout with its pinned `out/omc` available. Set `OMC` to use an existing copy with the identical SHA-256. The host launcher uses Bash and GNU coreutils. The model and compiler stay on the user's machine. | |
| 4 | + | |
| 5 | +```sh | |
| 6 | +tools/adapter/qualify /path/to/model.gguf | |
| 7 | +tools/adapter/check /path/to/qwen.gguf /path/to/stories.gguf | |
| 8 | +``` | |
| 9 | + | |
| 10 | +The launcher identifies each file by size and complete SHA-256 before compiling a kernel or allocating tensor storage. Only the two exact little-endian GGUF v3 files in models.tsv are admitted. Their reference directory entries identify the architecture, tokenizer family, Q8_0 attention tensor, row width and byte offset. The whitelist lets an unknown file fail without trusting its size fields or parsing its metadata. The tokenizer family is reported by identity. Tokenization itself is untested. | |
| 11 | + | |
| 12 | +| File | Architecture | Tokenizer | Input revision | | |
| 13 | +| --- | --- | --- | --- | | |
| 14 | +| qwen2.5-0.5b-instruct-q8_0.gguf | qwen2 | gpt2 | [Qwen](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/blob/9217f5db79a29953eb74d5343926648285ec7e67/qwen2.5-0.5b-instruct-q8_0.gguf) | | |
| 15 | +| stories15M-q8_0.gguf | llama | llama | [ggml-org](https://huggingface.co/ggml-org/models/blob/499bc8821c6b12b4e53c5bffcb21ec206f212d81/tinyllamas/stories15M-q8_0.gguf) | | |
| 16 | + | |
| 17 | +## What runs | |
| 18 | + | |
| 19 | +The adapter takes the first row of `blk.0.attn_q.weight`, verifies the row digest, instantiates the ggml-omega template at the exact block count and compiles a native Linux AArch64 ELF. It multiplies the row by the repeating activation vector `i % 7 - 3` and checks the four result bytes against an independently decoded reference. A cache hit must match the pinned binary digest and pass the row check again. Entries are atomically published after parity passes. Set `SI_ADAPTER_CACHE` to choose a scratch cache. | |
| 20 | + | |
| 21 | +The read-only probe records OS release, CPU ISA and MIDRs, total RAM, display PCI IDs and the bound driver. Its output is part of the cache key alongside the model, source, compiler and expected executable digests. The implemented fallback is host execution, including on a GB10 host. The program opens no GPU nodes. Only the row width specializes the arithmetic. CPU ISA determines the executable target. Individual CPU core types do not select different instruction sequences. | |
| 22 | + | |
| 23 | +## Source trail and limits | |
| 24 | + | |
| 25 | +* Sovereign Intelligence base e659ab3defe05c03ac1dd6cb39f8aa4626b905b1. Its seed/PINS.tsv compiler SHA-256 is 45442c7d517fd605507bda5d1ec52493ff182661301cda69a95fc4f77dc6080d. The Spark test used an existing matching compiler. The seed rebuild belongs to the repository gate. | |
| 26 | +* ggml-omega a30322c90191507c46c1b74783d722d617d4514c. dq8.om.in is kernels/dq8.om verbatim and half.om is the h2f function from kernels/math.om. See LICENSE.ggml-omega. Its CI pins the Qwen bytes. Its separate evidence/gb10-model-20261029.json records fixed-prompt greedy agreement with differing logits on earlier GB10 runs. | |
| 27 | +* Omega omega-mv ace307db4283dffb9e8b2fadb6c91d5d47452c14, gpu/nvidia/om/admission/chip_admit.om, identifies display PCI 10de:2e12 as sm_121. CUDApp 21d8de285f713adf09e0d6ba6db2b37139d0674e, backend/hw/manifest.tsv, distinguishes observed identity from admission for an operation. Neither source grants this adapter GPU execution. | |
| 28 | +* MojoLlama 249949d1c3fe839bb5e156f91e9c5fd8d3dc7990, src/mojollama/gguf/reader.mojo, reads the entire file through Python. The separate gguf_arch.mojo scanner documents a file-size limit. Neither is a runtime dependency of this bounded adapter. | |
| 29 | + | |
| 30 | +For independent reproduction install gguf==0.17.1 in a test environment and run `python reference.py QWEN.gguf STORIES.gguf` from this directory. Compare the metadata, tensor location, row digest and float bits with models.tsv. receipt.txt records the two real inputs and the controls. No whole-model inference, logit parity, throughput, arbitrary GGUF parsing, Safetensors, GPU code generation or public installer integration was exercised. |
tools/adapter/check
| new file mode 100755 | ||
| @@ -0,0 +1,49 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +set -euo pipefail | |
| 3 | +[[ $# == 2 ]] || { echo 'usage: check QWEN.gguf STORIES.gguf' >&2; exit 2; } | |
| 4 | +base=$(cd -- "$(dirname -- "$0")" && pwd) | |
| 5 | +tmp=$(mktemp -d) | |
| 6 | +trap 'rm -rf -- "$tmp"' EXIT | |
| 7 | +export SI_ADAPTER_CACHE=$tmp/cache | |
| 8 | +run() { "$base/qualify" "$1" | tee "$tmp/log"; } | |
| 9 | +reject() { | |
| 10 | + local reason=$1 | |
| 11 | + shift | |
| 12 | + if "$@" > "$tmp/log" 2>&1; then echo "unexpected success: $reason" >&2; exit 1; fi | |
| 13 | + grep -Fx "REFUSED $reason" "$tmp/log" | |
| 14 | +} | |
| 15 | +run "$1" | |
| 16 | +grep -q 'architecture=qwen2 .*cache=generated' "$tmp/log" | |
| 17 | +qkey=$(sed -n 's/^ROW_PASS .* key=\([^ ]*\) kernel=.*/\1/p' "$tmp/log") | |
| 18 | +run "$2" | |
| 19 | +grep -q 'architecture=llama .*cache=generated' "$tmp/log" | |
| 20 | +lkey=$(sed -n 's/^ROW_PASS .* key=\([^ ]*\) kernel=.*/\1/p' "$tmp/log") | |
| 21 | +[[ -n $qkey && -n $lkey && $qkey != "$lkey" ]] | |
| 22 | +run "$2" | |
| 23 | +grep -q 'cache=reused' "$tmp/log" | |
| 24 | +# Change only the reported kernel release, keeping the real CPU/runtime. | |
| 25 | +mkdir "$tmp/bin" | |
| 26 | +cat > "$tmp/bin/uname" <<'PROBE' | |
| 27 | +#!/bin/sh | |
| 28 | +if [ "$1" = -smr ]; then echo 'Linux CONTROL aarch64'; else exec /usr/bin/uname "$@"; fi | |
| 29 | +PROBE | |
| 30 | +chmod +x "$tmp/bin/uname" | |
| 31 | +PATH="$tmp/bin:$PATH" run "$2" | |
| 32 | +grep -q 'cache=generated' "$tmp/log" | |
| 33 | +other=$(sed -n 's/^ROW_PASS .* key=\([^ ]*\) kernel=.*/\1/p' "$tmp/log") | |
| 34 | +[[ -n $other && $other != "$lkey" ]] | |
| 35 | +echo HARDWARE_KEY_CONTROL_PASS | |
| 36 | +echo truncated > "$tmp/bad" | |
| 37 | +reject unsupported_size "$base/qualify" "$tmp/bad" | |
| 38 | +truncate -s "$(stat -c %s "$2")" "$tmp/bad" | |
| 39 | +reject model_digest "$base/qualify" "$tmp/bad" | |
| 40 | +cp "$tmp/cache/$qkey" "$tmp/cache/$lkey" | |
| 41 | +reject kernel_digest "$base/qualify" "$2" | |
| 42 | +rm "$tmp/cache/$lkey" | |
| 43 | +reject compiler_digest env OMC=/bin/true "$base/qualify" "$2" | |
| 44 | +mkdir "$tmp/mutant" | |
| 45 | +cp "$base"/{qualify,models.tsv,half.om,dq8.om.in,row.om.in} "$tmp/mutant/" | |
| 46 | +sed -i 's/3223118742/3223118743/' "$tmp/mutant/models.tsv" | |
| 47 | +reject parity "$tmp/mutant/qualify" "$2" | |
| 48 | +[[ ! -e $tmp/cache/$lkey ]] | |
| 49 | +echo CHECK_PASS |
tools/adapter/dq8.om.in
| new file mode 100644 | ||
| @@ -0,0 +1,28 @@ | ||
| 1 | +note dq8_@B@: q8_0 dot over @B@ blocks of 34 bytes (f16 scale d, 32 signed bytes q) against f32 x: | |
| 2 | +note acc (f64 bits) + sum over blocks of f64(d * sum_j f32(q_j)*x_j); fin 1 returns the f32 total. | |
| 3 | +fn q8s u uchar to f32 | |
| 4 | +q = long u | |
| 5 | +if ge q 128 | |
| 6 | +q = sub q 256 | |
| 7 | +end | |
| 8 | +ret f32 q | |
| 9 | +end | |
| 10 | +fn q8d w view uchar @W@ o ulong to f32 | |
| 11 | +ret h2f ushort or ulong get w o shl ulong get w add o 1 8 | |
| 12 | +end | |
| 13 | +fn dq8_@B@ acc ulong w view uchar @W@ x view f32 @X@ fin ulong to ulong | |
| 14 | +s = bitcast f64 acc | |
| 15 | +for b ulong @B@ | |
| 16 | +o = mul b 34 | |
| 17 | +xo = mul b 32 | |
| 18 | +bs = f32 0.0 | |
| 19 | +for j ulong 32 | |
| 20 | +bs = add bs mul q8s get w add add o 2 j get x add xo j | |
| 21 | +end | |
| 22 | +s = add s f64 mul q8d view w o bs | |
| 23 | +end | |
| 24 | +if eq fin 1 | |
| 25 | +ret ulong bitcast uint f32 s | |
| 26 | +end | |
| 27 | +ret bitcast ulong s | |
| 28 | +end |
tools/adapter/half.om
| new file mode 100644 | ||
| @@ -0,0 +1,17 @@ | ||
| 1 | +fn h2f h ushort to f32 | |
| 2 | +v = uint h | |
| 3 | +s = shl and shr v 15 1 31 | |
| 4 | +e = and shr v 10 31 | |
| 5 | +m = and v 1023 | |
| 6 | +if eq e 0 | |
| 7 | +z = mul f32 m 0.000000059604644775390625f32 | |
| 8 | +if eq s 0 | |
| 9 | +ret z | |
| 10 | +end | |
| 11 | +ret neg z | |
| 12 | +end | |
| 13 | +if eq e 31 | |
| 14 | +ret bitcast f32 or or s 2139095040 shl m 13 | |
| 15 | +end | |
| 16 | +ret bitcast f32 or or s shl add e 112 23 shl m 13 | |
| 17 | +end |
tools/adapter/models.tsv
| new file mode 100644 | ||
| @@ -0,0 +1,3 @@ | ||
| 1 | +# size sha256 architecture tokenizer width row_offset row_sha256 reference_f32_bits kernel_sha256 | |
| 2 | +675710816 ca59ca7f13d0e15a8cfa77bd17e65d24f6844b554a7b6c12e07a5f89ff76844e qwen2 gpt2 896 310111584 4333ed22b9b49f43c24d512229e4dd281f2793691f078b325419c28b2532874e 3158785920 72ab06a7e1d9e5f9decb391a9f994ad99d1e33e6fef33b73f8592753d0049176 | |
| 3 | +26671328 2eda49203f2f044f3dddf29a7dd7cc861ef5a0340f518a19613d73ba6d9c06b6 llama llama 288 20312288 57436cf592b35857e212c0ddb28f0c0d836c3788daa6c0ad8b7b4ea18b3fcba8 3223118742 6fd0c7b07974b99229cb8a080471b5d0610ac844a37fdbf2ae26f43be91345f7 |
tools/adapter/qualify
| new file mode 100755 | ||
| @@ -0,0 +1,74 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Qualify one pinned Q8_0 attention row on a Linux AArch64 host. | |
| 3 | +set -euo pipefail | |
| 4 | +export LC_ALL=C | |
| 5 | +umask 077 | |
| 6 | +refuse() { printf 'REFUSED %s\n' "$1" >&2; exit 1; } | |
| 7 | +digest() { sha256sum < "$1" | cut -d' ' -f1; } | |
| 8 | +[[ $# == 1 ]] || refuse 'usage: qualify MODEL.gguf' | |
| 9 | +base=$(cd -- "$(dirname -- "$0")" && pwd) | |
| 10 | +[[ -f $1 ]] || refuse model_file | |
| 11 | +exec 3< "$1" | |
| 12 | +model=/proc/self/fd/3 | |
| 13 | +[[ -f $model ]] || refuse model_type | |
| 14 | +size=$(stat -Lc %s "$model") | |
| 15 | +awk -v size="$size" '$1 == size {found=1} END {exit !found}' "$base/models.tsv" || refuse unsupported_size | |
| 16 | +hash=$(digest "$model") | |
| 17 | +spec=$(awk -v s="$size" -v h="$hash" '$1 == s && $2 == h {print}' "$base/models.tsv") | |
| 18 | +[[ -n $spec ]] || refuse model_digest | |
| 19 | +read -r _ _ arch tokenizer width offset row_sha reference binary_sha <<< "$spec" | |
| 20 | +[[ $(uname -s)/$(uname -m) == Linux/aarch64 ]] || refuse unsupported_host | |
| 21 | +tmp=$(mktemp -d) | |
| 22 | +trap 'rm -rf -- "$tmp"' EXIT | |
| 23 | +blocks=$((width / 32)) | |
| 24 | +length=$((34 * blocks)) | |
| 25 | +dd if="$model" of="$tmp/row" iflag=skip_bytes,count_bytes skip="$offset" count="$length" status=none | |
| 26 | +[[ $(digest "$tmp/row") == "$row_sha" ]] || refuse row_digest | |
| 27 | + | |
| 28 | +{ | |
| 29 | + uname -smr | |
| 30 | + # Include all reported core types on heterogeneous hosts. | |
| 31 | + cat /sys/devices/system/cpu/cpu*/regs/identification/midr_el1 | sort -u | |
| 32 | + awk '/^MemTotal:/ {print}' /proc/meminfo | |
| 33 | + for pci in /sys/bus/pci/devices/*; do | |
| 34 | + [[ -r $pci/class ]] || continue | |
| 35 | + class=$(cat "$pci/class") | |
| 36 | + [[ $class == 0x03* ]] || continue | |
| 37 | + printf 'display %s %s %s %s\n' "${pci##*/}" "$(cat "$pci/vendor")" "$(cat "$pci/device")" "$class" | |
| 38 | + if [[ -L $pci/driver ]]; then basename "$(readlink "$pci/driver")"; fi | |
| 39 | + done | |
| 40 | + if [[ -r /proc/driver/nvidia/version ]]; then head -1 /proc/driver/nvidia/version; fi | |
| 41 | +} > "$tmp/hardware" | |
| 42 | +cat "$tmp/hardware" | |
| 43 | +compiler_sha=45442c7d517fd605507bda5d1ec52493ff182661301cda69a95fc4f77dc6080d | |
| 44 | +sed -e "s/@W@/$length/g;s/@X@/$width/g;s/@B@/$blocks/g" \ | |
| 45 | + "$base/half.om" "$base/dq8.om.in" "$base/row.om.in" > "$tmp/source" | |
| 46 | +key=$(printf '%s\n' "$hash" "$(digest "$tmp/hardware")" "$compiler_sha" "$(digest "$tmp/source")" "$binary_sha" | sha256sum | cut -d' ' -f1) | |
| 47 | +cache=${SI_ADAPTER_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/si-adapter} | |
| 48 | +mkdir -p -- "$cache" | |
| 49 | +if [[ -e $cache/$key ]]; then | |
| 50 | + cp -- "$cache/$key" "$tmp/kernel" | |
| 51 | + state=reused | |
| 52 | +else | |
| 53 | + omc=${OMC:-$base/../../out/omc} | |
| 54 | + [[ -f $omc ]] || refuse compiler_missing | |
| 55 | + cp -- "$omc" "$tmp/compiler" | |
| 56 | + [[ $(digest "$tmp/compiler") == "$compiler_sha" ]] || refuse compiler_digest | |
| 57 | + chmod 700 "$tmp/compiler" | |
| 58 | + "$tmp/compiler" < "$tmp/source" > "$tmp/kernel" | |
| 59 | + state=generated | |
| 60 | +fi | |
| 61 | +[[ $(digest "$tmp/kernel") == "$binary_sha" ]] || refuse kernel_digest | |
| 62 | +chmod 700 "$tmp/kernel" | |
| 63 | +"$tmp/kernel" < "$tmp/row" > "$tmp/bits" | |
| 64 | +[[ $(stat -c %s "$tmp/bits") == 4 ]] || refuse result_length | |
| 65 | +bits=$(od -An -tu4 "$tmp/bits" | tr -d ' ') | |
| 66 | +[[ $bits == "$reference" ]] || refuse parity | |
| 67 | +if [[ $state == generated ]]; then | |
| 68 | + publish=$(mktemp -- "$cache/.kernel.XXXXXXXX") | |
| 69 | + trap 'rm -rf -- "$tmp"; rm -f -- "$publish"' EXIT | |
| 70 | + cp -- "$tmp/kernel" "$publish" | |
| 71 | + mv -fT -- "$publish" "$cache/$key" | |
| 72 | +fi | |
| 73 | +printf 'ROW_PASS format=GGUFv3 quant=Q8_0 architecture=%s tokenizer=%s model=%s width=%s bits=%s device=cpu cache=%s key=%s kernel=%s\n' \ | |
| 74 | + "$arch" "$tokenizer" "$hash" "$width" "$bits" "$state" "$key" "$binary_sha" |
tools/adapter/receipt.txt
| new file mode 100644 | ||
| @@ -0,0 +1,41 @@ | ||
| 1 | +qwen2 gpt2 7 896 310111584 952 675710816 4333ed22b9b49f43c24d512229e4dd281f2793691f078b325419c28b2532874e 3158785920 | |
| 2 | +llama llama 7 288 20312288 306 26671328 57436cf592b35857e212c0ddb28f0c0d836c3788daa6c0ad8b7b4ea18b3fcba8 3223118742 | |
| 3 | +Linux 7.0.0-1019-nvidia aarch64 | |
| 4 | +0x00000000410fd851 | |
| 5 | +0x00000000410fd871 | |
| 6 | +MemTotal: 127598752 kB | |
| 7 | +display 000f:01:00.0 0x10de 0x2e12 0x030000 | |
| 8 | +nvidia | |
| 9 | +NVRM version: NVIDIA UNIX Open Kernel Module for aarch64 580.173.02 Release Build (dvs-builder@U22-A24-5-4) Tue Jun 23 08:34:19 UTC 2026 | |
| 10 | +ROW_PASS format=GGUFv3 quant=Q8_0 architecture=qwen2 tokenizer=gpt2 model=ca59ca7f13d0e15a8cfa77bd17e65d24f6844b554a7b6c12e07a5f89ff76844e width=896 bits=3158785920 device=cpu cache=generated key=c647286c9facbcb45d16df40e787c6c714691dd78bfb5212772f815453348980 kernel=72ab06a7e1d9e5f9decb391a9f994ad99d1e33e6fef33b73f8592753d0049176 | |
| 11 | +Linux 7.0.0-1019-nvidia aarch64 | |
| 12 | +0x00000000410fd851 | |
| 13 | +0x00000000410fd871 | |
| 14 | +MemTotal: 127598752 kB | |
| 15 | +display 000f:01:00.0 0x10de 0x2e12 0x030000 | |
| 16 | +nvidia | |
| 17 | +NVRM version: NVIDIA UNIX Open Kernel Module for aarch64 580.173.02 Release Build (dvs-builder@U22-A24-5-4) Tue Jun 23 08:34:19 UTC 2026 | |
| 18 | +ROW_PASS format=GGUFv3 quant=Q8_0 architecture=llama tokenizer=llama model=2eda49203f2f044f3dddf29a7dd7cc861ef5a0340f518a19613d73ba6d9c06b6 width=288 bits=3223118742 device=cpu cache=generated key=249b31d6c672014af20ba52b1bf43a4e435f3f1c0b80c069a82e5cf8fac5366a kernel=6fd0c7b07974b99229cb8a080471b5d0610ac844a37fdbf2ae26f43be91345f7 | |
| 19 | +Linux 7.0.0-1019-nvidia aarch64 | |
| 20 | +0x00000000410fd851 | |
| 21 | +0x00000000410fd871 | |
| 22 | +MemTotal: 127598752 kB | |
| 23 | +display 000f:01:00.0 0x10de 0x2e12 0x030000 | |
| 24 | +nvidia | |
| 25 | +NVRM version: NVIDIA UNIX Open Kernel Module for aarch64 580.173.02 Release Build (dvs-builder@U22-A24-5-4) Tue Jun 23 08:34:19 UTC 2026 | |
| 26 | +ROW_PASS format=GGUFv3 quant=Q8_0 architecture=llama tokenizer=llama model=2eda49203f2f044f3dddf29a7dd7cc861ef5a0340f518a19613d73ba6d9c06b6 width=288 bits=3223118742 device=cpu cache=reused key=249b31d6c672014af20ba52b1bf43a4e435f3f1c0b80c069a82e5cf8fac5366a kernel=6fd0c7b07974b99229cb8a080471b5d0610ac844a37fdbf2ae26f43be91345f7 | |
| 27 | +Linux CONTROL aarch64 | |
| 28 | +0x00000000410fd851 | |
| 29 | +0x00000000410fd871 | |
| 30 | +MemTotal: 127598752 kB | |
| 31 | +display 000f:01:00.0 0x10de 0x2e12 0x030000 | |
| 32 | +nvidia | |
| 33 | +NVRM version: NVIDIA UNIX Open Kernel Module for aarch64 580.173.02 Release Build (dvs-builder@U22-A24-5-4) Tue Jun 23 08:34:19 UTC 2026 | |
| 34 | +ROW_PASS format=GGUFv3 quant=Q8_0 architecture=llama tokenizer=llama model=2eda49203f2f044f3dddf29a7dd7cc861ef5a0340f518a19613d73ba6d9c06b6 width=288 bits=3223118742 device=cpu cache=generated key=4f6cb45f28b37bf3ff75fa7e1f6229985eee21160741fec8d661f4a3ba6edc53 kernel=6fd0c7b07974b99229cb8a080471b5d0610ac844a37fdbf2ae26f43be91345f7 | |
| 35 | +HARDWARE_KEY_CONTROL_PASS | |
| 36 | +REFUSED unsupported_size | |
| 37 | +REFUSED model_digest | |
| 38 | +REFUSED kernel_digest | |
| 39 | +REFUSED compiler_digest | |
| 40 | +REFUSED parity | |
| 41 | +CHECK_PASS |
tools/adapter/reference.py
| new file mode 100644 | ||
| @@ -0,0 +1,35 @@ | ||
| 1 | +"""Independent GGUF directory reader and numeric oracle. Test dependency: gguf==0.17.1.""" | |
| 2 | +import hashlib | |
| 3 | +import pathlib | |
| 4 | +import struct | |
| 5 | +import sys | |
| 6 | + | |
| 7 | +from gguf import GGUFReader | |
| 8 | + | |
| 9 | + | |
| 10 | +def inspect(path): | |
| 11 | + reader = GGUFReader(path) | |
| 12 | + def field(name): | |
| 13 | + return reader.get_field(name).contents() | |
| 14 | + tensor = next(t for t in reader.tensors if t.name == "blk.0.attn_q.weight") | |
| 15 | + assert tensor.tensor_type.name == "Q8_0" | |
| 16 | + width = int(tensor.shape[0]) | |
| 17 | + assert width % 32 == 0 | |
| 18 | + length = width // 32 * 34 | |
| 19 | + with open(path, "rb") as stream: | |
| 20 | + stream.seek(tensor.data_offset) | |
| 21 | + row = stream.read(length) | |
| 22 | + # Integral activations and signed bytes give exact integer block sums. | |
| 23 | + total = 0.0 | |
| 24 | + for start in range(0, length, 34): | |
| 25 | + scale, *weights = struct.unpack_from("<e32b", row, start) | |
| 26 | + base = start // 34 * 32 | |
| 27 | + total += scale * sum(q * ((base + j) % 7 - 3) for j, q in enumerate(weights)) | |
| 28 | + bits, = struct.unpack("<I", struct.pack("<f", total)) | |
| 29 | + print(field("general.architecture"), field("tokenizer.ggml.model"), field("general.file_type"), | |
| 30 | + width, tensor.data_offset, length, pathlib.Path(path).stat().st_size, | |
| 31 | + hashlib.sha256(row).hexdigest(), bits) | |
| 32 | + | |
| 33 | + | |
| 34 | +for model in sys.argv[1:]: | |
| 35 | + inspect(model) |
tools/adapter/row.om.in
| new file mode 100644 | ||
| @@ -0,0 +1,20 @@ | ||
| 1 | +global result uchar 4 | |
| 2 | +fn main to int | |
| 3 | +row = new uchar @W@ 0 | |
| 4 | +act = new f32 @X@ 0.0 | |
| 5 | +n = read 0 row 0 @W@ | |
| 6 | +if ne n @W@ | |
| 7 | +ret 2 | |
| 8 | +end | |
| 9 | +for i ulong @X@ | |
| 10 | +put act i f32 sub long rem i 7 3 | |
| 11 | +end | |
| 12 | +bits = dq8_@B@ 0 view row view act 1 | |
| 13 | +for i ulong 4 | |
| 14 | +put result i uchar and shr bits mul i 8 255 | |
| 15 | +end | |
| 16 | +if ne write 1 result 0 4 4 | |
| 17 | +ret 3 | |
| 18 | +end | |
| 19 | +ret 0 | |
| 20 | +end |