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/patches/728080736a5ab685 # 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 ## GitHub aien-dev/aien-sovereign-core-mv#210 (code only) closed derived `728080736a5ab685` #210 Imported from GitHub aien-dev/aien-sovereign-core-mv#210 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `0bdc97a76ce5a3d198dca718f89fad9bc56deb8e` · Head `a9a1967b2c0ba2cee06c69fb415024c25ab3d2cb` greptile-apps[bot] reviewed (COMMENTED) on 2026-10-05 03:39 UTC `aien-dev` has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan . ### Apply it ``` git checkout -b patch-728080736a5ab685 0bdc97a76ce5a3d198dca718f89fad9bc56deb8e curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/728080736a5ab685.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/aien-sovereign-core-mv 210 a9a1967b2c0ba2cee06c69fb415024c25ab3d2cb ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":210,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/210","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:18Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 0955e282..23909b77 100644 --- a/.crumb +++ b/.crumb @@ -77,14 +77,14 @@ } ], "children_root": "sha256:dfcfd805db0c30c667bc5682364bd3acb3383d494967dcae39f2420739723d7d", - "compiled_at": "2026-10-05T03:29:46Z", + "compiled_at": "2026-10-05T04:05:30Z", "compiler": "crumb-compile/1", - "digest": "sha256:fdf5d407a9877d6809387c3ca7fe1614d7168c893ed649963fef9ed2417e3a41", + "digest": "sha256:5885c8a87b87a313cfaf67fd901db946c28f5ec684cbe3ef3956f33748646da1", "evidence_files": 20, "evidence_root": "sha256:1ef4526f6fe1ba0cee21a89c3313d37bf2e94e1aa2e9bd1a364225e52882d170", - "files": 682, - "generated_at_commit": "0c1d249f2d119c7c2d726a2d252dc913e6185d28", - "source_tree": "sha256:ac8216c1b39db4cb1b51653b10501c13a5b99be770556bb7c3357f398f38cc5b" + "files": 683, + "generated_at_commit": "3dd2cb36eaac27c74964b4a47c9bb4a990353311", + "source_tree": "sha256:a0c99f76c9c4f23b156bcc2320e91aebb77b300943b0db92505e57eecae42693" } }, "history": [], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76022efa..187dcbe1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,14 @@ jobs: AIEN_DEV_FALLBACK: "1" run: cargo test --workspace --verbose -- --test-threads=1 + - name: Strict-Mode Controls (no AIEN_DEV_FALLBACK) + # The workspace test step above opts in to the dev fallback, which skips every + # strict branch of the GPU-backend tests. These targets must also pass in a strict + # process: a stub build must refuse the GPU backend instead of computing on the CPU. + run: | + cargo test -p aien-inference-abi --lib --test attention_wiring --test transformer_parity -- --test-threads=1 + cargo test -p aien-inference-runtime --test strict_real_model -- --test-threads=1 + - name: Zero-CUDA Gate (aien-cli links no NVIDIA CUDA library or symbol) run: | bash scripts/zero-cuda-gate.sh --self-test diff --git a/crates/aien-inference-abi/src/lib.rs b/crates/aien-inference-abi/src/lib.rs index 678faf7a..0f7ce6e4 100644 --- a/crates/aien-inference-abi/src/lib.rs +++ b/crates/aien-inference-abi/src/lib.rs @@ -885,15 +885,21 @@ mod tests { assert!(metrics.step_latency_us > 0); } + /// The GB10 backend on reference weights, judged per build. head_dim 64 is the + /// geometry omega attention supports, so a native strict build can run every op on + /// the chip. Before this test was split, it used head_dim 16 and asserted success + /// unconditionally, so it only passed with AIEN_DEV_FALLBACK=1: a strict stub build + /// correctly refuses at the first op (no engine linked), and a strict native build + /// would refuse at attention (omega attention needs head_dim 64, see omega_backend.rs). #[tokio::test] async fn test_blackwell_inference_backend() { let config = ModelConfig { num_layers: 2, num_heads: 4, num_kv_heads: 2, - head_dim: 16, - hidden_dim: 64, - intermediate_dim: 128, + head_dim: 64, + hidden_dim: 256, + intermediate_dim: 512, vocab_size: 256, block_size: 16, ..Default::default() @@ -925,9 +931,39 @@ mod tests { step_id: 1, }; - let (outputs, metrics) = backend.execute_step(&batch).await.unwrap(); + let run = tokio::spawn(async move { + let res = backend.execute_step(&batch).await; + (res, backend.inner.backend.tensor_backend.fallback_count()) + }) + .await; + + let native = aien_omega_gpu::is_native(); + if crate::strict::production_strict() && !native { + // Negative control: a strict build with no engine linked must refuse, not + // compute on the CPU behind the GPU backend's name. + let err = run.expect_err("a strict stub build must refuse the GPU backend"); + assert!(err.is_panic(), "{err}"); + let payload = err.into_panic(); + let msg = payload + .downcast_ref::() + .cloned() + .or_else(|| payload.downcast_ref::<&str>().map(|s| s.to_string())) + .unwrap_or_default(); + assert!( + msg.contains(crate::strict::STRICT_VIOLATION_PREFIX), + "{msg}" + ); + return; + } + let (res, fallbacks) = run.expect("execute_step must not panic here"); + let (outputs, metrics) = res.unwrap(); assert_eq!(outputs.len(), 1); assert_eq!(metrics.prefill_tokens_processed, 3); + if native { + assert_eq!(fallbacks, 0, "native build: every op must run on the chip"); + } else { + assert!(fallbacks > 0, "dev stub build: fallbacks must be counted"); + } } #[tokio::test] diff --git a/crates/aien-inference-abi/src/omega_backend.rs b/crates/aien-inference-abi/src/omega_backend.rs index a71d5035..0a04fc01 100644 --- a/crates/aien-inference-abi/src/omega_backend.rs +++ b/crates/aien-inference-abi/src/omega_backend.rs @@ -847,15 +847,45 @@ mod tests { .contains("native_fallbacks=[matmul_batch:1]")); } + /// Negative control for stub and native builds alike. The engine refuses a + /// claimed-native op before any launch (swiglu with unequal gate/up lengths; the + /// reference path accepts it and uses the shorter length). In a strict process that + /// refusal must be fatal; in a dev process it must be a counted fallback with the + /// reference result. This replaces a `should_panic` test whose skip branch panicked + /// with the expected text, so it passed without testing anything in dev and native runs. #[test] - #[should_panic(expected = "STRICT_REAL_MODEL_VIOLATION")] - fn chip_error_trips_strict_in_production() { - if aien_omega_gpu::is_native() || crate::strict::dev_fallback_active() { - panic!("STRICT_REAL_MODEL_VIOLATION (skipped: native or dev build)"); - } + fn chip_refusal_is_fatal_in_strict_and_counted_in_dev() { let b = OmegaGb10Backend::new(); + let gate = [0.5f32, 2.0, -1.0]; + let up = [3.0f32, -0.25]; let mut out = [0.0f32; 2]; - b.matmul_vec(&mut out, &[1.0; 2], &[1.0; 4], 2, 2); + let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + b.swiglu(&mut out, &gate, &up) + })); + assert_eq!(b.chip_errors(), 1, "{}", b.last_error()); + assert_eq!(b.fallback_count(), 1); + assert!( + b.op_report().line().contains("native_fallbacks=[swiglu:1]"), + "{}", + b.op_report().line() + ); + if crate::strict::production_strict() { + let err = r.expect_err("a strict process must refuse a claimed-native fallback"); + let msg = err + .downcast_ref::() + .cloned() + .or_else(|| err.downcast_ref::<&str>().map(|s| s.to_string())) + .unwrap_or_default(); + assert!( + msg.contains(crate::strict::STRICT_VIOLATION_PREFIX) && msg.contains("swiglu"), + "{msg}" + ); + } else { + r.expect("a dev process continues on the reference path"); + let mut want = [0.0f32; 2]; + ReferenceCpuBackend::new().swiglu(&mut want, &gate, &up); + assert_eq!(out, want); + } } /// The cached cos/sin table, applied on the host with the same f32 formulas as the diff --git a/crates/aien-inference-abi/tests/attention_wiring.rs b/crates/aien-inference-abi/tests/attention_wiring.rs index bf076c05..89232d40 100644 --- a/crates/aien-inference-abi/tests/attention_wiring.rs +++ b/crates/aien-inference-abi/tests/attention_wiring.rs @@ -600,9 +600,23 @@ fn f_incompatible_kv_geometry_is_refused_before_reading() { } /// The chip backend refuses the same mismatches before any native call; in the CPU-stub build -/// this is the only path that runs, and the refusal is counted as a chip error. +/// this is the only path that runs, and the refusal is counted as a chip error. In a strict +/// process the refusal surfaces as the strict violation for the op (the fallback itself is +/// fatal); in a dev process the reference path then refuses with the geometry message. #[test] fn f_omega_backend_refuses_pool_mismatch_before_native_code() { + let strict = aien_inference_abi::strict::production_strict(); + let refused = |msg: &str, op: &str, dev_text: &[&str]| { + if strict { + assert!( + msg.contains(aien_inference_abi::strict::STRICT_VIOLATION_PREFIX) + && msg.contains(op), + "{msg}" + ); + } else { + assert!(dev_text.iter().all(|t| msg.contains(t)), "{msg}"); + } + }; let be = OmegaGb10Backend::new(); let (nq, nkv) = (8usize, 2usize); let (k, v) = banded_kv(2, nkv); @@ -613,15 +627,20 @@ fn f_omega_backend_refuses_pool_mismatch_before_native_code() { let mut out = vec![0.0f32; nq * HD]; be.paged_attention(&mut out, &q, &pool, &[0], 2, 0, nq, 4, HD); }))); - assert!(msg.contains("pool is laid out for 2 kv heads"), "{msg}"); + refused( + &msg, + "paged_attention", + &["pool is laid out for 2 kv heads"], + ); assert!(be.chip_errors() > before, "the refusal must be counted"); let msg = panic_message(catch_unwind(AssertUnwindSafe(|| { let mut out = vec![0.0f32; 6 * HD]; be.gqa_attention(&mut out, &q[..6 * HD], &k, &v, 2, 6, 4, HD); }))); - assert!( - msg.contains("6 is not a multiple of num_kv_heads 4"), - "{msg}" + refused( + &msg, + "gqa_attention", + &["6 is not a multiple of num_kv_heads 4"], ); } diff --git a/crates/aien-inference-abi/tests/transformer_parity.rs b/crates/aien-inference-abi/tests/transformer_parity.rs index 7740f921..52dc4291 100644 --- a/crates/aien-inference-abi/tests/transformer_parity.rs +++ b/crates/aien-inference-abi/tests/transformer_parity.rs @@ -257,6 +257,31 @@ async fn test_blackwell_vs_reference_cpu_autoregressive_parity() { step_id: 1, }; + // The micro config uses head_dim 16, which omega attention does not support (see + // omega_backend.rs), and a stub build has no engine at all, so the "GPU" leg is never + // fully native here. A strict process must refuse it. A dev process runs it with + // counted fallbacks; in a stub build both legs are then the same reference math, so + // this is a wiring check, not chip parity. Chip parity lives in + // tests/omega_backend_parity.rs and the strict real-model gate (heavy queue). + let native = aien_omega_gpu::is_native(); + if aien_inference_abi::strict::production_strict() { + let probe = batch_gpu.clone(); + let refused = tokio::spawn(async move { gpu_backend.execute_step(&probe).await }) + .await + .expect_err("a strict process must refuse a GPU leg that cannot run natively"); + assert!(refused.is_panic(), "{refused}"); + let payload = refused.into_panic(); + let msg = payload + .downcast_ref::() + .cloned() + .or_else(|| payload.downcast_ref::<&str>().map(|s| s.to_string())) + .unwrap_or_default(); + assert!( + msg.contains(aien_inference_abi::strict::STRICT_VIOLATION_PREFIX), + "{msg}" + ); + return; + } let mut cpu_tokens = Vec::new(); let mut gpu_tokens = Vec::new(); @@ -272,10 +297,12 @@ async fn test_blackwell_vs_reference_cpu_autoregressive_parity() { }, ) = (&out_cpu[0], &out_gpu[0]) { - assert_eq!( - t_cpu, t_gpu, - "Prefill first token mismatch between CPU and Blackwell GPU" - ); + if !native { + assert_eq!( + t_cpu, t_gpu, + "Prefill first token mismatch between CPU and the GPU leg" + ); + } cpu_tokens.push(*t_cpu); gpu_tokens.push(*t_gpu); } @@ -301,20 +328,30 @@ async fn test_blackwell_vs_reference_cpu_autoregressive_parity() { }, ) = (&step_out_cpu[0], &step_out_gpu[0]) { - assert_eq!( - t_cpu, t_gpu, - "Decode step {} token mismatch: CPU={}, GPU={}", - step, t_cpu, t_gpu - ); + if !native { + assert_eq!( + t_cpu, t_gpu, + "Decode step {} token mismatch: CPU={}, GPU={}", + step, t_cpu, t_gpu + ); + } cpu_tokens.push(*t_cpu); gpu_tokens.push(*t_gpu); } } - assert_eq!( - cpu_tokens, gpu_tokens, - "Autoregressive generation must match bitwise between CPU and Blackwell GPU" + // Dev run: the GPU leg cannot be fully native (see above), so its fallbacks must show. + let fallbacks = gpu_backend.tensor_backend.fallback_count(); + assert!( + fallbacks > 0, + "the GPU leg ran {fallbacks} counted fallbacks; expected some" ); + if !native { + assert_eq!( + cpu_tokens, gpu_tokens, + "stub dev build: both legs are the reference math and must match bitwise" + ); + } println!( "Parity verified over {} tokens: {:?}", cpu_tokens.len(), ```