Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/blob/main/crates/aien-omega-dgraph/build.rs # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / crates / aien-omega-dgraph / build.rs` 72 lines ยท 3127 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 //! Decides whether omega's one-list decode token (`src/omega_gpu_decode_graph.h`, OWN-30B L2 17 //! cut 2 on the omega side) is linked. 18 //! 19 //! The archive itself is linked by `aien-omega-gpu`'s build script (this crate only declares 20 //! the extra symbols), so the decision mirrors its inputs: 21 //! * `AIEN_FORCE_CPU_STUB=1`: stub. 22 //! * `AIEN_OMEGA_GPU_LIB=`: native when `nm` finds `omega_gpu_decode_graph_create` 23 //! defined in that archive. 24 //! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_decode_graph.h`. 25 //! * otherwise: stub (every call returns `Unavailable`). 26 //! 27 //! `cfg(has_omega_dgraph)` is set only when native. A stub never fails the build: the engine 28 //! keeps its launch-at-a-time decode, and `is_native()` says which one a binary carries. 29 use std::path::Path; 30 use std::process::Command; 31 32 fn main() { 33 println!("cargo:rustc-check-cfg=cfg(has_omega_dgraph)"); 34 for v in [ 35 "AIEN_FORCE_CPU_STUB", 36 "AIEN_OMEGA_GPU_LIB", 37 "AIEN_OMEGA_DIR", 38 ] { 39 println!("cargo:rerun-if-env-changed={v}"); 40 } 41 if std::env::var("AIEN_FORCE_CPU_STUB").as_deref() == Ok("1") { 42 return; 43 } 44 if let Ok(lib) = std::env::var("AIEN_OMEGA_GPU_LIB") { 45 println!("cargo:rerun-if-changed={lib}"); 46 if archive_defines(Path::new(&lib), "omega_gpu_decode_graph_create") { 47 println!("cargo:rustc-cfg=has_omega_dgraph"); 48 } else { 49 println!("cargo:warning=aien-omega-dgraph: {lib} does not define the decode graph API; the one-list decode is stubbed"); 50 } 51 return; 52 } 53 if let Ok(dir) = std::env::var("AIEN_OMEGA_DIR") { 54 let header = Path::new(&dir).join("src/omega_gpu_decode_graph.h"); 55 println!("cargo:rerun-if-changed={}", header.display()); 56 if header.is_file() { 57 println!("cargo:rustc-cfg=has_omega_dgraph"); 58 } else { 59 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"); 60 } 61 } 62 } 63 64 fn archive_defines(lib: &Path, symbol: &str) -> bool { 65 let Ok(out) = Command::new("nm").arg(lib).output() else { 66 println!("cargo:warning=aien-omega-dgraph: nm not available, assuming the archive lacks the decode graph API"); 67 return false; 68 }; 69 String::from_utf8_lossy(&out.stdout) 70 .lines() 71 .any(|l| l.ends_with(&format!(" T {symbol}"))) 72 }