diff --git a/.crumb b/.crumb index 312484df..21c7ada4 100644 --- a/.crumb +++ b/.crumb @@ -100,8 +100,8 @@ "purpose": "" }, { - "digest": "af5f9d6a21e7bdc0bce013df14b00648a9571513c9b719874799917e19e4e203", - "last_commit": "53beb96", + "digest": "58faf6de9fc6aa2d82c8ab701347f389b1a19803972c8d7a977e75bfff668a58", + "last_commit": "f598423", "name": "scripts", "purpose": "" }, @@ -118,15 +118,15 @@ "purpose": "Local CI sandbox exec contract (C8), aien-run user/caches install, Forgejo trigger hook, health " } ], - "children_root": "sha256:31b31d0c22430a2b7dbaf536741c122daa8e98b3e30440b78e6f0b153415c048", - "compiled_at": "2026-10-28T03:03:48Z", + "children_root": "sha256:6404f9b25f36e0124cb5861cd1e298d427e3a1ba7a01534d90468d8fc06ed757", + "compiled_at": "2026-10-28T14:50:38Z", "compiler": "crumb-compile/1", - "digest": "sha256:5d5f4a49f603535a52385349535b36056e7339e5409a035de71141c76edbea72", + "digest": "sha256:52741569941636f4033ca7d38acf2092b11ff9a8425b71c212c677fce704b78a", "evidence_files": 3563, "evidence_root": "sha256:dcebb871a65c368d29c9a58cecfcd272c04c00f1c5416f108888f16769983516", "files": 8004, - "generated_at_commit": "28162550641982c66b50912ca61246af1e27ba0a", - "source_tree": "sha256:de489531c40307a568b3de2ff6316a1a38ddb75d7f4f40b16c2999bffcad3515" + "generated_at_commit": "aff9cc79d47e16dc4d737456647005cc6660728a", + "source_tree": "sha256:7335db461c7a49c8164cea81f0ee11be724b0eeb5989ff5213fb87fa159fb20b" } }, "history": [], diff --git a/README.md b/README.md index 63ae3a03..8c346e45 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,25 @@ cargo test --workspace -- --test-threads=1 # one test thread, as CI runs it scripts/repro-build.sh -p aien-cli # release build with machine-local paths removed; build aien-cli on its own, because its digest changes with the other packages in the same cargo command (docs/release/F1-binary-digest-difference.md) ``` +Native GPU source builds require both `AIEN_OMEGA_DIR` at `omega.lock` and +`AIEN_CUDAPP_DIR` at that Omega revision's committed `cudapp.lock`. +`scripts/pins.sh --gpu` materializes these checkouts and writes their environment. +Set `OMEGA_OMC` and `OMEGA_BRIDGE` to the compiler and bridge matching the pins +in canonical CUDApp's `om/units.sh` before building. Omega stages one frozen +CUDApp revision, checks regenerated units and builds fresh artifacts. +The linker consumes the retained Omega `libomega_gpu.a` companion first and +canonical `libcudapp.a` last. Both digests must match `native-artifacts.lock`; +an unrecorded or stale artifact is a build refusal, not a native fallback. +`AIEN_OMEGA_GPU_LIB` is no longer a supported GPU source selection. + +Without a GPU source selection the existing CPU-only mode remains available. +`AIEN_FORCE_CPU_STUB=1` explicitly selects it; `AIEN_REQUIRE_NATIVE_LIBS=1` +refuses that combination and refuses missing native inputs. Satellite crates +receive capabilities only from the verified archives through their direct +`aien-omega-gpu` dependency, never from header presence. Host ABI and status-name +smokes do not execute a GPU kernel or qualify a device. + + ### Model server on a DGX Spark (Qwen3.8-27B, source build) Only on an NVIDIA DGX Spark (aarch64 Linux, GB10, NVIDIA open driver 580.173.02 tested). No CUDA toolkit is needed: Omega talks to the driver directly. The installer checks the machine first and stops with a plain message when something is missing; it never installs a server that has only the CPU stub. diff --git a/crates/aien-abi-conformance/src/build.rs b/crates/aien-abi-conformance/src/build.rs index b542a5b1..e18fa618 100644 --- a/crates/aien-abi-conformance/src/build.rs +++ b/crates/aien-abi-conformance/src/build.rs @@ -255,6 +255,57 @@ pub fn qualify_built( } } +/// Qualify the canonical GPU ABI and its retained Omega runtime companion. +/// Both archive digests must already be recorded by the existing artifact authority. +/// A source pin match alone never grants native capability. +#[allow(clippy::too_many_arguments)] +pub fn qualify_gpu_pair( + manifest: &Path, + lock: &Path, + omega: &Path, + physics: &Path, + companion: &Path, + omega_sha: &str, + canonical: &Path, + canonical_archive: &Path, + canonical_sha: &str, +) -> (Identity, Identity) { + let cudapp = qualify_built( + "aien-omega-gpu canonical CUDApp", + manifest, + lock, + canonical, + physics, + canonical_archive, + canonical_sha, + true, + ); + assert_eq!(cudapp.abi, "pass", "canonical GPU ABI must be exercised"); + assert_eq!(cudapp.digest, "locked", "canonical GPU archive has no recorded artifact identity"); + let sha = identity::sha256_file(companion).unwrap_or_else(|e| panic!("{e}")); + let digest = identity::check_built( + &load_lock(lock), + "libomega_gpu.a", + omega_sha, + &cudapp.target, + &cudapp.cc, + &sha, + ).unwrap_or_else(|e| panic!("{e}")); + assert_eq!(digest, Digest::Locked, "Omega GPU companion has no recorded artifact identity"); + let companion = Identity { + link: Link::PinnedSource, + abi: "pass", + digest: "locked", + archive_sha256: sha, + omega_sha: omega_sha.into(), + aienos_lock: read_trim(&omega.join("aienos.lock")), + physics_lock: read_trim(&omega.join("physics.lock")), + target: cudapp.target.clone(), + cc: cudapp.cc.clone(), + }; + (companion, cudapp) +} + /// Checks for a prebuilt archive: its digest must equal `$sha_var`, and it must define every /// function the manifest names (no headers are available, so layouts are not re-probed; the /// identity says so and qualification does not accept it). diff --git a/crates/aien-inference-abi/src/qwen3_moe_omega.rs b/crates/aien-inference-abi/src/qwen3_moe_omega.rs index 1f5b048b..069eb160 100644 --- a/crates/aien-inference-abi/src/qwen3_moe_omega.rs +++ b/crates/aien-inference-abi/src/qwen3_moe_omega.rs @@ -3857,7 +3857,7 @@ impl Qwen3MoeOmegaEngine { progress: &mut dyn FnMut(&str), ) -> Result<(Self, LoadReport), String> { if !aien_omega_gpu::is_native() { - return Err("this binary carries the CPU stub of the Omega engine (build with AIEN_OMEGA_DIR or AIEN_OMEGA_GPU_LIB)".into()); + return Err("this binary carries the CPU stub of the Omega engine (build with pinned AIEN_OMEGA_DIR and AIEN_CUDAPP_DIR sources)".into()); } let (weights, report) = load_qwen3_moe_omega_paths(dir, &OmegaModelUploader, format, paths, progress)?; diff --git a/crates/aien-inference-abi/tests/omega_backend_parity.rs b/crates/aien-inference-abi/tests/omega_backend_parity.rs index 8e4515a8..d4faaa32 100644 --- a/crates/aien-inference-abi/tests/omega_backend_parity.rs +++ b/crates/aien-inference-abi/tests/omega_backend_parity.rs @@ -18,7 +18,8 @@ //! Host test (runs everywhere, stub-aware): in a stub build the backend must //! report itself unavailable. Chip test (`#[ignore]`, run through the heavy //! queue with a native build): -//! AIEN_OMEGA_DIR=... AIEN_PHYSICS_DIR=... cargo test -p aien-inference-abi --release \ +//! AIEN_OMEGA_DIR=... AIEN_CUDAPP_DIR=... AIEN_PHYSICS_DIR=... \ +//! OMEGA_OMC=... OMEGA_BRIDGE=... cargo test -p aien-inference-abi --release \ //! --test omega_backend_parity -- --ignored --nocapture //! //! Error metric: |chip - ref| divided by sum_i |x_i * w_i| (the accumulation diff --git a/crates/aien-omega-bf16/build.rs b/crates/aien-omega-bf16/build.rs index 56a8f7e2..690d7d62 100644 --- a/crates/aien-omega-bf16/build.rs +++ b/crates/aien-omega-bf16/build.rs @@ -13,61 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides whether omega's bf16 streaming GEMV (`src/omega_gpu_bf16_gemv_api.h`, -//! OWN-30B cut 8 on the omega side) is linked. -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares -//! the extra symbols), so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds `omega_gpu_bf16_gemv_f32` defined -//! in that archive. -//! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_bf16_gemv_api.h`. -//! * otherwise: stub (every call returns `Unavailable`). -//! -//! `cfg(has_omega_bf16)` is set only when native. A stub never fails the build: the engine -//! keeps the dense lm_head matmul, and `is_native()` says which -//! one a binary carries. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. fn main() { + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); println!("cargo:rustc-check-cfg=cfg(has_omega_bf16)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", - ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - if archive_defines(Path::new(&lib), "omega_gpu_bf16_gemv_f32") { - println!("cargo:rustc-cfg=has_omega_bf16"); - } else { - println!("cargo:warning=aien-omega-bf16: {lib} does not define the bf16 GEMV API; the bf16 lm_head GEMV is stubbed"); - } - return; + if capabilities.split_whitespace().any(|c| c == "has_omega_bf16") { + println!("cargo:rustc-cfg=has_omega_bf16"); } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let header = Path::new(&dir).join("src/omega_gpu_bf16_gemv_api.h"); - println!("cargo:rerun-if-changed={}", header.display()); - if header.is_file() { - println!("cargo:rustc-cfg=has_omega_bf16"); - } else { - println!("cargo:warning=aien-omega-bf16: {dir} has no src/omega_gpu_bf16_gemv_api.h (omega before OWN-30B cut 8); the bf16 lm_head GEMV is stubbed"); - } - } -} - -fn archive_defines(lib: &Path, symbol: &str) -> bool { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-bf16: nm not available, assuming the archive lacks the bf16 GEMV API"); - return false; - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .any(|l| l.ends_with(&format!(" T {symbol}"))) } diff --git a/crates/aien-omega-dattn/build.rs b/crates/aien-omega-dattn/build.rs index dbbafc67..ee7ac43c 100644 --- a/crates/aien-omega-dattn/build.rs +++ b/crates/aien-omega-dattn/build.rs @@ -13,61 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides whether omega's one-launch decode attention (`src/omega_gpu_decode_attn_api.h`, -//! OWN-30B cut 8 on the omega side) is linked. -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares -//! the extra symbols), so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds `omega_gpu_decode_attn` defined -//! in that archive. -//! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_decode_attn_api.h`. -//! * otherwise: stub (every call returns `Unavailable`). -//! -//! `cfg(has_omega_dattn)` is set only when native. A stub never fails the build: the engine -//! keeps its split attention path (host norm/rope, paged KV), and `is_native()` says which -//! one a binary carries. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. fn main() { + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); println!("cargo:rustc-check-cfg=cfg(has_omega_dattn)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", - ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - if archive_defines(Path::new(&lib), "omega_gpu_decode_attn") { - println!("cargo:rustc-cfg=has_omega_dattn"); - } else { - println!("cargo:warning=aien-omega-dattn: {lib} does not define the decode attention API; fused attention is stubbed"); - } - return; + if capabilities.split_whitespace().any(|c| c == "has_omega_dattn") { + println!("cargo:rustc-cfg=has_omega_dattn"); } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let header = Path::new(&dir).join("src/omega_gpu_decode_attn_api.h"); - println!("cargo:rerun-if-changed={}", header.display()); - if header.is_file() { - println!("cargo:rustc-cfg=has_omega_dattn"); - } else { - println!("cargo:warning=aien-omega-dattn: {dir} has no src/omega_gpu_decode_attn_api.h (omega before OWN-30B cut 8); fused attention is stubbed"); - } - } -} - -fn archive_defines(lib: &Path, symbol: &str) -> bool { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-dattn: nm not available, assuming the archive lacks the decode attention API"); - return false; - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .any(|l| l.ends_with(&format!(" T {symbol}"))) } diff --git a/crates/aien-omega-dgraph/build.rs b/crates/aien-omega-dgraph/build.rs index 67b98765..128a10e4 100644 --- a/crates/aien-omega-dgraph/build.rs +++ b/crates/aien-omega-dgraph/build.rs @@ -13,60 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides whether omega's one-list decode token (`src/omega_gpu_decode_graph.h`, OWN-30B L2 -//! cut 2 on the omega side) is linked. -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares -//! the extra symbols), so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds `omega_gpu_decode_graph_create` -//! defined in that archive. -//! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_decode_graph.h`. -//! * otherwise: stub (every call returns `Unavailable`). -//! -//! `cfg(has_omega_dgraph)` is set only when native. A stub never fails the build: the engine -//! keeps its launch-at-a-time decode, and `is_native()` says which one a binary carries. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. fn main() { + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); println!("cargo:rustc-check-cfg=cfg(has_omega_dgraph)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", - ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - if archive_defines(Path::new(&lib), "omega_gpu_decode_graph_create") { - println!("cargo:rustc-cfg=has_omega_dgraph"); - } else { - println!("cargo:warning=aien-omega-dgraph: {lib} does not define the decode graph API; the one-list decode is stubbed"); - } - return; + if capabilities.split_whitespace().any(|c| c == "has_omega_dgraph") { + println!("cargo:rustc-cfg=has_omega_dgraph"); } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let header = Path::new(&dir).join("src/omega_gpu_decode_graph.h"); - println!("cargo:rerun-if-changed={}", header.display()); - if header.is_file() { - println!("cargo:rustc-cfg=has_omega_dgraph"); - } else { - println!("cargo:warning=aien-omega-dgraph: {dir} has no src/omega_gpu_decode_graph.h (omega before OWN-30B L2 cut 2); the one-list decode is stubbed"); - } - } -} - -fn archive_defines(lib: &Path, symbol: &str) -> bool { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-dgraph: nm not available, assuming the archive lacks the decode graph API"); - return false; - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .any(|l| l.ends_with(&format!(" T {symbol}"))) } diff --git a/crates/aien-omega-fp8/build.rs b/crates/aien-omega-fp8/build.rs index af9f91d4..f5c8c6f5 100644 --- a/crates/aien-omega-fp8/build.rs +++ b/crates/aien-omega-fp8/build.rs @@ -13,95 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides whether omega's FP8 GEMV API (`src/omega_gpu_fp8_api.h`, OWN-30B cuts 5-6) is linked. -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares -//! the extra symbols), so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds -//! `omega_gpu_fp8_gemv_grouped_f32` defined in that archive. -//! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_fp8_api.h`. -//! -//! `cfg(has_omega_fp8gemm)` (the prefill grouped GEMM) is set when the archive defines -//! `omega_gpu_fp8gemm_f32` or the checkout has `src/omega_gpu_fp8gemm_api.h`. -//! `cfg(has_omega_fp8_grouped_rule)` (L310 one-wave lever, `omega_gpu_fp8_grouped_ctas_auto`) is set when the -//! archive defines that symbol or the checkout header declares it. -//! * otherwise: stub (every call returns `Unavailable`). -//! -//! `cfg(has_omega_fp8)` is set only when native. A stub never fails the build: the bf16 -//! path in the model code stays usable, and `is_native()` says which one a binary carries. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. +//! A header or an unverified caller-selected archive cannot enable native calls. fn main() { - println!("cargo:rustc-check-cfg=cfg(has_omega_fp8)"); - println!("cargo:rustc-check-cfg=cfg(has_omega_fp8_dev)"); - println!("cargo:rustc-check-cfg=cfg(has_omega_fp8gemm)"); - println!("cargo:rustc-check-cfg=cfg(has_omega_fp8_grouped_rule)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); + for cfg in [ + "has_omega_fp8", + "has_omega_fp8_dev", + "has_omega_fp8gemm", + "has_omega_fp8_grouped_rule", ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - if archive_defines(Path::new(&lib), "omega_gpu_fp8_gemv_grouped_f32") { - println!("cargo:rustc-cfg=has_omega_fp8"); - if archive_defines(Path::new(&lib), "omega_gpu_fp8_gemv_grouped_dev") - && archive_defines(Path::new(&lib), "omega_gpu_fp8_tensor_entry") - { - println!("cargo:rustc-cfg=has_omega_fp8_dev"); - } - if archive_defines(Path::new(&lib), "omega_gpu_fp8gemm_f32") { - println!("cargo:rustc-cfg=has_omega_fp8gemm"); - } - if archive_defines(Path::new(&lib), "omega_gpu_fp8_grouped_ctas_auto") { - println!("cargo:rustc-cfg=has_omega_fp8_grouped_rule"); - } - } else { - println!("cargo:warning=aien-omega-fp8: {lib} does not define the FP8 GEMV API; FP8 calls are stubbed"); + println!("cargo:rustc-check-cfg=cfg({cfg})"); + if capabilities.split_whitespace().any(|c| c == cfg) { + println!("cargo:rustc-cfg={cfg}"); } - return; } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let header = Path::new(&dir).join("src/omega_gpu_fp8_api.h"); - println!("cargo:rerun-if-changed={}", header.display()); - if header.is_file() { - println!("cargo:rustc-cfg=has_omega_fp8"); - if std::fs::read_to_string(&header).is_ok_and(|t| { - t.contains("omega_gpu_fp8_gemv_grouped_dev") - && t.contains("omega_gpu_fp8_tensor_entry") - }) { - println!("cargo:rustc-cfg=has_omega_fp8_dev"); - } - if Path::new(&dir) - .join("src/omega_gpu_fp8gemm_api.h") - .is_file() - { - println!("cargo:rustc-cfg=has_omega_fp8gemm"); - } - if std::fs::read_to_string(&header) - .is_ok_and(|t| t.contains("omega_gpu_fp8_grouped_ctas_auto")) - { - println!("cargo:rustc-cfg=has_omega_fp8_grouped_rule"); - } - } else { - println!("cargo:warning=aien-omega-fp8: {dir} has no src/omega_gpu_fp8_api.h (omega before OWN-30B cut 5); FP8 calls are stubbed"); - } - } -} - -fn archive_defines(lib: &Path, symbol: &str) -> bool { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-fp8: nm not available, assuming the archive lacks the FP8 GEMV API"); - return false; - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .any(|l| l.ends_with(&format!(" T {symbol}"))) } diff --git a/crates/aien-omega-gpu/Cargo.toml b/crates/aien-omega-gpu/Cargo.toml index 3437059d..1a3d8e41 100644 --- a/crates/aien-omega-gpu/Cargo.toml +++ b/crates/aien-omega-gpu/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Drake Stapleton "] description = "FFI to the native (no CUDA) Omega GPU matmul engine, pinned by omega.lock" license.workspace = true build = "build.rs" +links = "omega_gpu" [dependencies] aien-abi-conformance = { path = "../aien-abi-conformance" } diff --git a/crates/aien-omega-gpu/build.rs b/crates/aien-omega-gpu/build.rs index cb9053f7..e0834f29 100644 --- a/crates/aien-omega-gpu/build.rs +++ b/crates/aien-omega-gpu/build.rs @@ -13,27 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Links `libomega_gpu.a` from the omega commit pinned in `omega.lock`. +//! Links the pinned Omega runtime companion first, then canonical CUDApp last. //! -//! Offline by design: nothing is downloaded and no CUDA/nvcc is used. Order: -//! 1. `AIEN_FORCE_CPU_STUB=1` -> stub (CI without the chip). BUILD-TIME ONLY: a binary already -//! built with the GPU library ignores it at run time. For a CPU-only RUN set `AIEN_BACKEND=cpu`: -//! the daemon refuses to start (`CPU_ONLY_BUT_GPU_BUILD`) if the binary would select the GB10 backend. -//! Refused when `AIEN_REQUIRE_NATIVE_LIBS=1` (a required-native build is never a stub). -//! 2. `AIEN_OMEGA_GPU_LIB=` -> link that prebuilt archive; `AIEN_OMEGA_GPU_LIB_SHA256` must -//! name its sha256 (checked) and it must define every function in the ABI manifest. A -//! development override: its identity says `prebuilt` and it never qualifies. -//! 3. `AIEN_OMEGA_DIR=` -> its HEAD must equal omega.lock; built with -//! `make libomega_gpu` into OUT_DIR. `AIEN_PHYSICS_DIR` (default `/../physics`) -//! is passed as PHYSICS_DIR; omega's own physics.lock check still runs. -//! 4. otherwise -> stub, with a build warning. -//! -//! `cfg(has_omega_gpu)` is set only when the real library is linked. -//! -//! Before linking a checkout build, `aien_abi_conformance::build::qualify_built` checks the -//! pinned headers, a compiled layout probe and the archive symbols against -//! `abi/omega_gpu.manifest`, and the archive sha256 against `native-artifacts.lock`; any mismatch -//! fails the build. The result is recorded for `native_identity()`. +//! Offline source builds use AIEN_OMEGA_DIR at omega.lock and AIEN_CUDAPP_DIR +//! at that Omega revision's cudapp.lock. Omega's canonical staging entry freezes +//! and builds that CUDApp revision with the pinned compiler and bridge. +//! Both archives must match native-artifacts.lock; headers alone grant nothing. +//! AIEN_FORCE_CPU_STUB=1 preserves the explicit CPU-only build, unless native +//! libraries are required. No source selection builds the existing CPU stub. +//! Arbitrary prebuilt GPU archives are refused, even with a caller-selected hash. +//! Native capabilities are published to dependent build scripts only after ABI, +//! source and both archive identity checks succeed. use aien_abi_conformance::build; use std::path::{Path, PathBuf}; use std::process::Command; @@ -46,6 +36,9 @@ fn main() { "AIEN_FORCE_CPU_STUB", "AIEN_OMEGA_GPU_LIB", "AIEN_OMEGA_DIR", + "AIEN_CUDAPP_DIR", + "OMEGA_OMC", + "OMEGA_BRIDGE", "AIEN_PHYSICS_DIR", "AIEN_REQUIRE_NATIVE_LIBS", ] { @@ -62,6 +55,8 @@ fn main() { "omega.lock must hold one full 40-hex sha" ); println!("cargo:rustc-env=AIEN_OMEGA_PINNED_SHA={pinned}"); + println!("cargo:capabilities="); + build::Identity::stub("").emit("AIEN_CUDAPP"); let root = PathBuf::from(env("CARGO_MANIFEST_DIR")); let manifest = root.join("abi/omega_gpu.manifest"); @@ -72,33 +67,19 @@ fn main() { build::Identity::stub(&pinned).emit(PREFIX); return; } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - let lib = PathBuf::from(lib); - assert!( - lib.is_file(), - "AIEN_OMEGA_GPU_LIB {} is not a file", - lib.display() - ); - build::qualify_prebuilt( - "aien-omega-gpu", - &manifest, - &lib, - "AIEN_OMEGA_GPU_LIB_SHA256", - "unverified", - ) - .emit(PREFIX); - link(&lib); - return; - } + assert!( + std::env::var_os("AIEN_OMEGA_GPU_LIB").is_none(), + "AIEN_OMEGA_GPU_LIB is no longer supported: use pinned AIEN_OMEGA_DIR and AIEN_CUDAPP_DIR source builds" + ); let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") else { // AIEN_REQUIRE_NATIVE_LIBS=1 (set by scripts/pins.sh env.sh) turns the silent // stub fallback into a build error: a release or receipt build must never // discover at run time that it carries the CPU stub (sovereign-core #92). assert!( std::env::var("AIEN_REQUIRE_NATIVE_LIBS").as_deref() != Ok("1"), - "aien-omega-gpu: AIEN_REQUIRE_NATIVE_LIBS=1 but neither AIEN_OMEGA_DIR nor AIEN_OMEGA_GPU_LIB is set (run scripts/pins.sh --gpu and source target/pins/env.sh)" + "aien-omega-gpu: AIEN_REQUIRE_NATIVE_LIBS=1 but AIEN_OMEGA_DIR is not set (run scripts/pins.sh --gpu and source target/pins/env.sh)" ); - println!("cargo:warning=aien-omega-gpu: no AIEN_OMEGA_DIR or AIEN_OMEGA_GPU_LIB, building the CPU stub"); + println!("cargo:warning=aien-omega-gpu: no AIEN_OMEGA_DIR, building the CPU stub"); build::Identity::stub(&pinned).emit(PREFIX); return; }; @@ -117,6 +98,25 @@ fn main() { "omega checkout {} is at '{head}', omega.lock pins {pinned}", dir.display() ); + let cudapp = std::env::var("AIEN_CUDAPP_DIR") + .expect("native GPU source build requires AIEN_CUDAPP_DIR at Omega's cudapp.lock"); + println!("cargo:rerun-if-changed={}", dir.join("cudapp.lock").display()); + let committed_pin = Command::new("git").arg("-C").arg(&dir) + .args(["show", &format!("{pinned}:cudapp.lock")]).output() + .expect("read committed canonical CUDApp pin"); + assert!(committed_pin.status.success(), "pinned Omega revision has no cudapp.lock"); + let locked_pin = std::fs::read(dir.join("cudapp.lock")).expect("read cudapp.lock"); + assert_eq!(locked_pin, committed_pin.stdout, "Omega cudapp.lock differs from its pinned revision"); + watch_checkout(&dir); + watch_checkout(Path::new(&cudapp)); + for path in ["src", "Makefile", "tools/cudapp-stage.sh", "om/consumer.om"] { + println!("cargo:rerun-if-changed={}", dir.join(path).display()); + } + for key in ["OMEGA_OMC", "OMEGA_BRIDGE"] { + if let Ok(path) = std::env::var(key) { + println!("cargo:rerun-if-changed={path}"); + } + } let physics = std::env::var("AIEN_PHYSICS_DIR") .map(PathBuf::from) .unwrap_or_else(|_| dir.join("../physics")); @@ -128,6 +128,7 @@ fn main() { .current_dir(&dir) .arg(format!("OUT_DIR={}", out.display())) .arg(format!("PHYSICS_DIR={}", physics.display())) + .arg(format!("CUDAPP_DIR={cudapp}")) .arg(out.join("libomega_gpu.a")) .status() .expect("run make"); @@ -137,30 +138,101 @@ fn main() { dir.display() ); let archive = out.join("libomega_gpu.a"); - build::qualify_built( - "aien-omega-gpu", + // Resolve once: pin, headers and archive must belong to the same immutable + // stage even if another make atomically publishes a newer stage. + let stage = std::fs::canonicalize(out.join("cudapp")) + .expect("Omega did not publish its canonical CUDApp stage"); + println!("cargo:rerun-if-changed={}", stage.display()); + let verified = Command::new("sh").arg(dir.join("tools/cudapp-stage.sh")) + .arg("--verify").arg(dir.join("cudapp.lock")).arg(&stage) + .stdout(std::process::Stdio::null()) + .status().expect("verify immutable canonical CUDApp stage"); + assert!(verified.success(), "canonical CUDApp stage provenance verification failed"); + let canonical = stage.join("source"); + let canonical_pin = std::fs::read_to_string(stage.join("pin")) + .expect("canonical stage is missing its frozen CUDApp pin"); + assert_eq!(canonical_pin.as_bytes(), locked_pin, "canonical stage pin differs from pinned Omega cudapp.lock"); + let canonical_archive = stage.join("build/libcudapp.a"); + let (companion_identity, canonical_identity) = build::qualify_gpu_pair( &manifest, &artifacts_lock, &dir, &physics, &archive, &pinned, - true, - ) - .emit(PREFIX); - link(&archive); + &canonical, + &canonical_archive, + canonical_pin.trim(), + ); + companion_identity.emit(PREFIX); + canonical_identity.emit("AIEN_CUDAPP"); + link(&archive, &canonical_archive); } -fn link(lib: &Path) { - let dir = lib.parent().expect("lib has a parent dir"); - println!("cargo:rustc-link-search=native={}", dir.display()); - println!("cargo:rustc-link-lib=static=omega_gpu"); +fn link(companion: &Path, canonical: &Path) { + for (lib, name) in [(companion, "omega_gpu"), (canonical, "cudapp")] { + let dir = lib.parent().expect("lib has a parent dir"); + println!("cargo:rustc-link-search=native={}", dir.display()); + println!("cargo:rustc-link-lib=static={name}"); + println!("cargo:rerun-if-changed={}", lib.display()); + } println!("cargo:rustc-link-lib=dylib=pthread"); println!("cargo:rustc-link-lib=dylib=m"); - println!("cargo:rerun-if-changed={}", lib.display()); + emit_capabilities(companion, canonical); println!("cargo:rustc-cfg=has_omega_gpu"); } +fn emit_capabilities(companion: &Path, canonical: &Path) { + use aien_abi_conformance::probe::defined_symbols; + let mut symbols = defined_symbols(companion).expect("cannot inspect Omega GPU companion"); + symbols.extend(defined_symbols(canonical).expect("cannot inspect canonical CUDApp archive")); + let has = |name: &str| symbols.iter().any(|s| s == name); + let fp8 = has("omega_gpu_fp8_gemv_grouped_f32"); + let q38 = has("omega_gpu_q38_graph_create"); + let prefill = has("omega_gpu_pf_qgemm") + && has("omega_gpu_pf_quant") && has("omega_gpu_pf_alloc_dev"); + let pattn = has("omega_gpu_prefill_attn"); + let checks = [ + ("has_omega_bf16", has("omega_gpu_bf16_gemv_f32")), + ("has_omega_dattn", has("omega_gpu_decode_attn")), + ("has_omega_dgraph", has("omega_gpu_decode_graph_create")), + ("has_omega_moe", has("omega_gpu_matmul_resident_windows_f32")), + ("has_omega_router", has("omega_gpu_router")), + ("has_omega_fp8", fp8), + ("has_omega_fp8_dev", fp8 && has("omega_gpu_fp8_gemv_grouped_dev") && has("omega_gpu_fp8_tensor_entry")), + ("has_omega_fp8gemm", fp8 && has("omega_gpu_fp8gemm_f32")), + ("has_omega_fp8_grouped_rule", fp8 && has("omega_gpu_fp8_grouped_ctas_auto")), + ("has_omega_pf", prefill), + ("has_omega_pattn", pattn), + ("has_omega_pattn_dev", pattn && has("omega_gpu_prefill_attn_dev")), + ("has_omega_pfhost", has("omega_gpu_pf_qgemm") && has("omega_gpu_pf_router_logits") + && has("omega_gpu_pf_moe_combine") && has("omega_gpu_pf_router_pack") && has("omega_gpu_pf_router_rows")), + ("has_omega_q38", q38), + ("has_omega_q36", q38 && has("omega_gpu_q36_graph_create")), + ("has_omega_q38_prefill", q38 && has("omega_gpu_gdn_prefill") && has("omega_gpu_prefill_attn256")), + ]; + let capabilities = checks.iter().filter_map(|(cfg, present)| present.then_some(*cfg)) + .collect::>().join(" "); + println!("cargo:capabilities={capabilities}"); +} + +fn watch_checkout(dir: &Path) { + let branch = Command::new("git").arg("-C").arg(dir) + .args(["symbolic-ref", "-q", "HEAD"]).output() + .expect("read checkout branch"); + let mut refs = vec!["HEAD".to_string()]; + if branch.status.success() { + refs.push(String::from_utf8(branch.stdout).expect("git ref UTF-8").trim().into()); + } + for reference in refs { + let path = Command::new("git").arg("-C").arg(dir) + .args(["rev-parse", "--path-format=absolute", "--git-path", &reference]) + .output().expect("read checkout ref path"); + assert!(path.status.success(), "cannot watch native checkout refs"); + println!("cargo:rerun-if-changed={}", String::from_utf8_lossy(&path.stdout).trim()); + } +} + fn env(k: &str) -> String { std::env::var(k).unwrap_or_else(|_| panic!("{k} not set")) } diff --git a/crates/aien-omega-gpu/src/lib.rs b/crates/aien-omega-gpu/src/lib.rs index 7c2d1920..5f97fffd 100644 --- a/crates/aien-omega-gpu/src/lib.rs +++ b/crates/aien-omega-gpu/src/lib.rs @@ -38,9 +38,8 @@ pub const fn is_native() -> bool { cfg!(has_omega_gpu) } -/// What this binary linked for the omega GPU engine (stub, pinned source, developer override or -/// prebuilt), the C ABI check result and the archive digest, as `build.rs` established them. -/// Only `qualifies()` identities count as release-grade native qualification. +/// Omega runtime companion identity. Native builds qualify the complete archive pair +/// before emitting either identity. See [`canonical_identity`] for the GPU implementation. pub fn native_identity() -> aien_abi_conformance::NativeIdentity { aien_abi_conformance::NativeIdentity { component: "libomega_gpu.a", @@ -56,6 +55,22 @@ pub fn native_identity() -> aien_abi_conformance::NativeIdentity { } } +/// Exact canonical CUDApp implementation linked after the Omega runtime companion. +pub fn canonical_identity() -> aien_abi_conformance::NativeIdentity { + aien_abi_conformance::NativeIdentity { + component: "libcudapp.a", + link: env!("AIEN_CUDAPP_LINK"), + abi: env!("AIEN_CUDAPP_ABI"), + digest: env!("AIEN_CUDAPP_DIGEST"), + archive_sha256: env!("AIEN_CUDAPP_ARCHIVE_SHA256"), + source_sha: env!("AIEN_CUDAPP_SOURCE_SHA"), + aienos_lock: env!("AIEN_CUDAPP_AIENOS_LOCK"), + physics_lock: env!("AIEN_CUDAPP_PHYSICS_LOCK"), + target: env!("AIEN_CUDAPP_TARGET"), + cc: env!("AIEN_CUDAPP_CC"), + } +} + #[derive(Debug, Clone, PartialEq, Eq)] pub enum OmegaGpuError { /// Stub build: no native library linked. diff --git a/crates/aien-omega-gpu/tests/abi_manifest.rs b/crates/aien-omega-gpu/tests/abi_manifest.rs index 0679c881..29bcbd70 100644 --- a/crates/aien-omega-gpu/tests/abi_manifest.rs +++ b/crates/aien-omega-gpu/tests/abi_manifest.rs @@ -31,12 +31,17 @@ fn rust_ffi_matches_the_manifest() { fn native_identity_matches_the_link() { let id = aien_omega_gpu::native_identity(); println!("AIEN_NATIVE_IDENTITY {}", id.to_json()); + let canonical = aien_omega_gpu::canonical_identity(); + println!("AIEN_NATIVE_IDENTITY {}", canonical.to_json()); if cfg!(has_omega_gpu) { assert_ne!(id.link, "stub", "{id:?}"); assert!(id.digest != "none", "{id:?}"); + assert!(canonical.qualifies(), "{canonical:?}"); } else { assert_eq!(id.link, "stub", "{id:?}"); assert!(!id.qualifies()); + assert_eq!(canonical.link, "stub", "{canonical:?}"); + assert!(!canonical.qualifies()); } if std::env::var("AIEN_ABI_QUALIFY").as_deref() == Ok("1") { assert!( @@ -47,3 +52,78 @@ fn native_identity_matches_the_link() { ); } } + +/// Execute a real linked archive symbol without opening a GPU device/session. +#[cfg(has_omega_gpu)] +#[test] +fn canonical_archive_host_link_smoke() { + use std::ffi::CStr; + unsafe { + assert_eq!( + CStr::from_ptr(aien_omega_gpu::ffi::omega_gpu_matmul_rc_name(0)).to_bytes(), + b"OK", + ); + assert_eq!( + CStr::from_ptr(aien_omega_gpu::ffi::omega_gpu_matmul_rc_name(-1)).to_bytes(), + b"BAD_ARGS", + ); + } +} + +/// Challenge the existing qualifier using copies of the actual generated archives. +/// Run explicitly with AIEN_GPU_STAGE and AIEN_GPU_COMPANION from the native build. +#[cfg(all(has_omega_gpu, unix))] +#[test] +#[ignore = "requires the exact generated native stage and companion paths"] +fn canonical_pair_artifact_controls() { + use aien_abi_conformance::build::qualify_gpu_pair; + use std::{fs, path::PathBuf}; + let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let stage = fs::canonicalize(std::env::var("AIEN_GPU_STAGE").expect("AIEN_GPU_STAGE")).unwrap(); + let companion = PathBuf::from(std::env::var("AIEN_GPU_COMPANION").expect("AIEN_GPU_COMPANION")); + let omega = PathBuf::from(std::env::var("AIEN_OMEGA_DIR").expect("AIEN_OMEGA_DIR")); + let physics = PathBuf::from(std::env::var("AIEN_PHYSICS_DIR").expect("AIEN_PHYSICS_DIR")); + let canonical = stage.join("source"); + let canonical_archive = stage.join("build/libcudapp.a"); + let pin = fs::read_to_string(stage.join("pin")).unwrap(); + let lock = root.join("../../native-artifacts.lock"); + let manifest = root.join("abi/omega_gpu.manifest"); + let scratch = std::env::temp_dir().join(format!("core-canonical-controls-{}", std::process::id())); + fs::create_dir(&scratch).unwrap(); + std::env::set_var("OUT_DIR", &scratch); + std::env::set_var("TARGET", aien_omega_gpu::native_identity().target); + std::env::set_var("HOST", aien_omega_gpu::native_identity().target); + let qualify = |archive: &std::path::Path, runtime: &std::path::Path, records: &std::path::Path| { + qualify_gpu_pair( + &manifest, records, &omega, &physics, runtime, + aien_omega_gpu::PINNED_OMEGA_SHA, &canonical, archive, pin.trim(), + ) + }; + let original = qualify(&canonical_archive, &companion, &lock); + assert_eq!(original.0.archive_sha256, aien_omega_gpu::native_identity().archive_sha256); + assert_eq!(original.1.archive_sha256, aien_omega_gpu::canonical_identity().archive_sha256); + let archive = scratch.join("libcudapp.a"); + let refuses = |archive: &std::path::Path, runtime: &std::path::Path, records: &std::path::Path| { + assert!(std::panic::catch_unwind(|| qualify(archive, runtime, records)).is_err()); + }; + refuses(&archive, &companion, &lock); // missing canonical artifact + fs::copy(&canonical_archive, &archive).unwrap(); + let mut stale = fs::read(&archive).unwrap(); + stale.push(0); + fs::write(&archive, stale).unwrap(); + refuses(&archive, &companion, &lock); // stale/corrupt canonical artifact + let stale_companion = scratch.join("libomega_gpu.a"); + let mut stale = fs::read(&companion).unwrap(); + stale.push(0); + fs::write(&stale_companion, stale).unwrap(); + refuses(&canonical_archive, &stale_companion, &lock); + let records = fs::read_to_string(&lock).unwrap(); + for missing in ["libomega_gpu.a", "libcudapp.a"] { + let without = records.lines().filter(|line| !line.starts_with(&format!("{missing} "))) + .collect::>().join("\n"); + let incomplete = scratch.join("missing.lock"); + fs::write(&incomplete, without).unwrap(); + refuses(&canonical_archive, &companion, &incomplete); + } + fs::remove_dir_all(scratch).unwrap(); +} diff --git a/crates/aien-omega-moe/build.rs b/crates/aien-omega-moe/build.rs index 195c873b..3b8f267e 100644 --- a/crates/aien-omega-moe/build.rs +++ b/crates/aien-omega-moe/build.rs @@ -13,59 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides whether omega's MoE window API (`src/omega_gpu_moe_api.h`, OWN-30B cut 2) is linked. -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares -//! the extra symbols), so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds -//! `omega_gpu_matmul_resident_windows_f32` defined in that archive. -//! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_moe_api.h`. -//! * otherwise: stub (every call returns `Unavailable`). -//! -//! `cfg(has_omega_moe)` is set only when native. A stub never fails the build: the whole-tensor -//! fallback in the model code stays usable, and `is_native()` says which one a binary carries. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. fn main() { + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); println!("cargo:rustc-check-cfg=cfg(has_omega_moe)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", - ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - if archive_defines(Path::new(&lib), "omega_gpu_matmul_resident_windows_f32") { - println!("cargo:rustc-cfg=has_omega_moe"); - } else { - println!("cargo:warning=aien-omega-moe: {lib} does not define the MoE window API; window calls are stubbed"); - } - return; + if capabilities.split_whitespace().any(|c| c == "has_omega_moe") { + println!("cargo:rustc-cfg=has_omega_moe"); } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let header = Path::new(&dir).join("src/omega_gpu_moe_api.h"); - println!("cargo:rerun-if-changed={}", header.display()); - if header.is_file() { - println!("cargo:rustc-cfg=has_omega_moe"); - } else { - println!("cargo:warning=aien-omega-moe: {dir} has no src/omega_gpu_moe_api.h (omega before OWN-30B cut 2); window calls are stubbed"); - } - } -} - -fn archive_defines(lib: &Path, symbol: &str) -> bool { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-moe: nm not available, assuming the archive lacks the MoE window API"); - return false; - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .any(|l| l.ends_with(&format!(" T {symbol}"))) } diff --git a/crates/aien-omega-pf/build.rs b/crates/aien-omega-pf/build.rs index f7523a43..079ee7a2 100644 --- a/crates/aien-omega-pf/build.rs +++ b/crates/aien-omega-pf/build.rs @@ -13,101 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides which parts of omega's prefill API are linked (pattern of `aien-omega-fp8/build.rs`). -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script; this crate only declares -//! the extra symbols, so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: `nm` decides per symbol. -//! * `AIEN_OMEGA_DIR=`: the headers decide (`src/omega_gpu_prefill.h`, -//! `src/omega_gpu_prefill_attn_api.h`). -//! -//! `cfg(has_omega_pf)`: `omega_gpu_pf_qgemm` defined (quantiser, QMMA grouped GEMM, pf buffers). -//! `cfg(has_omega_pattn)`: `omega_gpu_prefill_attn` defined (host-pointer prefill attention). -//! `cfg(has_omega_pattn_dev)`: `omega_gpu_prefill_attn_dev` defined (device-pointer entry). -//! Otherwise every call returns `Unavailable`; a stub never fails the build. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. fn main() { - for c in ["has_omega_pf", "has_omega_pattn", "has_omega_pattn_dev"] { - println!("cargo:rustc-check-cfg=cfg({c})"); - } - println!("cargo:rustc-check-cfg=cfg(has_omega_pfhost)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); + for cfg in [ + "has_omega_pf", + "has_omega_pattn", + "has_omega_pattn_dev", + "has_omega_pfhost", ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - let syms = defined_symbols(Path::new(&lib)); - let has = |s: &str| syms.iter().any(|d| d == s); - if has("omega_gpu_pf_qgemm") && has("omega_gpu_pf_quant") && has("omega_gpu_pf_alloc_dev") { - println!("cargo:rustc-cfg=has_omega_pf"); - } else { - println!("cargo:warning=aien-omega-pf: {lib} does not define omega_gpu_pf_qgemm; prefill GEMM calls are stubbed"); - } - if has("omega_gpu_prefill_attn") { - println!("cargo:rustc-cfg=has_omega_pattn"); - if has("omega_gpu_prefill_attn_dev") { - println!("cargo:rustc-cfg=has_omega_pattn_dev"); - } - } else { - println!("cargo:warning=aien-omega-pf: {lib} does not define omega_gpu_prefill_attn; prefill attention is stubbed"); - } - // W-L1G-D: router logits + MoE combine (omega_gpu_pfhost.h) - if has("omega_gpu_pf_qgemm") - && has("omega_gpu_pf_router_logits") - && has("omega_gpu_pf_moe_combine") - && has("omega_gpu_pf_router_pack") - && has("omega_gpu_pf_router_rows") - { - println!("cargo:rustc-cfg=has_omega_pfhost"); + println!("cargo:rustc-check-cfg=cfg({cfg})"); + if capabilities.split_whitespace().any(|c| c == cfg) { + println!("cargo:rustc-cfg={cfg}"); } - return; } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let pf = Path::new(&dir).join("src/omega_gpu_prefill.h"); - let pa = Path::new(&dir).join("src/omega_gpu_prefill_attn_api.h"); - println!("cargo:rerun-if-changed={}", pf.display()); - println!("cargo:rerun-if-changed={}", pa.display()); - // W-L1G-D: router logits + MoE combine (omega_gpu_pfhost.h) - let ph = Path::new(&dir).join("src/omega_gpu_pfhost.h"); - println!("cargo:rerun-if-changed={}", ph.display()); - if std::fs::read_to_string(&ph).is_ok_and(|t| { - t.contains("omega_gpu_pf_router_logits(") && t.contains("omega_gpu_pf_moe_combine(") - }) { - println!("cargo:rustc-cfg=has_omega_pfhost"); - } - if std::fs::read_to_string(&pf) - .is_ok_and(|t| t.contains("omega_gpu_pf_qgemm(") && t.contains("omega_gpu_pf_quant(")) - { - println!("cargo:rustc-cfg=has_omega_pf"); - } - if let Ok(t) = std::fs::read_to_string(&pa) { - if t.contains("omega_gpu_prefill_attn(") { - println!("cargo:rustc-cfg=has_omega_pattn"); - if t.contains("omega_gpu_prefill_attn_dev(") { - println!("cargo:rustc-cfg=has_omega_pattn_dev"); - } - } - } - } -} - -fn defined_symbols(lib: &Path) -> Vec { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-pf: nm not available, assuming the archive lacks the prefill API"); - return Vec::new(); - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .filter_map(|l| l.split_once(" T ").map(|(_, s)| s.to_string())) - .collect() } diff --git a/crates/aien-omega-q38/build.rs b/crates/aien-omega-q38/build.rs index 44cbac24..b9caffc8 100644 --- a/crates/aien-omega-q38/build.rs +++ b/crates/aien-omega-q38/build.rs @@ -13,83 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides whether omega's Qwen3.8-27B decode pieces (`src/omega_gpu_q38_graph.h`, sc #642 -//! on the omega side) are linked. -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares -//! the extra symbols), so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds `omega_gpu_q38_graph_create` -//! defined in that archive. -//! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_q38_graph.h`. -//! * otherwise: stub (every call returns `Unavailable`). -//! -//! `cfg(has_omega_q38_prefill)` is set when, in addition, the prefill entries are linked -//! (`omega_gpu_gdn_prefill` and `omega_gpu_prefill_attn256`, omega#543 / #545; with -//! `AIEN_OMEGA_DIR`, the header `src/omega_gpu_prefill_attn256_api.h`). -//! -//! `cfg(has_omega_q38)` is set only when native. A stub never fails the build: the Qwen3.8 -//! engine reports itself unavailable, and `is_native()` says which one a binary carries. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. fn main() { - println!("cargo:rustc-check-cfg=cfg(has_omega_q38)"); - println!("cargo:rustc-check-cfg=cfg(has_omega_q38_prefill)"); - println!("cargo:rustc-check-cfg=cfg(has_omega_q36)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", - ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - if archive_defines(Path::new(&lib), "omega_gpu_q38_graph_create") { - println!("cargo:rustc-cfg=has_omega_q38"); - if archive_defines(Path::new(&lib), "omega_gpu_q36_graph_create") { - println!("cargo:rustc-cfg=has_omega_q36"); - } - if archive_defines(Path::new(&lib), "omega_gpu_gdn_prefill") - && archive_defines(Path::new(&lib), "omega_gpu_prefill_attn256") - { - println!("cargo:rustc-cfg=has_omega_q38_prefill"); - } - } else { - println!("cargo:warning=aien-omega-q38: {lib} does not define the q38 graph API; the Qwen3.8 decode is stubbed"); + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); + for cfg in ["has_omega_q38", "has_omega_q38_prefill", "has_omega_q36"] { + println!("cargo:rustc-check-cfg=cfg({cfg})"); + if capabilities.split_whitespace().any(|c| c == cfg) { + println!("cargo:rustc-cfg={cfg}"); } - return; } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let header = Path::new(&dir).join("src/omega_gpu_q38_graph.h"); - println!("cargo:rerun-if-changed={}", header.display()); - if header.is_file() { - println!("cargo:rustc-cfg=has_omega_q38"); - if Path::new(&dir).join("src/omega_gpu_q36_graph.h").is_file() { - println!("cargo:rustc-cfg=has_omega_q36"); - } - if Path::new(&dir) - .join("src/omega_gpu_prefill_attn256_api.h") - .is_file() - { - println!("cargo:rustc-cfg=has_omega_q38_prefill"); - } - } else { - println!("cargo:warning=aien-omega-q38: {dir} has no src/omega_gpu_q38_graph.h (omega before sc #642); the Qwen3.8 decode is stubbed"); - } - } -} - -fn archive_defines(lib: &Path, symbol: &str) -> bool { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-q38: nm not available, assuming the archive lacks the q38 graph API"); - return false; - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .any(|l| l.ends_with(&format!(" T {symbol}"))) } diff --git a/crates/aien-omega-router/build.rs b/crates/aien-omega-router/build.rs index 14cfe61a..047de3bc 100644 --- a/crates/aien-omega-router/build.rs +++ b/crates/aien-omega-router/build.rs @@ -13,61 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Decides whether omega's one-launch MoE router (`src/omega_gpu_router_api.h`, -//! OWN-30B router cut on the omega side) is linked. -//! -//! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares -//! the extra symbols), so the decision mirrors its inputs: -//! * `AIEN_FORCE_CPU_STUB=1`: stub. -//! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds `omega_gpu_router` defined -//! in that archive. -//! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_router_api.h`. -//! * otherwise: stub (every call returns `Unavailable`). -//! -//! `cfg(has_omega_router)` is set only when native. A stub never fails the build: the engine -//! keeps its host routing, and `is_native()` says which -//! one a binary carries. -use std::path::Path; -use std::process::Command; - +//! Native capabilities come only from the archive-owning aien-omega-gpu build. fn main() { + const KEY: &str = "DEP_OMEGA_GPU_CAPABILITIES"; + println!("cargo:rerun-if-env-changed={KEY}"); + let capabilities = std::env::var(KEY).expect("GPU owner must publish capabilities"); println!("cargo:rustc-check-cfg=cfg(has_omega_router)"); - for v in [ - "AIEN_FORCE_CPU_STUB", - "AIEN_OMEGA_GPU_LIB", - "AIEN_OMEGA_DIR", - ] { - println!("cargo:rerun-if-env-changed={v}"); - } - if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { - return; - } - if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { - println!("cargo:rerun-if-changed={lib}"); - if archive_defines(Path::new(&lib), "omega_gpu_router") { - println!("cargo:rustc-cfg=has_omega_router"); - } else { - println!("cargo:warning=aien-omega-router: {lib} does not define the device router API; the device router is stubbed"); - } - return; + if capabilities.split_whitespace().any(|c| c == "has_omega_router") { + println!("cargo:rustc-cfg=has_omega_router"); } - if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { - let header = Path::new(&dir).join("src/omega_gpu_router_api.h"); - println!("cargo:rerun-if-changed={}", header.display()); - if header.is_file() { - println!("cargo:rustc-cfg=has_omega_router"); - } else { - println!("cargo:warning=aien-omega-router: {dir} has no src/omega_gpu_router_api.h (omega before OWN-30B cut 8); the device router is stubbed"); - } - } -} - -fn archive_defines(lib: &Path, symbol: &str) -> bool { - let Ok(out) = Command::new("nm").arg(lib).output() else { - println!("cargo:warning=aien-omega-router: nm not available, assuming the archive lacks the device router API"); - return false; - }; - String::from_utf8_lossy(&out.stdout) - .lines() - .any(|l| l.ends_with(&format!(" T {symbol}"))) } diff --git a/crates/aien-serve-http/src/kv_persist.rs b/crates/aien-serve-http/src/kv_persist.rs index e87812f2..0ccdb55e 100644 --- a/crates/aien-serve-http/src/kv_persist.rs +++ b/crates/aien-serve-http/src/kv_persist.rs @@ -94,6 +94,7 @@ pub const NUMERIC_ENV: &[&str] = &[ pub const NEUTRAL_ENV: &[&str] = &[ "AIEN_OMEGA_SPIN_US", "AIEN_OMEGA_DIR", + "AIEN_CUDAPP_DIR", "AIEN_OMEGA_GPU", "AIEN_OMEGA_GPU_LIB", "AIEN_OMEGA_GPU_LIB_SHA256", @@ -115,9 +116,11 @@ pub const MUTANT_ENV: &[&str] = &["OWN30B_DECODE_GRAPH_MUTANT"]; pub struct OmegaBuild { /// The omega commit `omega.lock` pins. pub omega_commit: String, - /// How `libomega_gpu.a` was linked (`pinned-source`, `dev-override`, `prebuilt`, `stub`). + /// How the retained Omega companion was linked. Its pinned Omega commit also + /// binds canonical CUDApp through the committed cudapp.lock; both archive + /// records must pass before a native identity is emitted. pub gpu_link: String, - /// sha256 of the linked `libomega_gpu.a`. + /// sha256 of the retained Omega companion, not the canonical GPU implementation. pub gpu_archive_sha256: String, /// `locked` (the sha `native-artifacts.lock` records), `unrecorded` (no record for this /// commit and target), `mismatch` or `none`. diff --git a/crates/aien-serve-http/src/main.rs b/crates/aien-serve-http/src/main.rs index 97022f2d..933fae21 100644 --- a/crates/aien-serve-http/src/main.rs +++ b/crates/aien-serve-http/src/main.rs @@ -71,6 +71,7 @@ const DEFAULT_MODEL_DIR: &str = "models/qwen3.8-27b-fp8-017b9c7a"; /// which loads nothing and never touches the GPU, so installers can refuse a stub build. fn build_info() -> String { let gpu = aien_omega_gpu::native_identity(); + let canonical = aien_omega_gpu::canonical_identity(); let native = |b: bool| { if b { "native" @@ -83,6 +84,7 @@ fn build_info() -> String { sovereign-core commit: {} (dirty {})\n\ omega.lock: {}\n\ omega gpu engine: {} (link {}, abi {}, digest {}, archive sha256 {})\n\ + canonical CUDApp: {} (link {}, abi {}, digest {}, archive sha256 {})\n\ qwen38 engine: {} (prefill {})\n\ release-grade native identity: {}\n\ default model dir: $HOME/{}\n", @@ -95,13 +97,18 @@ fn build_info() -> String { gpu.abi, gpu.digest, gpu.archive_sha256, + canonical.source_sha, + canonical.link, + canonical.abi, + canonical.digest, + canonical.archive_sha256, native(aien_omega_q38::is_native()), if aien_omega_q38::has_prefill() { "linked" } else { "missing" }, - if gpu.qualifies() { "yes" } else { "no" }, + if gpu.qualifies() && canonical.qualifies() { "yes" } else { "no" }, DEFAULT_MODEL_DIR, ) } diff --git a/docs/abi-qualification/INVENTORY.md b/docs/abi-qualification/INVENTORY.md index 1697d20c..fbf6481d 100644 --- a/docs/abi-qualification/INVENTORY.md +++ b/docs/abi-qualification/INVENTORY.md @@ -12,7 +12,7 @@ sovereign-core main `bd438bcc`. Tags: **implemented** (true before this work), * | Boundary | Producer | Consumer | Linked into production | |---|---|---|---| | rxc_host v2 (composition facade) | om `src/runtime/rxc_host_abi.h`, `.c`; archive `librx_compose.a` (`mk/rx_compose_lib.mk`) | sc `crates/aien-omega-compose` | yes (aien-runtime, aien-cli) | -| omega GPU engine | om `src/omega_gpu_{matmul_api,session,serving,elementwise_api,attention_api}.h`; `libomega_gpu.a` | sc `crates/aien-omega-gpu`, used by `aien-inference-abi` | yes on the GB10 build | +| omega GPU engine | canonical CUDApp `src/omega_gpu_{matmul_api,session,serving,elementwise_api,attention_api}.h`; canonical `libcudapp.a` after retained Omega `libomega_gpu.a` companion | sc `crates/aien-omega-gpu`, all satellite capability selectors, `aien-inference-abi` | candidate source cutover, pending final dependency pins and host evidence | | AIENOS capability authority (C, 64-bit generation) | ao `native/capability/aienos_capability.h` | om `src/runtime/aienos_cap.h` (hand copy), merged into `librx_compose.a` | yes, through librx_compose.a | | AIENOS capability (Rust, 32-bit generation) | ao `crates/aienos-capability-ffi` | nothing in sc, om or ao links it (grep, 2026-10-11) | no | @@ -63,10 +63,10 @@ C side implemented before (`ao native/capability/capability_test.c`); Rust side | Item | Before | Now | |---|---|---| | omega.lock checkout check | implemented (compose build.rs, GPU build.rs) | kept | -| prebuilt `*_LIB` | accepted with no digest | fixed: `*_LIB_SHA256` required and matched, every manifest function must be defined; identity `prebuilt`, never qualifies | +| prebuilt `*_LIB` | accepted with no digest | composition requires a matching caller-selected digest and symbols, reports `prebuilt`, never qualifies. GPU `AIEN_OMEGA_GPU_LIB` is refused: only pinned canonical source plus retained Omega companion is supported. | | stub under `AIEN_REQUIRE_NATIVE_LIBS=1` | `AIEN_FORCE_CPU_STUB=1` silently won | fixed: refused | -| expected vs actual digest | missing | fixed: `native-artifacts.lock` (archive, omega sha, target, cc version, sha256); mismatch fails the build, unlisted combination warns and does not qualify | -| provenance in the binary | missing | fixed: `native_identity()` in both crates (link kind, ABI result, digest state, archive sha256, omega, aienos.lock, physics.lock, target, cc) | +| expected vs actual digest | missing | `native-artifacts.lock` records archive, source SHA, target, cc version and sha256. Composition retains its existing unrecorded-build warning. GPU builds require recorded matching entries for both Omega companion and canonical CUDApp archive; missing or stale entries refuse. | +| provenance in the binary | missing | `native_identity()` records Omega companion; GPU `canonical_identity()` records CUDApp separately using the same identity format. Both are printed by host ABI tests and must qualify in `scripts/abi-qualify.sh`. | | sovereign-core commit, flags, tools | missing | `scripts/abi-qualify.sh` evidence.json | ## Section 8: safe cross-language execution diff --git a/docs/qwen38/TRY_IT_ON_YOUR_SPARK.md b/docs/qwen38/TRY_IT_ON_YOUR_SPARK.md index 97cbf2d7..d0a225ab 100644 --- a/docs/qwen38/TRY_IT_ON_YOUR_SPARK.md +++ b/docs/qwen38/TRY_IT_ON_YOUR_SPARK.md @@ -75,6 +75,11 @@ cd aien-sovereign-core-mv `--with-model` also downloads and checks the model (section 3). Leave it out if you want to fetch the model yourself. +For the canonical CUDApp source-cutover candidate, export `OMEGA_OMC` and +`OMEGA_BRIDGE` pointing to the compiler and bridge matching canonical CUDApp's +`om/units.sh` pins before invoking the installer. Missing selections are refused. +This candidate's host source/link checks do not constitute GPU qualification. + Keep `~/aien-install.log`: it is one of the things to paste when you report a problem. What the installer does with `--with-server --with-model`, in order: @@ -84,12 +89,13 @@ What the installer does with `--with-server --with-model`, in order: free memory. Then free disk for the model (the block that starts with `[*] Model download: checking`). A failed check stops the installer before anything is cloned, built or downloaded and says what is wrong in plain words. -2. Fetches the pinned Omega, physics and aienos sources from GitHub into `target/pins/` - (`scripts/pins.sh --gpu`). The exact commits are in `omega.lock` and the lock files next to - it. -3. Builds the Omega GPU library from those sources and the server - `aien-serve-http` against it (`cargo build --locked --release -p aien-serve-http`). This is - the long step. +2. Fetches pinned Omega, canonical CUDApp, physics and aienos sources into `target/pins/` + (`scripts/pins.sh --gpu`). Core `omega.lock` pins Omega; that committed revision's + `cudapp.lock` pins CUDApp, alongside its existing physics and aienos locks. +3. Regenerates/checks canonical units with the pinned toolchain, builds the canonical + `libcudapp.a` and retained Omega `libomega_gpu.a` companion, and links the server + (`cargo build --locked --release -p aien-serve-http`). Both archive digests must match + `native-artifacts.lock`; headers or caller-selected archives cannot enable native mode. 4. Runs `aien-serve-http --version` and refuses to install a binary that has only the CPU stub instead of the real engine. 5. Installs `aien-serve-http` and the start script `aien-serve-27b` into `~/.local/bin`, along diff --git a/install.sh b/install.sh index eff74d7a..832ddb5b 100755 --- a/install.sh +++ b/install.sh @@ -359,15 +359,17 @@ server_preflight() { server_build() { local pins="${AIEN_PINS_DIR:-$SOURCE_ROOT/target/pins}" local out="${CARGO_TARGET_DIR:-$SOURCE_ROOT/target}/release/aien-serve-http" - echo "[*] Model server: fetching the pinned omega, physics and aienos sources into $pins" + echo "[*] Model server: fetching pinned Omega, canonical CUDApp, physics and aienos sources into $pins" bash "$SOURCE_ROOT/scripts/pins.sh" --gpu "$pins" \ || server_die "scripts/pins.sh --gpu failed (see the lines above). Check the network and that git can reach github.com." [[ -f "$pins/env.sh" ]] || server_die "scripts/pins.sh did not write $pins/env.sh." # shellcheck disable=SC1091 . "$pins/env.sh" - [[ "${AIEN_REQUIRE_NATIVE_LIBS:-}" == 1 && -n "${AIEN_OMEGA_DIR:-}" ]] \ - || server_die "$pins/env.sh does not select the GPU engine (AIEN_OMEGA_DIR unset)." - echo "[*] Model server: building aien-serve-http (release, links AIEN's Omega GPU library; this takes a while)" + [[ "${AIEN_REQUIRE_NATIVE_LIBS:-}" == 1 && -n "${AIEN_OMEGA_DIR:-}" && -n "${AIEN_CUDAPP_DIR:-}" ]] \ + || server_die "$pins/env.sh does not select both pinned GPU sources." + [[ -n "${OMEGA_OMC:-}" && -n "${OMEGA_BRIDGE:-}" ]] \ + || server_die "Set OMEGA_OMC and OMEGA_BRIDGE matching canonical CUDApp om/units.sh pins. No alternate GPU implementation is installed." + echo "[*] Model server: building aien-serve-http (release, links Omega companion then canonical CUDApp)" cargo build --locked --release -p aien-serve-http \ || server_die "cargo build of aien-serve-http failed (see the lines above)." [[ -x "$out" ]] || server_die "the build finished but $out is missing." diff --git a/native-artifacts.lock b/native-artifacts.lock index 8ca3b6b3..c995370d 100644 --- a/native-artifacts.lock +++ b/native-artifacts.lock @@ -1,9 +1,10 @@ -# Recorded digests of the omega archives sovereign-core links (aien-abi-conformance). -# One line per archive: -# A build from the pinned omega checkout for a listed target and compiler must produce exactly -# this digest, or build.rs fails. A combination not listed builds with a warning and its -# native_identity() reports digest "unrecorded", which does not qualify. -# Update only from a qualification run (scripts/abi-qualify.sh prints the lines to add). +# Recorded digests of native archives sovereign-core links (aien-abi-conformance). +# One line per archive: +# Source is the pinned Omega commit for its companion/composition archives, or the +# frozen CUDApp commit for libcudapp.a. A listed combination must match exactly. +# GPU builds require locked records for BOTH archives. Composition retains the +# existing unrecorded-build warning; such an identity does not qualify. +# Add records only from actual fresh pinned artifact builds, never estimated digests. librx_compose.a 41f8813a25357256da9b078fe6533a0be1487b6d aarch64-unknown-linux-gnu a701a0db5e396acc1a0898d19acefcaf199556cf7f81b0c57a6b7c8402a02cc4 cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 libomega_gpu.a 41f8813a25357256da9b078fe6533a0be1487b6d aarch64-unknown-linux-gnu a687ffa0fe94916ac127b1a704f5df5c078cfba19f6f0132d83999cf2f7af059 cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 librx_compose.a aa1c4af2afa9f36d2304b4917499bd7500b4778c aarch64-unknown-linux-gnu a701a0db5e396acc1a0898d19acefcaf199556cf7f81b0c57a6b7c8402a02cc4 cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 diff --git a/scripts/.crumb b/scripts/.crumb index 4e5fac04..a6e16637 100644 --- a/scripts/.crumb +++ b/scripts/.crumb @@ -4,14 +4,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-26T15:46:25Z", + "compiled_at": "2026-10-28T13:29:00Z", "compiler": "crumb-compile/1", - "digest": "sha256:af5f9d6a21e7bdc0bce013df14b00648a9571513c9b719874799917e19e4e203", + "digest": "sha256:58faf6de9fc6aa2d82c8ab701347f389b1a19803972c8d7a977e75bfff668a58", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 56, - "generated_at_commit": "bf15e82a44fbfa04cbffdafce433d4cd5ed66df4", - "source_tree": "sha256:a1ba69a25e552a054b8b894064f4e7e464b8c4faf2b97a4cfd6b42daa1c5564e" + "generated_at_commit": "1604a72b248aba8b0e41e5379814372d8fd59304", + "source_tree": "sha256:3a0ee2f00cd9bd170ffb7b771431f9be121b4f9971ed29f61616b981a2271464" } }, "parent": { diff --git a/scripts/abi-qualify.sh b/scripts/abi-qualify.sh index 1d20f66e..92614485 100755 --- a/scripts/abi-qualify.sh +++ b/scripts/abi-qualify.sh @@ -101,7 +101,7 @@ fi # 2. What was linked: one identity line per native library, each must qualify. IDS=$(cat "$OUT"/compose.log "$OUT"/gpu-host.log 2>/dev/null | sed -n 's/.*AIEN_NATIVE_IDENTITY \({.*}\).*/\1/p' | sort -u) -for c in librx_compose.a libomega_gpu.a; do +for c in librx_compose.a libomega_gpu.a libcudapp.a; do if printf '%s\n' "$IDS" | grep -F "\"component\":\"$c\"" | grep -qF '"qualifies":true'; then record "identity-$c" pass "" elif [ "${AIEN_REQUIRE_NATIVE_LIBS:-}" = "1" ]; then diff --git a/scripts/own30b-chip-run.sh b/scripts/own30b-chip-run.sh index faaea8a3..434da3c6 100755 --- a/scripts/own30b-chip-run.sh +++ b/scripts/own30b-chip-run.sh @@ -32,7 +32,7 @@ repo=$(cd "$(dirname "$0")/.." && pwd) echo "sc commit $(git -C "$repo" rev-parse HEAD) branch $(git -C "$repo" rev-parse --abbrev-ref HEAD)" echo "binary $bin sha256 $(sha256sum "$bin" | cut -d' ' -f1)" echo "golden $golden sha256 $(sha256sum "$golden" | cut -d' ' -f1)" - echo "omega lib ${AIEN_OMEGA_GPU_LIB:-pinned omega.lock} ${AIEN_OMEGA_GPU_LIB_SHA256:-}" + echo "omega companion pinned by omega.lock; canonical CUDApp pinned by Omega cudapp.lock" echo "env AIEN_OMEGA_SPIN_US=${AIEN_OMEGA_SPIN_US:-} AIEN_OMEGA_CTA_BUDGET=${AIEN_OMEGA_CTA_BUDGET:-}" echo "cmd flock /tmp/aien-gb10.lock $bin chip $ckpt $golden $ev/$name $*" free -g | head -2 diff --git a/scripts/own30b-pkv-chip-check.sh b/scripts/own30b-pkv-chip-check.sh index 01e700f2..d49b9c9b 100755 --- a/scripts/own30b-pkv-chip-check.sh +++ b/scripts/own30b-pkv-chip-check.sh @@ -24,7 +24,8 @@ # --dry-run prints the plan and checks the prerequisites; it starts no server. # The binary must be a native release build of this branch from a clean checkout (dirty or # unknown builds refuse persistence by design), e.g. -# AIEN_OMEGA_DIR= cargo build --release -p aien-serve-http +# source target/pins/env.sh # generated by scripts/pins.sh --gpu +# OMEGA_OMC= OMEGA_BRIDGE= cargo build --release -p aien-serve-http # # Key: atlas-vault entry AIEN_KV_STORE_KEY by default; PKV_CHECK_EPHEMERAL_KEY=1 makes a # throwaway key (never printed or saved). Stores are private temp dirs. Refuses while :18091 diff --git a/scripts/pins.sh b/scripts/pins.sh index a43dac3d..3e5b5fd6 100755 --- a/scripts/pins.sh +++ b/scripts/pins.sh @@ -14,9 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pins.sh: materialize the three pinned checkouts a native (no CUDA) build needs, -# exactly as CI does (ci.yml "Linked composition tests"), so a clean clone plus one -# command yields the real omega libraries instead of the CPU stubs (sovereign-core #92). +# pins.sh: materialize pinned checkouts for native composition and optional GPU builds. +# The GPU implementation is canonical CUDApp, pinned by Omega's cudapp.lock. +# The Omega GPU archive is only its retained runtime companion. # # omega at omega.lock (this repository) # physics at omega's physics.lock @@ -25,8 +25,8 @@ # Usage: scripts/pins.sh [--gpu] [--check] [DIR] # DIR where the checkouts live (default target/pins). Existing clones are reused; # the network is touched only when a clone is missing or not at its pin. -# --gpu env.sh also sets AIEN_OMEGA_DIR, which links the GB10 engine (aien-omega-gpu). -# Without it only the composition library (CPU) is linked, as the CI gate does. +# --gpu also materializes CUDApp at Omega's cudapp.lock and exports both GPU inputs. +# Without it only the composition library (CPU) is linked. # --check verify only: every clone present and at its pin, no network, no writes. # Writes DIR/env.sh. Then: . target/pins/env.sh && cargo build --release # Env: AIEN_PINS_REMOTE_BASE (default https://github.com/aien-dev; a local mirror directory @@ -60,15 +60,15 @@ is_sha() { [[ "$1" =~ ^[0-9a-f]{40}$ ]]; } head_of() { git -C "$1" rev-parse HEAD 2>/dev/null || true; } # place NAME SHA: make DIR/NAME a clone at SHA (detached), fetching only when needed. place() { - local name="$1" sha="$2" + local name="$1" sha="$2" remote="${3:-$1$SUFFIX}" local d="$DIR/$name" is_sha "$sha" || die "$name pin is not a full 40-hex sha: '$sha'" if [ "$(head_of "$d")" = "$sha" ]; then echo "pins: $name at $sha (present)"; return 0; fi [ "$CHECK" -eq 0 ] || die "$name is not at $sha under --check (have '$(head_of "$d")', dir $d)" mkdir -p "$DIR" if [ ! -d "$d/.git" ]; then - echo "pins: cloning $name from $BASE/$name$SUFFIX" - git clone -q "$BASE/$name$SUFFIX" "$d" || { echo "pins.sh: clone of $name ($BASE/$name$SUFFIX) failed" >&2; exit 4; } + echo "pins: cloning $name from $BASE/$remote" + git clone -q "$BASE/$remote" "$d" || { echo "pins.sh: clone of $name ($BASE/$remote) failed" >&2; exit 4; } fi if ! git -C "$d" cat-file -e "$sha^{commit}" 2>/dev/null; then git -C "$d" fetch -q origin "$sha" || git -C "$d" fetch -q origin || { echo "pins.sh: fetch of $name failed" >&2; exit 4; } @@ -83,16 +83,28 @@ place omega "$(sha_of "$ROOT/omega.lock")" [ -f "$DIR/omega/aienos.lock" ] || die "omega checkout has no aienos.lock" place physics "$(sha_of "$DIR/omega/physics.lock")" place aienos "$(sha_of "$DIR/omega/aienos.lock")" +if [ "$GPU" -eq 1 ]; then + [ -f "$DIR/omega/cudapp.lock" ] || die "omega checkout has no canonical cudapp.lock" + place cudapp "$(sha_of "$DIR/omega/cudapp.lock")" CUDApp +fi if [ "$CHECK" -eq 0 ]; then { echo "# written by scripts/pins.sh; source it before cargo build/test" echo "export AIEN_OMEGA_COMPOSE_DIR='$DIR/omega'" echo "export AIEN_PHYSICS_DIR='$DIR/physics'" echo "export AIEN_AIENOS_LOCK_REPO='$DIR/aienos'" - if [ "$GPU" -eq 1 ]; then echo "export AIEN_OMEGA_DIR='$DIR/omega'"; else echo "unset AIEN_OMEGA_DIR"; fi + if [ "$GPU" -eq 1 ]; then + echo "export AIEN_OMEGA_DIR='$DIR/omega'" + echo "export AIEN_CUDAPP_DIR='$DIR/cudapp'" + else + echo "unset AIEN_OMEGA_DIR AIEN_CUDAPP_DIR" + fi echo "unset AIEN_OMEGA_GPU_LIB AIEN_OMEGA_COMPOSE_LIB AIEN_OMEGA_COMPOSE_SHA AIEN_FORCE_CPU_STUB AIEN_DEV_FALLBACK" echo "export AIEN_REQUIRE_NATIVE_LIBS=1" } > "$DIR/env.sh" echo "pins: wrote $DIR/env.sh ($([ "$GPU" -eq 1 ] && echo 'GPU engine + composition' || echo 'composition only, CPU'))" echo "next: . '$DIR/env.sh' && cargo build --release" + if [ "$GPU" -eq 1 ]; then + echo "GPU build also requires OMEGA_OMC and OMEGA_BRIDGE matching canonical CUDApp om/units.sh pins." + fi fi diff --git a/scripts/test-install.sh b/scripts/test-install.sh index 8d23ae61..358022fd 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -72,8 +72,8 @@ EOF cat > "$WORK/mocks/pins.sh" <<'EOF' #!/usr/bin/env bash [[ "$1" == --gpu ]] || { echo "pins.sh called without --gpu" >&2; exit 2; } -mkdir -p "$2/omega" -printf "export AIEN_OMEGA_DIR='%s/omega'\nexport AIEN_REQUIRE_NATIVE_LIBS=1\n" "$2" > "$2/env.sh" +mkdir -p "$2/omega" "$2/cudapp" +printf "export AIEN_OMEGA_DIR='%s/omega'\nexport AIEN_CUDAPP_DIR='%s/cudapp'\nexport AIEN_REQUIRE_NATIVE_LIBS=1\n" "$2" "$2" > "$2/env.sh" echo "pins.sh --gpu $2" >> "$MOCK_STATE/pins.calls" EOF @@ -87,8 +87,8 @@ args=" $* " [[ "$args" == *" --locked "* ]] || { echo "cargo build is not --locked" >&2; exit 1; } mkdir -p target/release if [[ "$args" == *" -p aien-serve-http "* ]]; then - [[ "${AIEN_REQUIRE_NATIVE_LIBS:-}" == 1 && -n "${AIEN_OMEGA_DIR:-}" ]] \ - || { echo "server build without the pins env (AIEN_REQUIRE_NATIVE_LIBS, AIEN_OMEGA_DIR)" >&2; exit 1; } + [[ "${AIEN_REQUIRE_NATIVE_LIBS:-}" == 1 && -n "${AIEN_OMEGA_DIR:-}" && -n "${AIEN_CUDAPP_DIR:-}" ]] \ + || { echo "server build without both pinned source selections" >&2; exit 1; } echo "server build" >> "$MOCK_STATE/cargo.calls" if [[ "${MOCK_SERVER_KIND:-native}" == native ]]; then e="native"; else e="STUB (not usable with --engine omega)"; fi printf '#!/bin/sh\nprintf "aien-serve-http 0.1.0\\nomega gpu engine: %s\\nqwen38 engine: %s\\n"\n' "$e" "$e" > target/release/aien-serve-http @@ -156,6 +156,8 @@ run_case() { TMPDIR="$C/tmp" \ AIEN_BIN_DIR="$C/bin" \ AIEN_CONFIG_DIR="$C/config" \ + OMEGA_OMC="${CASE_OMEGA_OMC-fixture-omc}" \ + OMEGA_BRIDGE="${CASE_OMEGA_BRIDGE-fixture-bridge}" \ AIEN_INSTALL_NO_PROFILE=1 \ bash -s -- "$@" < "$ROOT/install.sh" ) > "$WORK/install.log" 2>&1 @@ -195,6 +197,12 @@ AIEN_RELEASE_TAG=v0.0.0 run_case release-tag --with-server grep -q "cannot be combined with AIEN_RELEASE_TAG" "$WORK/install.log" || fail "--with-server with a release tag must say why" echo "PASS: --with-server refuses a release install" +AIEN_TEST_SERVER_SKIP_HW_CHECKS=1 CASE_OMEGA_OMC="" run_case no-compiler --with-server +[[ $status -ne 0 ]] || fail "native server install must refuse a missing compiler selection" +grep -q "Set OMEGA_OMC and OMEGA_BRIDGE" "$WORK/install.log" || fail "missing compiler refusal must explain the pinned toolchain requirement" +! grep -q "server build" "$C/state/cargo.calls" || fail "missing compiler must stop before the server build" +echo "PASS: --with-server refuses missing pinned toolchain selection" + # 4. A build that linked only the CPU stub: refused loudly, nothing installed for the server. AIEN_TEST_SERVER_SKIP_HW_CHECKS=1 MOCK_SERVER_KIND=stub run_case stub --with-server [[ $status -ne 0 ]] || fail "a CPU stub server build must fail the install" @@ -280,4 +288,4 @@ grep -q 'KEEP_FREE: u64 = 8 << 30' "$ROOT/crates/aien-serve-http/src/qwen38_engi echo "PASS: install preflight and the docs give the 49,497 MiB (48.3 GiB) load requirement" # Exercise detached startup failure, bounded readiness, API identity, ownership, and foreground behavior with fixtures. -"$ROOT/scripts/test-serve-27b.sh" +AIEN_SERVE_HTTP_BEARER_TOKEN=installer-test-fixture "$ROOT/scripts/test-serve-27b.sh" diff --git a/scripts/test-native-identity.sh b/scripts/test-native-identity.sh index 8a7acc49..7dfcdd9f 100755 --- a/scripts/test-native-identity.sh +++ b/scripts/test-native-identity.sh @@ -18,10 +18,10 @@ # Runs without omega: every case below must be decided by build.rs before any make. # - a stub together with AIEN_REQUIRE_NATIVE_LIBS=1 is refused # - AIEN_REQUIRE_NATIVE_LIBS=1 with no library source is refused -# - a prebuilt archive with no expected sha256, a wrong one, or a truncated archive is refused -# - a prebuilt archive that misses one ABI function is refused +# - composition prebuilt missing/wrong digests or symbols are refused +# - GPU prebuilt archives are refused, including matching caller-selected digests # - an omega checkout at a commit other than omega.lock is refused -# - a correct prebuilt archive builds, and its identity says "prebuilt" (never qualifies) +# - a correct composition prebuilt says "prebuilt" (never qualifies) # Exit 0 when every case behaves, 1 otherwise. set -euo pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) @@ -63,21 +63,37 @@ fake_archive() { WRONG="$WORK/wrong-omega" git init -q "$WRONG" git -C "$WRONG" -c user.name=t -c user.email=t@t commit -q --allow-empty -m wrong +mkdir -p "$WRONG/src" +: >"$WRONG/src/omega_gpu_fp8.h" check_crate() { local crate=$1 manifest=$2 libvar=$3 dirvar=$4 drop=$5 local good="$WORK/$crate-good.a" short="$WORK/$crate-short.a" miss="$WORK/$crate-miss.a" - fake_archive "$manifest" "$good" - fake_archive "$manifest" "$miss" "$drop" local sha miss_sha + if [ "$crate" = aien-omega-gpu ]; then + ar rcs "$good" + head -c 4 "$good" >"$short" + else + fake_archive "$manifest" "$good" + fake_archive "$manifest" "$miss" "$drop" + miss_sha=$(sha256sum "$miss" | cut -d' ' -f1) + head -c 100 "$good" >"$short" + fi sha=$(sha256sum "$good" | cut -d' ' -f1) - miss_sha=$(sha256sum "$miss" | cut -d' ' -f1) - head -c 100 "$good" >"$short" expect_refused "$crate" "stub with required native" "contradict each other" \ AIEN_FORCE_CPU_STUB=1 AIEN_REQUIRE_NATIVE_LIBS=1 expect_refused "$crate" "required native with no library" "AIEN_REQUIRE_NATIVE_LIBS=1 but" \ AIEN_REQUIRE_NATIVE_LIBS=1 + if [ "$crate" = aien-omega-gpu ]; then + expect_refused "$crate" "unverified prebuilt" "is no longer supported" "$libvar=$good" + expect_refused "$crate" "matching prebuilt still refused" "is no longer supported" \ + "$libvar=$good" "${libvar}_SHA256=$sha" + expect_refused "$crate" "truncated prebuilt still refused" "is no longer supported" \ + "$libvar=$short" "${libvar}_SHA256=$sha" + expect_refused "$crate" "omega checkout at the wrong commit" "is at '" "$dirvar=$WRONG" + return + fi expect_refused "$crate" "prebuilt with no sha256" "no expected digest" \ "$libvar=$good" expect_refused "$crate" "prebuilt with a wrong sha256" "expects" \ @@ -103,6 +119,8 @@ check_crate aien-omega-compose crates/aien-omega-compose/abi/rxc_host_abi.manife AIEN_OMEGA_COMPOSE_LIB AIEN_OMEGA_COMPOSE_DIR rxc_host_recover AIEN_OMEGA_COMPOSE check_crate aien-omega-gpu crates/aien-omega-gpu/abi/omega_gpu.manifest \ AIEN_OMEGA_GPU_LIB AIEN_OMEGA_DIR omega_gpu_matmul_f32 AIEN_OMEGA_GPU +expect_refused aien-omega-fp8 "header-only checkout cannot enable native capability" "is at '" \ + "AIEN_OMEGA_DIR=$WRONG" if [ "$fails" -ne 0 ]; then echo "native identity: $fails case(s) failed" diff --git a/scripts/test-pins.sh b/scripts/test-pins.sh index f0e57d89..05ec4388 100755 --- a/scripts/test-pins.sh +++ b/scripts/test-pins.sh @@ -17,7 +17,7 @@ # test-pins.sh: offline self-test of scripts/pins.sh with throwaway git repositories # (no network). Proves: correct pins pass (--check and a full run against a local mirror), # a checkout off its pin is refused (exit 3), a malformed lock is refused (exit 3), and -# env.sh carries the three directories and the AIEN_OMEGA_DIR choice. +# env.sh carries the composition directories and both canonical GPU input choices. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" T=$(mktemp -d); trap 'rm -rf "$T"' EXIT @@ -29,7 +29,8 @@ mk() { # mk NAME [FILE CONTENT]...: a one-commit repo under $T/mirror/NAME, prin [ -n "$(ls -A "$d" | grep -v '^.git$')" ] || : > "$d/.keep" git -C "$d" add -A; git -C "$d" -c user.name=t -c user.email=t@t commit -q -m pin; git -C "$d" rev-parse HEAD } -P=$(mk physics); A=$(mk aienos); O=$(mk omega physics.lock "$P" aienos.lock "$A") +P=$(mk physics); A=$(mk aienos); C=$(mk CUDApp) +O=$(mk omega physics.lock "$P" aienos.lock "$A" cudapp.lock "$C") mkdir -p "$T/root"; printf '%s\n' "$O" > "$T/root/omega.lock" run() { AIEN_PINS_ROOT="$T/root" AIEN_PINS_REMOTE_BASE="$T/mirror" bash "$ROOT/scripts/pins.sh" "$@"; } echo "test-pins: full run against a local mirror" @@ -39,6 +40,12 @@ chk '[ "$(git -C "$T/pins/physics" rev-parse HEAD)" = "$P" ]' "physics at omega chk '[ "$(git -C "$T/pins/aienos" rev-parse HEAD)" = "$A" ]' "aienos at omega aienos.lock" chk 'grep -q "AIEN_OMEGA_COMPOSE_DIR=.*pins/omega" "$T/pins/env.sh" && grep -q "unset AIEN_OMEGA_DIR" "$T/pins/env.sh"' "env.sh: composition only without --gpu" chk 'run --gpu "$T/pins" >/dev/null && grep -q "export AIEN_OMEGA_DIR=.*pins/omega" "$T/pins/env.sh"' "env.sh: --gpu sets AIEN_OMEGA_DIR" +chk '[ "$(git -C "$T/pins/cudapp" rev-parse HEAD)" = "$C" ]' "CUDApp at Omega cudapp.lock" +chk 'grep -q "export AIEN_CUDAPP_DIR=.*pins/cudapp" "$T/pins/env.sh"' "env.sh: --gpu exports canonical CUDApp checkout" +git -C "$T/pins/cudapp" -c user.name=t -c user.email=t@t commit -q --allow-empty -m drift +rc=0; run --gpu --check "$T/pins" >/dev/null 2>&1 || rc=$? +chk '[ "$rc" -eq 3 ]' "--gpu --check refuses stale CUDApp (exit 3, got $rc)" +chk 'run --gpu "$T/pins" >/dev/null' "full GPU pin materialization repairs CUDApp drift" chk 'grep -q "AIEN_REQUIRE_NATIVE_LIBS=1" "$T/pins/env.sh"' "env.sh: stubs refused (AIEN_REQUIRE_NATIVE_LIBS=1)" chk 'run --check "$T/pins" >/dev/null' "--check passes when every clone is at its pin" echo "test-pins: refusals" @@ -46,6 +53,17 @@ git -C "$T/pins/physics" -c user.name=t -c user.email=t@t commit -q --allow-empt rc=0; run --check "$T/pins" >/dev/null 2>&1 || rc=$? chk '[ "$rc" -eq 3 ]' "--check refuses a checkout off its pin (exit 3, got $rc)" chk 'run "$T/pins" >/dev/null && [ "$(git -C "$T/pins/physics" rev-parse HEAD)" = "$P" ]' "a full run moves it back to the pin" +printf 'not-a-sha\n' > "$T/mirror/omega/cudapp.lock" +git -C "$T/mirror/omega" add cudapp.lock +git -C "$T/mirror/omega" -c user.name=t -c user.email=t@t commit -q -m malformed-cudapp-pin +git -C "$T/mirror/omega" rev-parse HEAD > "$T/root/omega.lock" +rc=0; run --gpu "$T/pins" >/dev/null 2>&1 || rc=$? +chk '[ "$rc" -eq 3 ]' "malformed canonical CUDApp pin refused (exit 3, got $rc)" +git -C "$T/mirror/omega" rm -q cudapp.lock +git -C "$T/mirror/omega" -c user.name=t -c user.email=t@t commit -q -m missing-cudapp-pin +git -C "$T/mirror/omega" rev-parse HEAD > "$T/root/omega.lock" +rc=0; run --gpu "$T/pins" >/dev/null 2>&1 || rc=$? +chk '[ "$rc" -eq 3 ]' "missing canonical CUDApp pin refused (exit 3, got $rc)" printf 'not-a-sha\n' > "$T/root/omega.lock" rc=0; run "$T/pins" >/dev/null 2>&1 || rc=$? chk '[ "$rc" -eq 3 ]' "malformed omega.lock refused (exit 3, got $rc)"