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/ddfca9d022be65bd # 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#557 (code only) closed derived `ddfca9d022be65bd` #557 Imported from GitHub aien-dev/aien-sovereign-core-mv#557 (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 `ab1084d6239836ec966d21bce4acf8988c17d682` · Head `1d02628f2b572415fe4faa584ad1cd250a6a947e` drakestapleton reviewed (COMMENTED) on 2026-10-30 11:17 UTC Triage: needs changes. - This PR conflicts with main and needs a rebase. - ADR 0004 step 4 depends on it, so it has to merge before step 4. Hardware evidence: host plus a tiny-MoE dual run only. Triage only; no approval or merge implied. ### Fetch it A git bundle of the pull request's head, 45740 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/ddfca9d022be65bd.bundle -o ddfca9d022be65bd.bundle git fetch ddfca9d022be65bd.bundle refs/pull/557/head ``` Raw bundle · 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 557 1d02628f2b572415fe4faa584ad1cd250a6a947e ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":557,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/557","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:29Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index b8601086..6b237843 100644 --- a/.crumb +++ b/.crumb @@ -125,14 +125,14 @@ } ], "children_root": "sha256:9336db0a6669d32e68cee16900dfe9fc9e27304c00dc48daee6578317bf57d2c", - "compiled_at": "2026-10-31T05:53:04Z", + "compiled_at": "2026-10-31T08:55:30Z", "compiler": "crumb-compile/1", - "digest": "sha256:7133cd75c7085a708d7b9d83f05e280ca63893285c11692e093465d6f2fa463f", - "evidence_files": 3602, - "evidence_root": "sha256:1b8069934a4cc67803874ebd2ad5de32671fae5ccce1a3ea70aeb532fe8ea86b", - "files": 8117, - "generated_at_commit": "eb22bc7f74e0a5d1da4c480c6818939b8a5df539", - "source_tree": "sha256:46093659b54787818b1575947e90381bba9cbbec6e8f945a5d2b3b5de27510d7" + "digest": "sha256:c88157b55aa1d2b3d8f6df33f2fe1c474e60df5f0aa635f87879123a16ca8198", + "evidence_files": 3630, + "evidence_root": "sha256:5227eacc2c7899c3e04fa5825459d98f642e328a1a055c0bccb7d9e5ea99ee84", + "files": 8147, + "generated_at_commit": "175845464e592890b0cf013f2ad2d5ba4115055d", + "source_tree": "sha256:3f6f229aed3063548da851e98493411c3d3417e614a885eabeff0d3445967458" } }, "history": [], diff --git a/crates/aien-inference-abi/src/generation.rs b/crates/aien-inference-abi/src/generation.rs index 2ea44192..c2dfce73 100644 --- a/crates/aien-inference-abi/src/generation.rs +++ b/crates/aien-inference-abi/src/generation.rs @@ -37,7 +37,7 @@ use crate::tensor::sample_argmax; pub mod echo_chain; #[cfg(test)] -mod tests; +pub(crate) mod tests; /// What the controller wants from a head. #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -123,6 +123,11 @@ pub trait ForwardPass: Send { } /// The K/V identity entries, or `Err(reason)` when K/V from this run must never be stored. fn kv_identity(&self) -> Result; + /// Migration only (ADR 0004 steps 3 and 4; step 5 deletes it): the controller shows the + /// model its ledger before every forward call, so a model that still keeps its own copy of + /// the history (the 30B's mirror) can take the tokens of a restore or import it did not see + /// (I1). Default: nothing. + fn mirror_ledger(&mut self, _history: &[u32]) {} } /// The default sparse output head: `next(head, Logits)`, then the rows gathered into @@ -486,6 +491,7 @@ impl GenerationController { f: impl FnOnce(&mut M, usize) -> Result<(), String>, ) -> Result<(), String> { let pos = self.history.len(); + self.model.mirror_ledger(&self.history); match f(&mut self.model, pos) { Ok(()) => { self.history.extend_from_slice(tokens); diff --git a/crates/aien-inference-abi/src/generation/tests.rs b/crates/aien-inference-abi/src/generation/tests.rs index c3b145d2..735960e8 100644 --- a/crates/aien-inference-abi/src/generation/tests.rs +++ b/crates/aien-inference-abi/src/generation/tests.rs @@ -31,17 +31,17 @@ fn ctl(graph: bool) -> Ctl { GenerationController::new(m) } -fn prompt(n: usize, seed: usize) -> Vec { +pub(crate) fn prompt(n: usize, seed: usize) -> Vec { (0..n) .map(|i| ((i * 7 + seed * 13 + 1) % 64) as u32) .collect() } -fn greedy(n: usize) -> GenerateParams { +pub(crate) fn greedy(n: usize) -> GenerateParams { GenerateParams::greedy(n, Vec::new()) } -fn sampled(n: usize, seed: u64) -> GenerateParams { +pub(crate) fn sampled(n: usize, seed: u64) -> GenerateParams { GenerateParams { max_new_tokens: n, temperature: 1.0, @@ -52,8 +52,8 @@ fn sampled(n: usize, seed: u64) -> GenerateParams { } } -fn gen_with( - c: &mut Ctl, +pub(crate) fn gen_with( + c: &mut GenerationController, prompt: &[u32], params: &GenerateParams, sampler: &mut dyn Sampler, @@ -67,8 +67,8 @@ fn gen_with( Ok((out, o)) } -fn gen( - c: &mut Ctl, +pub(crate) fn gen( + c: &mut GenerationController, prompt: &[u32], params: &GenerateParams, constraint: Option<&mut dyn Constraint>, @@ -82,18 +82,32 @@ fn cold(prompt: &[u32], params: &GenerateParams) -> Vec { gen(&mut ctl(false), prompt, params, None).unwrap().0 } +/// What the moved tests read beyond the seam: how many positions each layer of the cache holds +/// (as many layers as the model can show). +pub(crate) trait LayerFill { + fn layer_fill(&self) -> Vec; +} + +impl LayerFill for EchoChainModel { + fn layer_fill(&self) -> Vec { + self.layer_lens() + } +} + /// Every layer holds exactly the ledger's positions. -fn assert_at_ledger(c: &Ctl) { +pub(crate) fn assert_at_ledger(c: &GenerationController) { let n = c.position(); + let fill = c.model().layer_fill(); + assert!(!fill.is_empty()); assert_eq!( - c.model().layer_lens(), - vec![n; 2], + fill, + vec![n; fill.len()], "every layer must hold exactly position() = {n} rows" ); } /// The outcome without its wall-clock fields. -fn counted(o: &GenerateOutcome) -> GenerateOutcome { +pub(crate) fn counted(o: &GenerateOutcome) -> GenerateOutcome { GenerateOutcome { prefill_ms: 0, decode_ms: 0, @@ -179,7 +193,7 @@ fn greedy_chain(m: &mut M, pos: usize, first: u32, n: usize) -> out } -fn forward_pass_contract(make: &dyn Fn() -> M) { +pub(crate) fn forward_pass_contract(make: &dyn Fn() -> M) { let p = prompt(20, 1); // more than one KV block let n = p.len(); let mut t = StepTiming::default(); @@ -326,9 +340,25 @@ fn echo_chain_keeps_the_forward_pass_contract() { // The controller (moved tests, then the new ones of section 5). // --------------------------------------------------------------------------------------------- -#[test] -fn prefix_reuse_prefills_only_the_new_tokens_and_matches_a_cold_run() { - let mut c = ctl(false); +// The moved tests (ADR 0004 section 5), generic over the forward pass: each runs here on the +// fake and on the tiny MoE through the 30B adapter (`qwen3_moe_omega::forward_pass` tests). + +/// A cold run on a fresh model. +pub(crate) fn cold_on( + make: &dyn Fn() -> M, + prompt: &[u32], + params: &GenerateParams, +) -> Vec { + gen(&mut GenerationController::new(make()), prompt, params, None) + .unwrap() + .0 +} + +/// Returns the warm turn's outcome, so the caller can check its own prefill counters. +pub(crate) fn moved_prefix_reuse( + make: &dyn Fn() -> M, +) -> GenerateOutcome { + let mut c = GenerationController::new(make()); let p1 = prompt(10, 2); let (first, o) = gen(&mut c, &p1, &greedy(4), None).unwrap(); assert_eq!((o.reused_prompt_tokens, o.prompt_tokens), (0, 10)); @@ -336,14 +366,28 @@ fn prefix_reuse_prefills_only_the_new_tokens_and_matches_a_cold_run() { assert_eq!(p2.len(), 13, "prompt plus the three decoded tokens"); assert_eq!(&p2[10..], &first[..3]); p2.extend([5, 6, 7]); - let (warm, o) = gen(&mut c, &p2, &greedy(8), None).unwrap(); - assert_eq!(o.reused_prompt_tokens, 13); + let (warm, warm_outcome) = gen(&mut c, &p2, &greedy(8), None).unwrap(); + assert_eq!(warm_outcome.reused_prompt_tokens, 13); + assert_eq!(warm, cold_on(make, &p2, &greedy(8))); + assert_at_ledger(&c); + // A prompt equal to the whole history still prefills its last token; an unrelated prompt + // starts cold. + let h = c.history().to_vec(); + let (_, o) = gen(&mut c, &h, &greedy(2), None).unwrap(); + assert_eq!(o.reused_prompt_tokens, h.len() - 1); + let (_, o) = gen(&mut c, &[1, 2, 3], &greedy(2), None).unwrap(); + assert_eq!(o.reused_prompt_tokens, 0); + assert_at_ledger(&c); + warm_outcome +} + +#[test] +fn prefix_reuse_prefills_only_the_new_tokens_and_matches_a_cold_run() { + let o = moved_prefix_reuse(&|| EchoChainModel::new(CTX)); assert_eq!( o.prefill_timing.launches, 3, "only the new tokens are prefilled" ); - assert_eq!(warm, cold(&p2, &greedy(8))); - assert_at_ledger(&c); } #[test] @@ -455,24 +499,24 @@ fn a_forward_error_leaves_every_layer_at_the_ledger() { assert_eq!(warm, cold(&p3, &greedy(8))); } -#[test] -fn generate_stops_on_stop_ids_caps_length_and_cancels() { +pub(crate) fn moved_stops_caps_and_cancels(make: &dyn Fn() -> M) { let p = prompt(10, 7); - let chain = cold(&p, &greedy(8)); + let chain = cold_on(make, &p, &greedy(8)); assert_eq!(chain.len(), 8); let stop = chain[4]; let i = chain.iter().position(|&t| t == stop).unwrap(); - let mut c = ctl(false); + let mut c = GenerationController::new(make()); let (out, o) = gen(&mut c, &p, &GenerateParams::greedy(8, vec![stop]), None).unwrap(); assert_eq!( (&out[..], o.finish, o.emitted_tokens), (&chain[..i], FinishReason::Stop, i) ); - let (out, o) = gen(&mut ctl(false), &p, &greedy(5), None).unwrap(); + let mut c = GenerationController::new(make()); + let (out, o) = gen(&mut c, &p, &greedy(5), None).unwrap(); assert_eq!((&out[..], o.finish), (&chain[..5], FinishReason::Length)); - let mut c = ctl(false); + let mut c = GenerationController::new(make()); let mut out = Vec::new(); let o = c .generate(&p, &greedy(8), &mut SampleNext(greedy(8)), None, &mut |t| { @@ -486,6 +530,11 @@ fn generate_stops_on_stop_ids_caps_length_and_cancels() { ); } +#[test] +fn generate_stops_on_stop_ids_caps_length_and_cancels() { + moved_stops_caps_and_cancels(&|| EchoChainModel::new(CTX)); +} + #[test] fn stop_and_cancel_tokens_are_never_stepped() { let p = prompt(10, 8); @@ -564,9 +613,12 @@ fn a_full_context_ends_with_length_and_no_error() { ); } -#[test] -fn restored_prefix_continues_exactly_like_the_uninterrupted_engine() { - let mut a = ctl(false); +/// `make_a` runs the uninterrupted engine, `make_b` the one the prefix is restored into. +pub(crate) fn moved_restored_prefix( + make_a: &dyn Fn() -> M, + make_b: &dyn Fn() -> M, +) { + let mut a = GenerationController::new(make_a()); gen(&mut a, &prompt(20, 11), &greedy(8), None).unwrap(); let h = a.history().to_vec(); let bytes = a.export_kv(0, h.len()).unwrap(); @@ -574,44 +626,65 @@ fn restored_prefix_continues_exactly_like_the_uninterrupted_engine() { next.extend([4, 2]); let (want, _) = gen(&mut a, &next, &greedy(8), None).unwrap(); - let mut b = ctl(true); + let mut b = GenerationController::new(make_b()); b.restore_kv(&h, &bytes).unwrap(); assert_eq!(b.history(), &h[..]); assert_at_ledger(&b); + assert_eq!( + b.export_kv(0, h.len()).unwrap(), + bytes, + "import then export is byte-identical" + ); let (got, o) = gen(&mut b, &next, &greedy(8), None).unwrap(); assert_eq!(o.reused_prompt_tokens, h.len()); assert_eq!(got, want); - assert_eq!(got, cold(&next, &greedy(8))); + assert_eq!(got, cold_on(make_b, &next, &greedy(8))); } #[test] -fn a_failed_restore_resets_the_ledger() { +fn restored_prefix_continues_exactly_like_the_uninterrupted_engine() { + moved_restored_prefix(&|| EchoChainModel::new(CTX), &|| { + let mut m = EchoChainModel::new(CTX); + m.graph_mode = true; + m + }); +} + +pub(crate) fn moved_failed_restore(make: &dyn Fn() -> M) { let p = prompt(20, 12); - let mut a = ctl(false); + let mut a = GenerationController::new(make()); gen(&mut a, &p, &greedy(4), None).unwrap(); let h = a.history().to_vec(); let mut snap = a.export_kv(0, h.len()).unwrap(); assert!(a.export_kv(0, h.len() + 1).is_err(), "past the ledger"); - let mut b = ctl(false); + let mut b = GenerationController::new(make()); gen(&mut b, &[1, 2, 3, 4], &greedy(2), None).unwrap(); assert!(b.restore_kv(&h, &snap[..snap.len() - 2]).is_err()); - assert_eq!((b.position(), b.model().layer_lens()), (0, vec![0, 0])); + assert_eq!(b.position(), 0); + assert_at_ledger(&b); let last = snap.len() - 1; snap[last] ^= 1; // a padding byte set assert!(b.restore_kv(&h, &snap).is_err()); assert!(b.restore_kv(&[], &[]).is_err()); - assert!(b.restore_kv(&vec![1u32; CTX], &snap).is_err()); - assert_eq!((b.position(), b.model().layer_lens()), (0, vec![0, 0])); + let ctx = b.max_context_tokens(); + assert!(b.restore_kv(&vec![1u32; ctx], &snap).is_err()); + assert_eq!(b.position(), 0); + assert_at_ledger(&b); let (got, o) = gen(&mut b, &p, &greedy(8), None).unwrap(); assert_eq!(o.reused_prompt_tokens, 0); assert_eq!( got, - cold(&p, &greedy(8)), + cold_on(make, &p, &greedy(8)), "plain prefill after a refused restore" ); } +#[test] +fn a_failed_restore_resets_the_ledger() { + moved_failed_restore(&|| EchoChainModel::new(CTX)); +} + #[test] fn max_new_tokens_zero_reads_no_head() { let mut c = ctl(false); diff --git a/crates/aien-inference-abi/src/qwen3_moe_omega.rs b/crates/aien-inference-abi/src/qwen3_moe_omega.rs index 1f5b048b..4f010c25 100644 --- a/crates/aien-inference-abi/src/qwen3_moe_omega.rs +++ b/crates/aien-inference-abi/src/qwen3_moe_omega.rs @@ -43,6 +43,7 @@ use rayon::prelude::*; use crate::moe_plan::MoeBatchPlan; use crate::qwen3_moe::{bf16_to_f32, f32_to_bf16, fp8_table, shard_path, Shard, FP8_BLOCK}; use crate::resident::transpose_bf16_for_upload; +mod forward_pass; pub mod w8a8_control; mod whole_prompt; @@ -3335,6 +3336,14 @@ pub struct Qwen3MoeOmegaEngine { history: Vec, /// Whole-prompt prefill driver (OFF = None; `set_whole_prompt`). See `whole_prompt.rs`. whole_prompt: Option>, + /// The host head (ADR 0004 adapter): the last forward call's final hidden state, unread. + /// `None` once read or forgotten. Empty on the decode graph, whose head is its pending token. + head_hidden: Option>, + /// The logits `ForwardPass::next` lends out (the last head read). + head_logits: Vec, + /// The cache was lent through `ForwardPass::kv` since the last forward call: the mirror's + /// tokens are taken from the ledger at the next one. + kv_lent: bool, } impl Qwen3MoeOmegaEngine { @@ -3361,6 +3370,9 @@ impl Qwen3MoeOmegaEngine { pos: 0, history: Vec::new(), whole_prompt: None, + head_hidden: None, + head_logits: Vec::new(), + kv_lent: false, } } diff --git a/crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass.rs b/crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass.rs new file mode 100644 index 00000000..b1d19a48 --- /dev/null +++ b/crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass.rs @@ -0,0 +1,264 @@ +//! The 30B adapter: `impl ForwardPass for Qwen3MoeOmegaEngine` (ADR 0004 section 4, migration +//! step 3). +//! +//! It sits beside the engine's own loop (`generate_inner`), which stays the running code until +//! step 4. Nothing here changes a kernel, a launch order, the decode graph or a KV adapter: the +//! adapter calls the same `whole_prompt_prefill`, `step_batch`, `decode_step`, `logits` and +//! `dgraph_*` functions in the same order `generate_inner` does. +//! +//! The engine still keeps its own `history` and `pos` (the mirror). The controller's ledger is +//! the authority; the adapter resynchronises the mirror on entry to every forward call (I1). +//! Step 5 deletes the mirror, `generate_inner` and [`ForwardPass::mirror_ledger`]. + +use super::{OmegaKvSwitches, Qwen3MoeConfig, Qwen3MoeOmegaEngine, StepTiming}; +use crate::generation::{ForwardPass, KvIdentityInputs, Next, Want}; +use crate::qwen3_moe_omega::KvStore; + +#[cfg(test)] +mod tests; + +/// Token id the mirror records for a position whose token it never saw (a forward pass driven +/// without a controller after an import through `kv()`). No prompt token equals it, so the old +/// loop's prefix rule would reuse none of those positions. +const UNSEEN: u32 = u32::MAX; + +impl Qwen3MoeOmegaEngine { + /// Forgets every unread head: the graph's pending token and the host head's hidden state. + fn forget_heads(&mut self) { + self.dgraph_clear(); + self.head_hidden = None; + } + + /// I1 on entry to a forward call at `pos`: the cache must hold exactly `pos` positions. The + /// mirror then follows the ledger: `pos == 0` resets; if the cache was not lent since the + /// last forward call, a shorter ledger is a rewind (the mirror's tokens are the ledger's); + /// after a lending (a truncate, an import or a restore through `kv()`) or for a longer + /// ledger, the mirror takes `ledger`'s tokens, or [`UNSEEN`] when driven without one. + /// After a forward error the mirror may stay ahead of the ledger until the next forward + /// call; nothing but the controller reads it during the migration. + fn resync(&mut self, pos: usize, ledger: Option<&[u32]>) -> Result<(), String> { + let held = self.kv.len(); + if held != pos { + return Err(format!( + "forward call at position {pos}, the {} cache holds {held}", + self.kv.path_name() + )); + } + let lent = std::mem::take(&mut self.kv_lent); + if pos == 0 { + if self.pos != 0 { + self.reset(); + } + return Ok(()); + } + if !lent && pos == self.pos { + return Ok(()); + } + if !lent && pos < self.pos { + self.rewind(pos); + return Ok(()); + } + self.dgraph_clear(); + self.pos = pos; + self.history = match ledger { + Some(h) if h.len() == pos => h.to_vec(), + _ => vec![UNSEEN; pos], + }; + Ok(()) + } +} + +impl ForwardPass for Qwen3MoeOmegaEngine { + fn kind(&self) -> &'static str { + "qwen3-moe-omega" + } + + fn vocab(&self) -> usize { + self.weights.config.vocab + } + + /// Lending the cache forgets every unread head: a truncate or an import through it must + /// never leave a stale graph token or host hidden state to read (I2). The next forward call + /// takes the mirror's tokens from the ledger. + fn kv(&mut self) -> &mut dyn KvStore { + self.forget_heads(); + self.kv_lent = true; + &mut *self.kv + } + + fn mirror_ledger(&mut self, history: &[u32]) { + // An error here is reported by the forward call's own resync. + let _ = self.resync(history.len(), Some(history)); + } + + /// `whole_prompt_prefill`, then the `step_batch` chunk loop, word for word from + /// `generate_inner`. + fn prefill( + &mut self, + pos: usize, + tokens: &[u32], + timing: &mut StepTiming, + ) -> Result<(), String> { + // A new forward call replaces every unread head (I2): today's prefill does not clear + // a pending graph token, and `next(0, Greedy)` would read it first. + self.forget_heads(); + self.resync(pos, None)?; + if tokens.is_empty() { + return Err("prefill of no tokens".into()); + } + let mut hidden = Vec::new(); + // Neither prefill route leaves a graph token, so an error leaves no head. + let whole = self.whole_prompt_prefill(tokens, &mut hidden, timing)?; + for chunk in tokens[whole..].chunks(self.prefill_chunk.max(1)) { + hidden = self.step_batch(chunk)?; + timing.add(&self.last_timing); + } + self.head_hidden = Some(hidden); + Ok(()) + } + + /// `decode_step`, unchanged: on the graph the head is the chip's pending token, else the + /// host hidden state. + fn decode( + &mut self, + pos: usize, + tokens: &[u32], + timing: &mut StepTiming, + ) -> Result<(), String> { + // A new forward call replaces every unread head (I2). + self.forget_heads(); + self.resync(pos, None)?; + let &[token] = tokens else { + return Err(format!( + "decode of {} tokens, the 30B decodes one at a time", + tokens.len() + )); + }; + // On an error (the graph books a token before a timeline error) no head is left. + let hidden = self + .decode_step(token) + .inspect_err(|_| self.forget_heads())?; + timing.add(&self.last_timing); + self.head_hidden = Some(hidden); + Ok(()) + } + + fn next( + &mut self, + head: usize, + want: Want, + timing: &mut StepTiming, + ) -> Result, String> { + if head != 0 { + return Err(format!("head {head}: the 30B leaves one head")); + } + // The head left by the last successful forward call, read once: empty for a graph + // decode step (its head is the chip's pending token), else the host hidden state. + let hidden = self + .head_hidden + .take() + .ok_or("no head pending: a head is read once")?; + if hidden.is_empty() && want == Want::Greedy { + // The graph's chip argmax (the sample_argmax rule), with no read-back. + let t = self + .dgraph_take_greedy(true) + .ok_or("the decode graph holds no pending token")?; + return Ok(Next::Token(t)); + } + // The host lm_head adds its own time (today's reset before the first decode head); the + // graph's logits read-back adds nothing, as today. + self.last_timing = StepTiming::default(); + let logits = if hidden.is_empty() { + // A graph decode step's head: its logits read back from the chip. + self.dgraph_take_logits() + .ok_or("the decode graph holds no pending token")?? + } else { + self.logits(&hidden)? + }; + timing.add(&self.last_timing); + self.head_logits = logits; + Ok(Next::Logits(&self.head_logits)) + } + + fn clear_pending(&mut self) { + self.forget_heads(); + } + + /// Today's `reset`: heads, cache, mirror and traces (a rewind keeps traces, as today). + fn begin_sequence(&mut self) { + self.reset(); + self.head_hidden = None; + } + + fn kv_identity(&self) -> Result { + // Exhaustive on purpose: no `..`, so a new switch or config field has to be placed here. + let OmegaKvSwitches { + attention_path, + device_routing, + prefill_chunk, + prefill_gemm, + prefill_device_routing, + whole_prompt, + whole_prompt_device_host, + decode_graph, + lm_head_gemv, + routing_mutant, + trace_layers, + } = self.kv_switches(); + if routing_mutant { + return Err("the engine runs the routing mutant (a negative control)".into()); + } + if trace_layers { + return Err("parity tracing is on: K/V from a traced run is never stored".into()); + } + let Qwen3MoeConfig { + layers, + hidden, + q_heads, + kv_heads, + head_dim, + experts, + top_k, + moe_intermediate, + vocab, + rms_eps, + rope_theta, + norm_topk_prob, + tie_word_embeddings, + // Decides when a sequence stops, not what is computed. + eos_token_ids: _, + } = &self.weights.config; + let entries = vec![ + ("layers", layers.to_string()), + ("hidden", hidden.to_string()), + ("q_heads", q_heads.to_string()), + ("kv_heads", kv_heads.to_string()), + ("head_dim", head_dim.to_string()), + ("experts", experts.to_string()), + ("top_k", top_k.to_string()), + ("moe_intermediate", moe_intermediate.to_string()), + ("vocab", vocab.to_string()), + ("rms_eps", format!("{rms_eps:?}")), + ("rope_theta", format!("{rope_theta:?}")), + ("norm_topk_prob", norm_topk_prob.to_string()), + ("tie_word_embeddings", tie_word_embeddings.to_string()), + ("attention_path", attention_path.to_string()), + ("device_routing", device_routing.to_string()), + ("prefill_chunk", prefill_chunk.to_string()), + ("prefill_gemm", prefill_gemm.to_string()), + ("prefill_device_routing", prefill_device_routing.to_string()), + ("whole_prompt", whole_prompt.to_string()), + ( + "whole_prompt_device_host", + whole_prompt_device_host.to_string(), + ), + ("decode_graph", decode_graph.to_string()), + ("lm_head_gemv", lm_head_gemv.to_string()), + ("trace_layers", trace_layers.to_string()), + ]; + Ok(KvIdentityInputs { + kind: self.kind(), + entries, + }) + } +} diff --git a/crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs b/crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs new file mode 100644 index 00000000..6d137e60 --- /dev/null +++ b/crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs @@ -0,0 +1,417 @@ +//! The 30B adapter on the tiny MoE (ADR 0004 step 3): the forward-pass contract, the moved +//! controller tests, the dual run against the old loop (steps 3 and 4 only; step 5 deletes it), +//! the mirror resync and the traces rule. + +use super::super::test_support::*; +use super::super::*; +use super::UNSEEN; +use crate::generation::tests::{ + cold_on, forward_pass_contract, gen, gen_with, greedy, moved_failed_restore, + moved_prefix_reuse, moved_restored_prefix, moved_stops_caps_and_cancels, prompt, sampled, + LayerFill, +}; +use crate::generation::{ForwardPass, GenerationController, Sampler}; +use crate::tensor::sample_argmax; + +const CTX: usize = 128; + +type Ctl = GenerationController; + +/// The tiny MoE on the host pool (the cache that exports and imports), FP8 so batched prefill +/// runs. +fn tiny(cap: usize) -> Qwen3MoeOmegaEngine { + let c = tiny_config(); + let mut src = MemorySource::for_config(&c); + let up = RecordingUploader::default(); + let (w, _) = + load_qwen3_moe_omega_from_with(&c, &mut src, &up, WeightFormat::Fp8All, &mut |_| {}) + .unwrap(); + Qwen3MoeOmegaEngine::new( + w, + Box::new(HostPoolKv::new(&KvGeometry::from(&c), cap).unwrap()), + ) +} + +fn tiny_chunk3() -> Qwen3MoeOmegaEngine { + let mut e = tiny(CTX); + e.prefill_chunk = 3; + e +} + +impl LayerFill for Qwen3MoeOmegaEngine { + /// The `KvStore` view shows the smallest per-layer fill, which is what I1 checks. + fn layer_fill(&self) -> Vec { + vec![self.kv.len()] + } +} + +#[test] +fn the_30b_adapter_keeps_the_forward_pass_contract() { + forward_pass_contract(&|| tiny(CTX)); + forward_pass_contract(&tiny_chunk3); +} + +#[test] +fn moved_tests_run_on_the_tiny_moe() { + let o = moved_prefix_reuse(&|| tiny(CTX)); + // The warm turn prefilled only its 3 new tokens: as many launches as a cold 3-token prefill. + let mut c = GenerationController::new(tiny(CTX)); + let (_, cold3) = gen(&mut c, &[5, 6, 7], &greedy(1), None).unwrap(); + assert_eq!(o.prefill_timing.launches, cold3.prefill_timing.launches); + moved_stops_caps_and_cancels(&|| tiny(CTX)); + moved_restored_prefix(&|| tiny(CTX), &tiny_chunk3); + moved_failed_restore(&|| tiny(CTX)); +} + +// --------------------------------------------------------------------------------------------- +// Dual run: the old loop (`generate`, `generate_with` on the engine) against the controller +// driving the same engine through the adapter. +// --------------------------------------------------------------------------------------------- + +/// The outcome without wall-clock fields: milliseconds and every nanosecond counter zeroed; the +/// counts (`launches`, `graph_tokens`, `graph_launches`, `graph_submits`) kept. +fn counts(o: &GenerateOutcome) -> GenerateOutcome { + let t = |s: &StepTiming| StepTiming { + launches: s.launches, + graph_tokens: s.graph_tokens, + graph_launches: s.graph_launches, + graph_submits: s.graph_submits, + ..StepTiming::default() + }; + GenerateOutcome { + prefill_ms: 0, + decode_ms: 0, + decode_timing: t(&o.decode_timing), + prefill_timing: t(&o.prefill_timing), + ..o.clone() + } +} + +/// The door's way of sampling: always the full logits (a logits-wanting `sample_next`). +struct DoorSampler(GenerateParams); + +impl Sampler for DoorSampler { + fn wants_logits(&self) -> bool { + true + } + fn pick(&mut self, logits: &[f32], step: usize) -> u32 { + sample_next(logits, &self.0, step) + } +} + +#[derive(Clone, Copy, Debug)] +enum Path { + /// `generate` / the controller with `SampleNext` (the argmax shortcut when greedy). + Convenience, + /// `generate_with` / the controller with a logits-wanting sampler (the door). + Door, +} + +fn old_turn( + e: &mut Qwen3MoeOmegaEngine, + p: &[u32], + params: &GenerateParams, + path: Path, +) -> (Vec, GenerateOutcome) { + let mut out = Vec::new(); + let mut emit = |t| { + out.push(t); + true + }; + let o = match path { + Path::Convenience => e.generate(p, params, &mut emit), + Path::Door => { + let q = params.clone(); + e.generate_with(p, params, &mut |l, s| sample_next(l, &q, s), &mut emit) + } + } + .unwrap(); + (out, o) +} + +fn new_turn( + c: &mut Ctl, + p: &[u32], + params: &GenerateParams, + path: Path, +) -> (Vec, GenerateOutcome) { + match path { + Path::Convenience => gen(c, p, params, None).unwrap(), + Path::Door => gen_with(c, p, params, &mut DoorSampler(params.clone()), None).unwrap(), + } +} + +/// Same tokens, same outcome counts, same ledger, the mirror equal to the ledger and the same +/// K/V bytes. +fn assert_same( + what: &str, + old: &mut Qwen3MoeOmegaEngine, + new: &mut Ctl, + a: (Vec, GenerateOutcome), + b: (Vec, GenerateOutcome), +) { + assert!( + a.0.len() >= 8 || a.1.finish != FinishReason::Length, + "{what}: a run of 8" + ); + assert_eq!(a.0, b.0, "{what}: tokens"); + assert_eq!(counts(&a.1), counts(&b.1), "{what}: outcome"); + assert_eq!(old.history(), new.history(), "{what}: ledger"); + assert_eq!( + new.model().history(), + new.history(), + "{what}: mirror history" + ); + assert_eq!( + new.model().position(), + new.position(), + "{what}: mirror position" + ); + let n = new.position(); + assert_eq!( + old.export_kv(0, n).unwrap(), + new.export_kv(0, n).unwrap(), + "{what}: K/V bytes" + ); +} + +fn dual_run(make: &dyn Fn() -> Qwen3MoeOmegaEngine, label: &str) { + for (pname, params) in [("greedy", greedy(8)), ("seeded", sampled(8, 5))] { + for path in [Path::Convenience, Path::Door] { + let what = format!("{label} {pname} {path:?}"); + let mut old = make(); + let mut new = GenerationController::new(make()); + // Cold. + let p1 = prompt(12, 1); + let a = old_turn(&mut old, &p1, ¶ms, path); + let b = new_turn(&mut new, &p1, ¶ms, path); + assert_eq!(b.1.reused_prompt_tokens, 0); + assert_same(&format!("{what} cold"), &mut old, &mut new, a, b); + // Warm: the thread resent with new tokens (prefix reuse). + let mut p2 = new.history().to_vec(); + p2.extend([5, 6, 7]); + let a = old_turn(&mut old, &p2, ¶ms, path); + let b = new_turn(&mut new, &p2, ¶ms, path); + assert_eq!(b.1.reused_prompt_tokens, p2.len() - 3); + assert_same(&format!("{what} warm"), &mut old, &mut new, a, b); + // A shorter prompt that diverges inside the history (a rewind). + let mut p3 = new.history()[..9].to_vec(); + p3.push(2); + let a = old_turn(&mut old, &p3, ¶ms, path); + let b = new_turn(&mut new, &p3, ¶ms, path); + assert_eq!(b.1.reused_prompt_tokens, 9); + assert_same(&format!("{what} rewind"), &mut old, &mut new, a, b); + // A stop id taken from the last reply: consumed, never emitted, in both loops. + let stop = new.history()[new.position() - 2]; + let mut ps = params.clone(); + ps.stop_token_ids = vec![stop]; + let mut p5 = new.history().to_vec(); + p5.push(1); + let a = old_turn(&mut old, &p5, &ps, path); + let b = new_turn(&mut new, &p5, &ps, path); + assert_same(&format!("{what} stop"), &mut old, &mut new, a, b); + // Restored: the parked prefix into fresh engines, the old one through its own + // restore_kv, the new one through the controller (the mirror resync case of I1). + let h = new.history().to_vec(); + let bytes = new.export_kv(0, h.len()).unwrap(); + let mut old_r = make(); + old_r.restore_kv(&h, &bytes).unwrap(); + let mut new_r = GenerationController::new(make()); + new_r.restore_kv(&h, &bytes).unwrap(); + let mut p4 = h.clone(); + p4.extend([4, 2]); + let a = old_turn(&mut old_r, &p4, ¶ms, path); + let b = new_turn(&mut new_r, &p4, ¶ms, path); + assert_eq!(b.1.reused_prompt_tokens, h.len()); + assert_same(&format!("{what} restored"), &mut old_r, &mut new_r, a, b); + } + } +} + +#[test] +fn the_old_loop_and_the_controller_on_the_adapter_agree() { + dual_run(&|| tiny(CTX), "chunk 8"); + dual_run(&tiny_chunk3, "chunk 3"); +} + +// --------------------------------------------------------------------------------------------- +// The mirror (I1) and the traces rule. +// --------------------------------------------------------------------------------------------- + +#[test] +fn the_mirror_resyncs_after_a_restore_and_refuses_a_position_the_cache_does_not_hold() { + let mut a: Ctl = GenerationController::new(tiny(CTX)); + gen(&mut a, &prompt(20, 3), &greedy(4), None).unwrap(); + let h = a.history().to_vec(); + let bytes = a.export_kv(0, h.len()).unwrap(); + + // Through the controller: the restore empties the mirror (begin_sequence is the engine's + // reset), the next forward call shows it the ledger and it takes the restored tokens. + let mut b: Ctl = GenerationController::new(tiny(CTX)); + gen(&mut b, &[9, 8, 7], &greedy(2), None).unwrap(); + b.restore_kv(&h, &bytes).unwrap(); + assert_eq!((b.model().position(), b.model().history().len()), (0, 0)); + let mut p = h.clone(); + p.push(1); + gen(&mut b, &p, &greedy(3), None).unwrap(); + assert_eq!(b.model().history(), b.history()); + assert_eq!(b.model().position(), b.position()); + assert_eq!(&b.history()[..h.len()], &h[..]); + + // Driven directly after an import it never saw, the mirror records unseen tokens, which the + // old loop's prefix rule never reuses. + let mut e = tiny(CTX); + e.kv().import_blocks(0, h.len(), &bytes).unwrap().unwrap(); + let mut t = StepTiming::default(); + e.decode(h.len(), &[1], &mut t).unwrap(); + assert_eq!(e.position(), h.len() + 1); + assert!(e.history()[..h.len()].iter().all(|&x| x == UNSEEN)); + assert_eq!(e.history()[h.len()], 1); + assert_eq!(e.reusable_prefix(&p), 0); + + // A position the cache does not hold is refused, whatever the mirror says (I1). + let mut f = tiny(CTX); + f.prefill(0, &prompt(10, 4), &mut t).unwrap(); + f.kv().truncate(6); + assert!(f.decode(10, &[1], &mut t).is_err(), "the cache holds 6"); + assert!(f.decode(7, &[1], &mut t).is_err(), "a gap"); + f.decode(6, &[1], &mut t).unwrap(); + assert_eq!((f.position(), f.history().len()), (7, 7)); + + // A different sequence of the same length imported over the mirror's own: without a + // ledger the mirror no longer claims its old tokens; with one it takes the ledger's. + let other = prompt(h.len(), 9); + let mut g = tiny(CTX); + g.prefill(0, &other, &mut t).unwrap(); + g.kv().truncate(0); + g.kv().import_blocks(0, h.len(), &bytes).unwrap().unwrap(); + g.decode(h.len(), &[1], &mut t).unwrap(); + assert!(g.history()[..h.len()].iter().all(|&x| x == UNSEEN)); + let mut g = tiny(CTX); + g.prefill(0, &other, &mut t).unwrap(); + g.kv().truncate(0); + g.kv().import_blocks(0, h.len(), &bytes).unwrap().unwrap(); + g.mirror_ledger(&h); + g.decode(h.len(), &[1], &mut t).unwrap(); + assert_eq!(&g.history()[..h.len()], &h[..]); +} + +#[test] +fn reset_clears_traces_and_rewind_keeps_them() { + let traced = || { + let mut e = tiny(CTX); + e.trace_layers = vec![0, 1]; + e + }; + let mut old = traced(); + let mut new: Ctl = GenerationController::new(traced()); + let p1 = prompt(10, 6); + old_turn(&mut old, &p1, &greedy(3), Path::Convenience); + gen(&mut new, &p1, &greedy(3), None).unwrap(); + let t1 = new.model().traces.clone(); + assert!(!t1.is_empty()); + assert_eq!(old.traces, t1); + // Prefix reuse rewinds: the traces of turn 1 stay, turn 2's are added after them. + let mut p2 = new.history().to_vec(); + p2.push(4); + old_turn(&mut old, &p2, &greedy(3), Path::Convenience); + gen(&mut new, &p2, &greedy(3), None).unwrap(); + let t2 = &new.model().traces; + assert!(t2.len() > t1.len()); + assert_eq!(&t2[..t1.len()], &t1[..], "a rewind keeps traces"); + assert_eq!(&old.traces, t2); + // A cold turn resets: only its own traces remain. + old_turn(&mut old, &[1, 2], &greedy(2), Path::Convenience); + gen(&mut new, &[1, 2], &greedy(2), None).unwrap(); + assert_eq!(old.traces, new.model().traces); + assert!(new.model().traces.iter().all(|t| t.pos < 3)); + new.reset(); + assert!(new.model().traces.is_empty(), "reset clears traces"); +} + +#[test] +fn kv_identity_names_every_switch_and_mutants_and_tracing_refuse() { + let base = tiny(32).kv_identity().unwrap(); + assert_eq!(base.kind, "qwen3-moe-omega"); + let names: Vec<_> = base.entries.iter().map(|(k, _)| *k).collect(); + let mut unique = names.clone(); + unique.sort_unstable(); + unique.dedup(); + assert_eq!(unique.len(), names.len(), "entry names are unique"); + let changed = |f: &dyn Fn(&mut Qwen3MoeOmegaEngine)| { + let mut e = tiny(32); + f(&mut e); + let id = e.kv_identity().unwrap(); + assert_ne!(id, base); + id.entries + .iter() + .zip(&base.entries) + .filter(|(a, b)| a != b) + .map(|(a, _)| a.0) + .collect::>() + }; + assert_eq!(changed(&|e| e.prefill_chunk = 3), ["prefill_chunk"]); + assert_eq!(changed(&|e| e.prefill_gemm ^= true), ["prefill_gemm"]); + assert_eq!( + changed(&|e| e.prefill_device_routing ^= true), + ["prefill_device_routing"] + ); + assert_eq!(changed(&|e| e.device_routing ^= true), ["device_routing"]); + assert_eq!(changed(&|e| e.decode_graph ^= true), ["decode_graph"]); + let c = tiny_config(); + assert_eq!( + changed(&|e| e.kv = Box::new(HostKv::new(&KvGeometry::from(&c), 32))), + ["attention_path"] + ); + type ConfigFlip = dyn Fn(&mut Qwen3MoeConfig); + // Every config field that reaches a K/V byte moves its own entry; the stop ids do not. + let cfg: [(&str, &ConfigFlip); 13] = [ + ("layers", &|c| c.layers += 1), + ("hidden", &|c| c.hidden += 1), + ("q_heads", &|c| c.q_heads += 1), + ("kv_heads", &|c| c.kv_heads += 1), + ("head_dim", &|c| c.head_dim += 1), + ("experts", &|c| c.experts += 1), + ("top_k", &|c| c.top_k += 1), + ("moe_intermediate", &|c| c.moe_intermediate += 1), + ("vocab", &|c| c.vocab += 1), + ("rms_eps", &|c| c.rms_eps *= 2.0), + ("rope_theta", &|c| c.rope_theta *= 2.0), + ("norm_topk_prob", &|c| c.norm_topk_prob ^= true), + ("tie_word_embeddings", &|c| c.tie_word_embeddings ^= true), + ]; + for (name, f) in cfg { + assert_eq!(changed(&|e| f(&mut e.weights.config)), [name]); + } + let mut s = tiny(32); + s.weights.config.eos_token_ids.push(7); + assert_eq!( + s.kv_identity().unwrap(), + base, + "stop ids change no K/V byte" + ); + let mut m = tiny(32); + m.routing_mutant = true; + assert!(m.kv_identity().is_err(), "the routing mutant refuses"); + let mut t = tiny(32); + t.trace_layers = vec![0]; + assert!(t.kv_identity().is_err(), "tracing refuses"); +} + +/// The greedy argmax the controller takes on the host head is the old loop's `sample_next`. +#[test] +fn greedy_on_the_host_head_is_the_argmax_of_its_logits() { + let mut e = tiny(CTX); + let mut t = StepTiming::default(); + let p = prompt(12, 2); + e.prefill(0, &p, &mut t).unwrap(); + let mut t = StepTiming::default(); + let l = match e.next(0, crate::generation::Want::Greedy, &mut t).unwrap() { + crate::generation::Next::Logits(l) => l.to_vec(), + crate::generation::Next::Token(_) => panic!("no graph on the host"), + }; + assert_eq!(sample_argmax(&l).0, sample_next(&l, &greedy(1), 0)); + assert_eq!(t.launches, 1, "the host lm_head counts one launch"); + let cold = cold_on(&|| tiny(CTX), &p, &greedy(8)); + assert_eq!(cold[0], sample_argmax(&l).0); +} diff --git a/docs/adr/0004-generation-controller-and-forward-pass-seam.md b/docs/adr/0004-generation-controller-and-forward-pass-seam.md index 8cb6b330..3c3fa891 100644 --- a/docs/adr/0004-generation-controller-and-forward-pass-seam.md +++ b/docs/adr/0004-generation-controller-and-forward-pass-seam.md @@ -372,3 +372,4 @@ Rules across all steps: the 30B is the running code until step 4 and keeps its m - 2026-10-15, step 0 sealed (replaces the "today" figures and "at least" floors of section 7 as the fixed G30-speed baseline): the frozen pre-migration baseline is `docs/inference/evidence/adr0004-step0-baseline-20261015/` on main 559f0f1e: `check-full-3/` for G30-tokens (IDENTICAL on all 4 prompts, parity and 10 of 10 mutants green) and G30-speed (39.1 / 36.1 / 37.5 / 36.6 tok/s, floors, 97 percent of the printed values, 37.927 calc:ca6917a169f4 / 35.017 calc:db0cafe07493 / 36.375 calc:0cc180e77663 / 35.502 calc:d0e63d84b0e7), and `door-2/` for the G30-door tokens (seed 1, temperature 1.0, top_p 1.0, top_k 0, max_tokens 64; the door returns text, so its token baseline is the byte-exact reply digest plus the reply token count and `reply_logprob`, listed in that folder's README); the G30-door speed floor stays 32.95. - 2026-10-15, step 1 (PR #543): `KvGeometry`, the `KvStore` supertrait split and the geometry-taking constructors landed as section 2.1 states, with three small additions: `KvStore::is_empty` (a default, required by clippy's `len_without_is_empty`), the pool and fused caches refuse a `block_size` other than `KV_BLOCK_SIZE` (their layout is fixed to it), and `OmegaFusedKv`'s inherent `geometry()` is renamed `pool_geometry()` (same body) so it does not shadow `KvStore::geometry`. `KvAttention::reset` is gone; the engine's `reset` calls `truncate(0)`. There is no constructor shim: `paged_and_host_pool_caches_export_the_same_bytes_and_round_trip` and the other tests now build their caches with `KvGeometry::from(&c)`; only `PoolBlockGeometry::for_config` stays as a shim. Receipts in `docs/inference/evidence/adr0004-step1-20261015/`: host tests green, G30-kv green on the host and on the chip pool, the exported KV bytes equal digests printed on main 559f0f1e, and G30-tokens `--tokens-only` IDENTICAL on all 4 prompts with the chip token lists equal to `check-full-3`'s. - 2026-10-15, step 2 (PR #550): `ForwardPass`, `Sampler`, `Constraint`, `StepRule`, `GenerationController`, `Locked` and the `EchoChainModel` host fake landed in `aien-inference-abi` as `generation` (the fake at `generation::echo_chain`, behind `host-test-engine`), with the contract suite and the section 5 tests the fake can carry (26 tests); `FinishReason::Constraint`, which the door maps to `Stop`. The 30B is untouched: no adapter, no caller changes; the only edits outside the new module are that variant, the door's match arm, the `pub mod` line and `HostPoolKv::layer_len` (per-layer fill, read by R1). Small departures from section 2, all pinned by tests: the controller reads the cache capacity once at `new` into a `capacity` field (section 2.4's `max_context_tokens(&self)` cannot call `kv(&mut self)`; I6 fixes the cache for the adapter's lifetime); an `Allow` set must be strictly ascending, so duplicates are refused, and a sampler pick outside the set is an error with the rollback, as is a token returned for `Want::Logits`; `SampleNext` is the `Sampler` built from `sample_next` (section 2.4's `generate` convenience). The fake keeps unread heads when it lends its cache, so the controller's own `clear_pending` calls are tested (each removal goes red); a head is stale after a truncate that drops a row or an import, which is how the fake keeps I2's "read after truncate" rule. Not carried yet: the tiny-MoE runs, the dual-run test and the traces test (step 3), and speculative decode (no batch above 1 is sent). Receipts in `docs/inference/evidence/adr0004-step2-20261015/`: host tests green, R1 red at 42408a8 then green, the allowed-set check red then green, both negative controls red over 8 of 8 tokens. +- 2026-10-15, step 3 (PR #557): `impl ForwardPass for Qwen3MoeOmegaEngine` at `qwen3_moe_omega/forward_pass.rs`, beside `generate_inner`; no caller switched. Prefill and decode call `whole_prompt_prefill`, the `step_batch` chunk loop, `decode_step`, `logits` and `dgraph_*` in `generate_inner`'s order; no kernel, launch order, graph or KV adapter changed. The moved controller tests are generic and run on the host fake and the tiny MoE; the contract suite runs on the tiny MoE at the default chunk and at chunk 3; the dual run (old loop against controller plus adapter: both paths, greedy and seeded sampling, cold, warm, rewind, a stop turn and a restored prefix) agrees on tokens, every outcome counter but milliseconds, the ledger, the mirror and the exported K/V bytes. Departures from section 2, each pinned by a test that went red first: (a) the migration-only hook `ForwardPass::mirror_ledger` (default no-op), called by the controller before each forward call so the 30B mirror takes the ledger's tokens, deleted at step 5; (b) every forward call and every `kv()` lending forgets all unread heads, the graph's pending token included (today's prefill does not clear it); `kv()` also marks the cache lent, so the next call rebuilds the mirror from the ledger, or marks unseen positions (`u32::MAX`) when driven without one; (c) `begin_sequence` is the engine's full `reset` (traces cleared; a rewind keeps them, as today); (d) `kv_identity` refuses the routing mutant and parity tracing; (e) after `next`, `last_timing` holds only the host lm_head's time, or zero for a graph token or read-back, so no time is counted twice. Not covered on the host, owed by step 4: the graph `Token` and logits read-back heads and the whole-prompt prefill run only on the chip, so step 4 adds a chip dual run comparing the outcome counters; the 30B's per-layer fill is not visible (`KvAttention` reports the minimum), so `assert_at_ledger` on the tiny MoE checks one length; the door still stores traced runs that `kv_identity` refuses, so step 7 should expect a key namespace change. Receipts in `docs/inference/evidence/adr0004-step3-20261015/`: host tests 394 passed, the red runs, and the chip gate on the old loop with the adapter built in (G30-tokens IDENTICAL to step 0's `check-full-3`; G30-speed p1 38.74, p2 35.90, p3 36.70, p4 36.36 tok/s against floors 37.927 / 35.017 / 36.375 / 35.502; load 1.72 to 3.47). diff --git a/docs/inference/evidence/adr0004-step3-20261015/README.md b/docs/inference/evidence/adr0004-step3-20261015/README.md new file mode 100644 index 00000000..f8b4eb36 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/README.md @@ -0,0 +1,28 @@ +# ADR 0004 step 3 gate receipts (2026-10-15) + +CALC-EXEMPT: every number is copied from a log or `run.json` in this folder or the step 0 baseline; +the floors are the step 0 README's, with their calc ids there. + +Branch `adr0004-step3` (PR #557). The 30B adapter `impl ForwardPass for Qwen3MoeOmegaEngine` sits beside +`generate_inner`; no caller switched, so the chip run below runs the old loop (the running code until step 4). + +| Gate | Receipt | Result | +|---|---|---| +| Host tests, both crates (`cargo test -p aien-inference-abi -p aien-serve-http --features aien-inference-abi/host-test-engine -- --test-threads=1`, stub build), at 1cde6150 less one test-only type alias added for clippy | `host-tests.txt` | 394 passed, 0 failed, 17 ignored (as step 2); the `aien-inference-abi` lib 231 passed (step 2: 224). Includes the dual run, the contract suite on the tiny MoE (default chunk and chunk 3), the moved tests on both adapters, the resync-after-restore case and the traces test | +| Red before green for each adapter fix | `red-run-naive-adapter.txt` | the naive adapter red on 4 tests (time counted twice, mirror unseen without the hook, dual-run decode launches, a head surviving a truncate); the review fix (cache lent through `kv()`) red without the flag | +| `clippy -D warnings` (`aien-inference-abi` with and without `host-test-engine`, `aien-serve-http`, all targets) | run locally, and CI | clean | +| G30-tokens, against `../adr0004-step0-baseline-20261015/check-full-3` | `check-full/run.json`, `check-full.raw` | `SUMMARY parity=PASS tokens=PASS`; `run.json` pass true; `first_diff` null on all 4 prompts; sha256 of `jq -c '[.prompts[] | .chip]'` begins `bb1a0401175ab69d` in both: IDENTICAL | +| G30-speed, decode tok/s against the step 0 floors | `check-full/run.json` `.prompts[].tok_s` | p1 38.74 (floor 37.927), p2 35.90 (35.017), p3 36.70 (36.375), p4 36.36 (35.502): all above | + +## Chip run +- `step3-runs.sh` with `SKIP_DOOR=1` (step 3's gate names G30-tokens and G30-speed only; the door does not + change until step 4). One `quietlock hold --owner STEP3 --minutes 20`, 02:06:53Z to 02:08:33Z. The exact + command line is in `check-full.start`; it is step 0's check-full with the same arguments and `--force-memory` + (the idle 30B server on :18091, about 36 GB, was left running). +- sc `f2b9e017` (this branch merged with main), no tracked change outside this folder; omega `4799f9eb`, + `libomega_gpu.a` sha256 `0629ad9c...`, the same locked archive as step 0. The binary was built at `1cde6150`; + the two later merges of main changed only crumbs, docs, scripts and benchmark data, none of it in the binary. +- 1-minute load average: 1.72 at start, 3.47 at end (`check-full.start`, `check-full.end`). The gate waited + for load at or under 4 and for the ternary T0 and trainer lanes to be idle for 10 minutes. + +`SHA256SUMS` lists the receipts. diff --git a/docs/inference/evidence/adr0004-step3-20261015/SHA256SUMS b/docs/inference/evidence/adr0004-step3-20261015/SHA256SUMS new file mode 100644 index 00000000..d28c9cd8 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/SHA256SUMS @@ -0,0 +1,11 @@ +b8a91f3fac75239e8fa1ec6b6900bfeb4f0484819ceec89bf1a6d0d9bc76f486 ./check-full.end +642d485738f395bb28773ed512e693a49f184dcd59c55d03f5d05d3cb5c94d7a ./check-full.err +5925b5b3cb16d884d6619d4f916aa0c054bedeeed529fff1120db2102914ad34 ./check-full.raw +9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa ./check-full.rc +edc26a9fc9f0f43e661597e1c6ba6dbc63d73e31b50ec59819181ea870fc08c2 ./check-full/run.json +ff860f08368b0d9c94b58101332041f5261551a44b66fdaa68c3c0aa790b1586 ./check-full/run.log +8be4798b526210d27dbfa21041d42adb72ed98b82ed34fcbb28042347154303f ./check-full.start +8e7bc37a49b49ec5ba434fa9019f9d772ec35b19e545399afe3f880e8c078ae2 ./host-tests.txt +f6fb814b704378cd0b3ee4bfb27b64c00dfa3e193a2bf2775dbe02cffc4ba33a ./README.md +6a3624365844e86143b1cb87862722902a36e017e48f80e3d86f2940dee61b61 ./red-run-naive-adapter.txt +c5e583975d670015a6eb04ffc7e64b55019264292a452f62d071bff4cf403b76 ./step3-runs.sh diff --git a/docs/inference/evidence/adr0004-step3-20261015/check-full.end b/docs/inference/evidence/adr0004-step3-20261015/check-full.end new file mode 100644 index 00000000..f44b5eaf --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/check-full.end @@ -0,0 +1,4 @@ +ended 2026-10-16T02:08:33Z + 21:08:33 up 9 days, 14:37, 18 users, load average: 3.47, 2.53, 4.43 +MemAvailable: 74621292 kB +:18091 log lines 907 diff --git a/docs/inference/evidence/adr0004-step3-20261015/check-full.err b/docs/inference/evidence/adr0004-step3-20261015/check-full.err new file mode 100644 index 00000000..79d0f29b --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/check-full.err @@ -0,0 +1,11 @@ + [6s] model.layers.4.mlp.experts.down + [12s] model.layers.9.mlp.experts.down + [17s] model.layers.14.mlp.experts.down + [23s] model.layers.19.mlp.experts.down + [28s] model.layers.24.mlp.experts.down + [34s] model.layers.29.mlp.experts.down + [39s] model.layers.34.mlp.experts.down + [44s] model.layers.39.mlp.experts.down + [49s] model.layers.44.mlp.experts.down + [53s] lm_head + [55s] kv fused cache 768 MB resident=true diff --git a/docs/inference/evidence/adr0004-step3-20261015/check-full.raw b/docs/inference/evidence/adr0004-step3-20261015/check-full.raw new file mode 100644 index 00000000..c92d749d --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/check-full.raw @@ -0,0 +1,44 @@ +mem available before load: 71.6 GB +engine native=true window_api=true fp8_api=true dattn_api=true weights=Fp8All attn=Fused spin_us=Some(2000) cta_budget=Some(64) +prefill path gemm routing host (gemm_api=true) +attention path fused prefill_chunk 64 batched_prefill_possible true +router path device lm_head path gemv (router_api=true bf16_api=true) +decode graph OFF (dgraph_api=true, OWN30B_DECODE_GRAPH=1 to turn on) mutant none +whole-prompt prefill OFF device router/combine OFF +LOAD: 54.3s resident 30.53 GB host 0.67 GB peak_rss 31.94 GB (before 0.13 GB) kv_resident=true mem_available_after 41.0 GB +LOAD peak over resident+host: 0.74 GB (budget 6 GB) -> PASS +PARITY layer 0 over 20 positions (p2-short): attention cosine(min) 0.999999 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 8.79e-7 router x' rel(max) 1.54e-7 -> PASS +PARITY layer 23 over 20 positions (p2-short): attention cosine(min) 0.999957 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 9.69e-7 router x' rel(max) 2.05e-7 -> PASS +PARITY layer 47 over 20 positions (p2-short): attention cosine(min) 0.999997 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 7.30e-7 router x' rel(max) 2.15e-7 -> PASS +CONTROL routing-mutant: layer 0 moe cosine(min) 0.3692 -> CAUGHT +CONTROL fp8-scales-dropped: layer 0 moe cosine(min) 0.8582 -> CAUGHT +CONTROL attention-mutant-1: layer 0 attention cosine(min) 0.8221 over 20 positions -> CAUGHT +CONTROL router-mutant-1: layer 0 moe cosine(min) 0.7682 routing_agrees=false routing weights err(max) 6.70e-1 router x' rel(max) 2.76e1 over 4 positions -> CAUGHT +CONTROL router-mutant-2: layer 0 moe cosine(min) 0.5346 routing_agrees=false routing weights err(max) 2.20e-1 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +CONTROL router-mutant-3: layer 0 moe cosine(min) -0.1282 routing_agrees=true routing weights err(max) 6.26e-7 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +CONTROL router-mutant-4: layer 0 moe cosine(min) 1.0000 routing_agrees=true routing weights err(max) 7.73e-1 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +PREFILL chunk 1 (p3-medium, 204 tokens): 5.07s = 24.8 ms/token; per token: attention 10.2 ms experts 14.6 ms (routing 0.00 ms, sort+swiglu+combine 0.00 ms) host 0.6 ms chip-reported 22.6 ms launches 288.0; first tokens [12, 576, 50275, 55, 26467, 5711, 279, 18865] +PREFILL chunk 64 (p3-medium, 204 tokens): 2.89s = 14.2 ms/token; per token: attention 6.1 ms experts 7.9 ms (routing 0.97 ms, sort+swiglu+combine 0.71 ms) host 0.1 ms chip-reported 10.6 ms launches 51.8; first tokens [12, 576, 50275, 55, 26467, 5711, 279, 18865] +PREFILL chunk 64 vs 1: tokens IDENTICAL ; first-step logits cosine 0.9999987 max abs diff 5.32e-2 ; 24.8 -> 14.2 ms/token -> PASS +CONTROL gemm-mutant-1: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.1695 max abs diff 3.09e1 tokens [80238] vs clean [220] -> CAUGHT +CONTROL gemm-mutant-2: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.9568 max abs diff 8.19e0 tokens [3175] vs clean [220] -> CAUGHT +CONTROL gemm-mutant-3: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.9194 max abs diff 1.16e1 tokens [279] vs clean [220] -> CAUGHT +CONTROL gemm-mutants-off: the clean prefill after the mutants is bit-identical to before -> PASS +TOKENS p1-one-token: 1 prompt tokens, prefill 0.02s (24.0 ms/token; chunk 64, per token attention 9.4 ms experts 14.6 ms host 0.6 ms launches 288.0), decode 16 tokens in 413 ms = 25.8 ms/token = 38.7 tok/s; per step: attention 9.0 ms experts 13.6 ms lm_head 3.0 ms host 0.6 ms chip-reported 23.5 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: " and welcome to the 2024-25 season of the National" + cpu text: " and welcome to the 2024-25 season of the National" +TOKENS p2-short: 20 prompt tokens, prefill 0.33s (16.5 ms/token; chunk 64, per token attention 6.3 ms experts 10.1 ms host 0.1 ms launches 57.6), decode 7 tokens in 195 ms = 27.9 ms/token = 35.9 tok/s; per step: attention 9.7 ms experts 14.5 ms lm_head 3.4 ms host 0.6 ms chip-reported 25.4 ms launches 289.14285714285717; IDENTICAL + DECODE GRAPH OFF: 0 of 7 decode steps as one list (the first step is the prefill's lm_head); per step launches 289.1 submits 289.1; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "The capital of France is Paris." + cpu text: "The capital of France is Paris.<|im_end|>" +TOKENS p3-medium: 204 prompt tokens, prefill 2.83s (13.9 ms/token; chunk 64, per token attention 6.1 ms experts 7.7 ms host 0.1 ms launches 51.1), decode 16 tokens in 436 ms = 27.2 ms/token = 36.7 tok/s; per step: attention 10.1 ms experts 13.8 ms lm_head 3.1 ms host 0.6 ms chip-reported 24.9 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "- The DGX Spark uses the GB10 Grace Blackwell superchip," + cpu text: "- The DGX Spark uses the GB10 Grace Blackwell superchip," +TOKENS p4-long: 657 prompt tokens, prefill 9.52s (14.5 ms/token; chunk 64, per token attention 6.6 ms experts 7.7 ms host 0.1 ms launches 51.0), decode 16 tokens in 440 ms = 27.5 ms/token = 36.4 tok/s; per step: attention 10.5 ms experts 13.7 ms lm_head 3.0 ms host 0.6 ms chip-reported 25.1 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "What went wrong: \nIn **run 10**, the model's output" + cpu text: "What went wrong: \nIn **run 10**, the model's output" +SUMMARY parity=PASS tokens=PASS peak_rss=33.41 GB +receipt: /home/drakestapleton/workspace/.worktrees/adr0004-step3/docs/inference/evidence/adr0004-step3-20261015/check-full diff --git a/docs/inference/evidence/adr0004-step3-20261015/check-full.rc b/docs/inference/evidence/adr0004-step3-20261015/check-full.rc new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/check-full.rc @@ -0,0 +1 @@ +0 diff --git a/docs/inference/evidence/adr0004-step3-20261015/check-full.start b/docs/inference/evidence/adr0004-step3-20261015/check-full.start new file mode 100644 index 00000000..6e5448d6 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/check-full.start @@ -0,0 +1,15 @@ +queued 2026-10-16T02:06:53Z sc f2b9e0174c1387b094742a202c99eaf1e844e0a8 omega 4799f9eba563e9c69579b47c477e7d9c2b0f15cb +tracked changes outside this folder: 0 +libomega_gpu.a sha256 0629ad9cec0addd4ccc461f0523c2c3964964f0bafc0b98b678e5080b0373ae5 +driver 580.173.02 kernel 7.0.0-1019-nvidia + 21:06:53 up 9 days, 14:35, 18 users, load average: 1.72, 2.19, 4.56 +MemAvailable: 75102200 kB +pid, process_name, used_gpu_memory [MiB] +15251, /home/drakestapleton/handoffs/pin-bin-f881710a/aien-serve-http, 36424 MiB +utilization.gpu [%], temperature.gpu, power.draw [W], pstate +0 %, 37, 4.85 W, P8 +listeners: 127.0.0.1:18080 127.0.0.1:18091 127.0.0.1:18092 127.0.0.1:18095 +:18091 log lines 907 +binary /home/drakestapleton/workspace/.worktrees/adr0004-step3/target/release/own30b_check sha256 ab5f909c4c8bfb558c424b7eeecae44a439371ab1d0b349fbb0a8856e5c477a3 +cmd quietlock hold --owner STEP3 --minutes 20 -- flock /tmp/aien-gb10.lock env AIEN_OMEGA_SPIN_US=2000 /home/drakestapleton/workspace/.worktrees/adr0004-step3/target/release/own30b_check chip /home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8 /home/drakestapleton/workspace/.worktrees/adr0004-step3/docs/inference/evidence/own30b-f-20261013T1745Z/golden.json /home/drakestapleton/workspace/.worktrees/adr0004-step3/docs/inference/evidence/adr0004-step3-20261015/check-full --prompts 1,2,3,4 --new 16 --layers 0,23,47 --weights fp8 --attn fused --router device --lm-head gemv --prefill auto --force-memory +lock acquired 2026-10-16T02:06:53Z diff --git a/docs/inference/evidence/adr0004-step3-20261015/check-full/run.json b/docs/inference/evidence/adr0004-step3-20261015/check-full/run.json new file mode 100644 index 00000000..164288e9 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/check-full/run.json @@ -0,0 +1,384 @@ +{ + "checkpoint": "/home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8", + "controls": [ + { + "caught": true, + "control": "routing-mutant", + "moe_cosine_min": 0.3692025137900707 + }, + { + "caught": true, + "control": "fp8-scales-dropped", + "moe_cosine_min": 0.8582220221305831 + }, + { + "attn_cosine_min": 0.8221134324507205, + "caught": true, + "control": "attention-mutant-1" + }, + { + "caught": true, + "control": "router-mutant-1", + "moe_cosine_min": 0.7682029976699462, + "router_xprime_rel_max": 27.602657318115234, + "routing_agrees": false, + "routing_weight_err_max": 0.66987144947052 + }, + { + "caught": true, + "control": "router-mutant-2", + "moe_cosine_min": 0.5345981367501033, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": false, + "routing_weight_err_max": 0.21989747881889343 + }, + { + "caught": true, + "control": "router-mutant-3", + "moe_cosine_min": -0.1282351225769249, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": true, + "routing_weight_err_max": 6.258487701416016e-7 + }, + { + "caught": true, + "control": "router-mutant-4", + "moe_cosine_min": 0.999999999999559, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": true, + "routing_weight_err_max": 0.7731469869613647 + }, + { + "caught": true, + "control": "gemm-mutant-1", + "logits_cosine": 0.1695149104933057, + "max_abs_diff": 30.896467208862305 + }, + { + "caught": true, + "control": "gemm-mutant-2", + "logits_cosine": 0.9568050213120963, + "max_abs_diff": 8.191482543945312 + }, + { + "caught": true, + "control": "gemm-mutant-3", + "logits_cosine": 0.9193720714189647, + "max_abs_diff": 11.63990592956543 + } + ], + "engine": { + "attention": "fused", + "bf16_api": true, + "cta_budget": 64, + "dattn_api": true, + "fp8_api": true, + "kv_resident": true, + "lm_head": "gemv", + "max_context": 8192, + "native": true, + "prefill_chunk": 64, + "prefill_path": "gemm", + "prefill_routing": "host", + "router": "device", + "router_api": true, + "spin_us": 2000, + "weights": "Fp8All", + "window_api": true + }, + "golden": "/home/drakestapleton/workspace/.worktrees/adr0004-step3/docs/inference/evidence/own30b-f-20261013T1745Z/golden.json", + "load": { + "host_bytes": 673505280, + "peak_rss_before_bytes": 133427200, + "peak_rss_bytes": 31940620288, + "resident_bytes": 30526627840, + "seconds": 54.262661334, + "transient_gb": 0.7404871680000014 + }, + "long_prompt": null, + "parity": [ + { + "attn_cosine_min": 0.9999988846132656, + "layer": 0, + "moe_cosine_min": 0.9999999999980523, + "moe_p95_rel_max": 1.210719347000122e-6, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 1.5420889099004853e-7, + "routing_agrees": true, + "routing_weight_err_max": 8.791685104370117e-7 + }, + { + "attn_cosine_min": 0.9999568509533563, + "layer": 23, + "moe_cosine_min": 0.9999999999963317, + "moe_p95_rel_max": 5.8067962527275085e-6, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 2.0500769437603594e-7, + "routing_agrees": true, + "routing_weight_err_max": 9.685754776000977e-7 + }, + { + "attn_cosine_min": 0.9999974833824463, + "layer": 47, + "moe_cosine_min": 0.9999999999997126, + "moe_p95_rel_max": 0.00001903623342514038, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 2.1530942717618018e-7, + "routing_agrees": true, + "routing_weight_err_max": 7.301568984985352e-7 + } + ], + "pass": true, + "prefill": { + "chunk": 64, + "launches_per_token_chunk": 51.76470588235294, + "launches_per_token_chunk1": 288.0, + "logits_cosine": 0.9999987410879339, + "logits_max_abs_diff": 0.053193092346191406, + "prefill_ms_chunk": 2887, + "prefill_ms_chunk1": 5068, + "prompt": "p3-medium", + "prompt_tokens": 204, + "tokens_identical": true + }, + "prompts": [ + { + "chip": [ + 323, + 10565, + 311, + 279, + 220, + 17, + 15, + 17, + 19, + 12, + 17, + 20, + 3200, + 315, + 279, + 5055 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 413, + "emitted": 16, + "first_diff": null, + "golden": [ + 323, + 10565, + 311, + 279, + 220, + 17, + 15, + 17, + 19, + 12, + 17, + 20, + 3200, + 315, + 279, + 5055 + ], + "name": "p1-one-token", + "per_step_ms": { + "attention": 8.9672914375, + "chip_reported": 23.5332508125, + "experts": 13.6090473125, + "host": 0.5899056875, + "launches": 271.0, + "lm_head": 3.007900875 + }, + "prefill_ms": 24, + "prompt_tokens": 1, + "tok_s": 38.7409200968523 + }, + { + "chip": [ + 785, + 6722, + 315, + 9625, + 374, + 12095, + 13 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 2024, + "timeline": null + }, + "decode_ms": 195, + "emitted": 7, + "first_diff": null, + "golden": [ + 785, + 6722, + 315, + 9625, + 374, + 12095, + 13, + 151645 + ], + "name": "p2-short", + "per_step_ms": { + "attention": 9.682963142857144, + "chip_reported": 25.435980714285712, + "experts": 14.525397142857143, + "host": 0.6321052857142858, + "launches": 289.14285714285717, + "lm_head": 3.4420957142857143 + }, + "prefill_ms": 330, + "prompt_tokens": 20, + "tok_s": 35.8974358974359 + }, + { + "chip": [ + 12, + 576, + 50275, + 55, + 26467, + 5711, + 279, + 18865, + 16, + 15, + 31071, + 5235, + 9157, + 2256, + 29662, + 11 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 436, + "emitted": 16, + "first_diff": null, + "golden": [ + 12, + 576, + 50275, + 55, + 26467, + 5711, + 279, + 18865, + 16, + 15, + 31071, + 5235, + 9157, + 2256, + 29662, + 11 + ], + "name": "p3-medium", + "per_step_ms": { + "attention": 10.1438534375, + "chip_reported": 24.875714625, + "experts": 13.762577125, + "host": 0.594873375, + "launches": 271.0, + "lm_head": 3.061875125 + }, + "prefill_ms": 2833, + "prompt_tokens": 204, + "tok_s": 36.69724770642202 + }, + { + "chip": [ + 3838, + 3937, + 4969, + 25, + 2303, + 641, + 3070, + 6108, + 220, + 16, + 15, + 97219, + 279, + 1614, + 594, + 2550 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 440, + "emitted": 16, + "first_diff": null, + "golden": [ + 3838, + 3937, + 4969, + 25, + 2303, + 641, + 3070, + 6108, + 220, + 16, + 15, + 97219, + 279, + 1614, + 594, + 2550 + ], + "name": "p4-long", + "per_step_ms": { + "attention": 10.5144228125, + "chip_reported": 25.1455225625, + "experts": 13.6719965, + "host": 0.59508275, + "launches": 271.0, + "lm_head": 3.0415611875 + }, + "prefill_ms": 9520, + "prompt_tokens": 657, + "tok_s": 36.36363636363637 + } + ] +} \ No newline at end of file diff --git a/docs/inference/evidence/adr0004-step3-20261015/host-tests.txt b/docs/inference/evidence/adr0004-step3-20261015/host-tests.txt new file mode 100644 index 00000000..c3819635 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/host-tests.txt @@ -0,0 +1,74 @@ +# host tests, 2026-10-15T20:22:59-05:00, HEAD 9ddf5cb5 + uncommitted review fixes +# cargo test -p aien-inference-abi -p aien-serve-http --features aien-inference-abi/host-test-engine -- --test-threads=1 + Running unittests src/lib.rs (target/debug/deps/aien_inference_abi-1ddec709b86aeab4) +test result: ok. 231 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out; finished in 66.26s + Running unittests src/bin/own30b_check.rs (target/debug/deps/own30b_check-220d3859f8c7b443) +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running unittests src/bin/own30b_ttft.rs (target/debug/deps/own30b_ttft-11216b2cd46e3280) +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running unittests src/bin/own30b_wp_gate.rs (target/debug/deps/own30b_wp_gate-a1cea4bc582a3e75) +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/attention_wiring.rs (target/debug/deps/attention_wiring-159d7c6e6fef0759) +test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/bf16_paged_attention.rs (target/debug/deps/bf16_paged_attention-0540f0d587e0f423) +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/branch_client_harness.rs (target/debug/deps/branch_client_harness-8abbe10e30925e1a) +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s + Running tests/chat_prompt_pin.rs (target/debug/deps/chat_prompt_pin-05c5d81857010a0c) +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.19s + Running tests/gb10_serving_reservation.rs (target/debug/deps/gb10_serving_reservation-18efd170148d2112) +test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/kv_seam_backend_test.rs (target/debug/deps/kv_seam_backend_test-96e21ae27166ee29) +test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s + Running tests/llama32_pin.rs (target/debug/deps/llama32_pin-8033e73653f1e8ef) +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/omega_backend_parity.rs (target/debug/deps/omega_backend_parity-491efa9d1d072b8d) +test result: ok. 1 passed; 0 failed; 6 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/openwaldo_byte_tokenizer.rs (target/debug/deps/openwaldo_byte_tokenizer-5096ad0acfec32b2) +test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s + Running tests/openwaldo_forward_parity.rs (target/debug/deps/openwaldo_forward_parity-b8ed76c2fd6379d6) +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s + Running tests/paged_attention_parity.rs (target/debug/deps/paged_attention_parity-dce037a43a0c59a1) +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/paged_transformer_parity.rs (target/debug/deps/paged_transformer_parity-8c0ee9be69c05a9d) +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.16s + Running tests/plain_model_load.rs (target/debug/deps/plain_model_load-d01058a22cbe4213) +test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s + Running tests/prefill_pool_exhaustion.rs (target/debug/deps/prefill_pool_exhaustion-bc31bf691493b5c7) +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.10s + Running tests/qwen3_8b_chat_template.rs (target/debug/deps/qwen3_8b_chat_template-622607b98ccc504b) +test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/qwen3_chat_template.rs (target/debug/deps/qwen3_chat_template-afb6561e535265c1) +test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/qwen3_forward_parity.rs (target/debug/deps/qwen3_forward_parity-f3fd4f06ba1dc81d) +test result: ok. 11 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.08s + Running tests/qwen3_untied_head.rs (target/debug/deps/qwen3_untied_head-b22fa88af18ad585) +test result: ok. 2 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.01s + Running tests/resident_weights.rs (target/debug/deps/resident_weights-431b77dd3bcd0b94) +test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s + Running tests/smollm2_pin.rs (target/debug/deps/smollm2_pin-52bea84e8e4b3aa6) +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/tinyllama_noise_floor.rs (target/debug/deps/tinyllama_noise_floor-097ff6b0dd275e7c) +test result: ok. 3 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/tinyllama_parity.rs (target/debug/deps/tinyllama_parity-5c73cbbda4b3d2a7) +test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 402.25s + Running tests/tool_boundary.rs (target/debug/deps/tool_boundary-b2ce971afe4632c3) +test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s + Running tests/transformer_parity.rs (target/debug/deps/transformer_parity-65b1b2ff8d35605d) +test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s + Running unittests src/lib.rs (target/debug/deps/aien_serve_http-41b151ebfd7ef6ce) +test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s + Running unittests src/main.rs (target/debug/deps/aien_serve_http-431da38ac0275d8e) +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/kv_persist.rs (target/debug/deps/kv_persist-0cf66e9f99ef99bb) +test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 45.87s + Running tests/kv_persist_chip.rs (target/debug/deps/kv_persist_chip-8c08c1efabfcd5dc) +test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/loopback.rs (target/debug/deps/loopback-2cd67f035f59f5ba) +test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 70.56s + Running tests/shutdown.rs (target/debug/deps/shutdown-e2b32497810733de) +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s + Doc-tests aien_inference_abi +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Doc-tests aien_serve_http +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s diff --git a/docs/inference/evidence/adr0004-step3-20261015/red-run-naive-adapter.txt b/docs/inference/evidence/adr0004-step3-20261015/red-run-naive-adapter.txt new file mode 100644 index 00000000..e1a4026d --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/red-run-naive-adapter.txt @@ -0,0 +1,69 @@ +warning: unused import: `assert_at_ledger` + --> crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs:9:5 + | +9 | assert_at_ledger, cold_on, forward_pass_contract, gen, gen_with, greedy, + | ^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +warning: `aien-inference-abi` (lib test) generated 1 warning (run `cargo fix --lib -p aien-inference-abi --tests` to apply 1 suggestion) + Finished `test` profile [unoptimized + debuginfo] target(s) in 0.08s + Running unittests src/lib.rs (target/debug/deps/aien_inference_abi-aaa13f4a3c61d9be) + +running 7 tests +test qwen3_moe_omega::forward_pass::tests::greedy_on_the_host_head_is_the_argmax_of_its_logits ... FAILED +test qwen3_moe_omega::forward_pass::tests::the_mirror_resyncs_after_a_restore_and_refuses_a_position_the_cache_does_not_hold ... FAILED +test qwen3_moe_omega::forward_pass::tests::reset_clears_traces_and_rewind_keeps_them ... ok +test qwen3_moe_omega::forward_pass::tests::the_old_loop_and_the_controller_on_the_adapter_agree ... FAILED +test qwen3_moe_omega::forward_pass::tests::the_30b_adapter_keeps_the_forward_pass_contract ... FAILED +test qwen3_moe_omega::forward_pass::tests::kv_identity_names_every_switch_and_mutants_and_tracing_refuse ... ok +test qwen3_moe_omega::forward_pass::tests::moved_tests_run_on_the_tiny_moe ... ok + +failures: + +---- qwen3_moe_omega::forward_pass::tests::greedy_on_the_host_head_is_the_argmax_of_its_logits stdout ---- + +thread 'qwen3_moe_omega::forward_pass::tests::greedy_on_the_host_head_is_the_argmax_of_its_logits' (2163515) panicked at crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs:346:5: +assertion `left == right` failed: the host lm_head counts one launch + left: 57 + right: 1 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +---- qwen3_moe_omega::forward_pass::tests::the_mirror_resyncs_after_a_restore_and_refuses_a_position_the_cache_does_not_hold stdout ---- + +thread 'qwen3_moe_omega::forward_pass::tests::the_mirror_resyncs_after_a_restore_and_refuses_a_position_the_cache_does_not_hold' (2163520) panicked at crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs:234:5: +assertion `left == right` failed + left: [4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 1, 14, 14] + right: [40, 47, 54, 61, 4, 11, 18, 25, 32, 39, 46, 53, 60, 3, 10, 17, 24, 31, 38, 45, 62, 14, 14, 1, 14, 14] + +---- qwen3_moe_omega::forward_pass::tests::the_old_loop_and_the_controller_on_the_adapter_agree stdout ---- + +thread 'qwen3_moe_omega::forward_pass::tests::the_old_loop_and_the_controller_on_the_adapter_agree' (2163521) panicked at crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs:152:5: +assertion `left == right` failed: chunk 8 greedy Convenience cold: outcome + left: GenerateOutcome { emitted_tokens: 8, finish: Length, prefill_ms: 0, decode_ms: 0, prompt_tokens: 12, reused_prompt_tokens: 0, decode_timing: StepTiming { total_ns: 0, attention_ns: 0, experts_ns: 0, lm_head_ns: 0, host_ns: 0, chip_ns: 0, launches: 78, route_ns: 0, moe_host_ns: 0, graph_tokens: 0, graph_launches: 0, graph_submits: 0, graph_record_ns: 0 }, prefill_timing: StepTiming { total_ns: 0, attention_ns: 0, experts_ns: 0, lm_head_ns: 0, host_ns: 0, chip_ns: 0, launches: 40, route_ns: 0, moe_host_ns: 0, graph_tokens: 0, graph_launches: 0, graph_submits: 0, graph_record_ns: 0 } } + right: GenerateOutcome { emitted_tokens: 8, finish: Length, prefill_ms: 0, decode_ms: 0, prompt_tokens: 12, reused_prompt_tokens: 0, decode_timing: StepTiming { total_ns: 0, attention_ns: 0, experts_ns: 0, lm_head_ns: 0, host_ns: 0, chip_ns: 0, launches: 164, route_ns: 0, moe_host_ns: 0, graph_tokens: 0, graph_launches: 0, graph_submits: 0, graph_record_ns: 0 }, prefill_timing: StepTiming { total_ns: 0, attention_ns: 0, experts_ns: 0, lm_head_ns: 0, host_ns: 0, chip_ns: 0, launches: 40, route_ns: 0, moe_host_ns: 0, graph_tokens: 0, graph_launches: 0, graph_submits: 0, graph_record_ns: 0 } } + +---- qwen3_moe_omega::forward_pass::tests::the_30b_adapter_keeps_the_forward_pass_contract stdout ---- + +thread 'qwen3_moe_omega::forward_pass::tests::the_30b_adapter_keeps_the_forward_pass_contract' (2163519) panicked at crates/aien-inference-abi/src/generation/tests.rs:221:5: +no head survives a truncate + + +failures: + qwen3_moe_omega::forward_pass::tests::greedy_on_the_host_head_is_the_argmax_of_its_logits + qwen3_moe_omega::forward_pass::tests::the_30b_adapter_keeps_the_forward_pass_contract + qwen3_moe_omega::forward_pass::tests::the_mirror_resyncs_after_a_restore_and_refuses_a_position_the_cache_does_not_hold + qwen3_moe_omega::forward_pass::tests::the_old_loop_and_the_controller_on_the_adapter_agree + +test result: FAILED. 3 passed; 4 failed; 0 ignored; 0 measured; 227 filtered out; finished in 4.49s + +error: test failed, to rerun pass `-p aien-inference-abi --lib` + +## Review fix (SHOULD 2): equal-length import through kv() left the mirror claiming old tokens +Red, 2026-10-15: with `kv()` not marking the cache lent (`self.kv_lent = false`), the case +"a different sequence of the same length imported over the mirror's own" fails: +test qwen3_moe_omega::forward_pass::tests::the_mirror_resyncs_after_a_restore_and_refuses_a_position_the_cache_does_not_hold ... FAILED + panicked at crates/aien-inference-abi/src/qwen3_moe_omega/forward_pass/tests.rs:289:5 + (assert!(g.history()[..h.len()].iter().all(|&x| x == UNSEEN))) +test result: FAILED. 6 passed; 1 failed (filter qwen3_moe_omega::forward_pass) +Green with `kv_lent = true`: 33 passed; 0 failed (filter generation qwen3_moe_omega::forward_pass). diff --git a/docs/inference/evidence/adr0004-step3-20261015/step3-runs.sh b/docs/inference/evidence/adr0004-step3-20261015/step3-runs.sh new file mode 100755 index 00000000..60de8d0e --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261015/step3-runs.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# ADR 0004 migration step 3: G30-tokens and G30-speed with the 30B adapter present (the old loop still runs). +# check-full: own30b_check chip, the same arguments as own30b-idle-speed-20261015/own30b-idle-gates.sh +# check-full plus --force-memory (the idle exp445 server on :18091 keeps ~36 GB resident, +# so MemAvailable is below the tool's 70 GB guard; the guard only refuses, it changes nothing). +# door: door-window.sh (G30-door), its own server on PORT. +# One quietlock hold (owner STEP3, 20 min max) per run, released between runs. check-full also runs +# under /tmp/aien-gb10.lock; the door server takes that lock itself around each generation. +# EV= SC= [RUN=] step3-runs.sh (RUN=n names the outputs check-full-n, door-n); SKIP_DOOR=1 runs check-full only +set -u +SC=${SC:?worktree} +EV=${EV:?evidence dir} +B=$SC/target/release +CK=$HOME/models/qwen3-30b-a3b-instruct-2507-fp8 +G=$SC/docs/inference/evidence/own30b-f-20261013T1745Z/golden.json +HERE=$(cd "$(dirname "$0")" && pwd) +mkdir -p "$EV" +ground() { # name + { + echo "queued $(date -u +%FT%TZ) sc $(git -C "$SC" rev-parse HEAD) omega $(cat "$SC/omega.lock")" + echo "tracked changes outside this folder: $(git -C "$SC" status --porcelain | grep -v '^?? docs/inference/evidence/adr0004-step3' | grep -cv '^?? target')" + echo "libomega_gpu.a sha256 $(sha256sum "$B"/build/aien-omega-gpu-*/out/omega-build/libomega_gpu.a | cut -d' ' -f1)" + echo "driver $(nvidia-smi --query-gpu=driver_version --format=csv,noheader) kernel $(uname -r)" + uptime; grep MemAvailable /proc/meminfo + nvidia-smi --query-compute-apps=pid,process_name,used_memory --format=csv + nvidia-smi --query-gpu=utilization.gpu,temperature.gpu,power.draw,pstate --format=csv + echo "listeners: $(ss -ltn | awk 'NR>1{print $4}' | grep -E ':180[0-9][0-9]$' | sort | tr '\n' ' ')" + echo ":18091 log lines $(wc -l < "$HOME/workspace/exp445-runlogs/own30b-18091-f881710a.log" 2>/dev/null)" + } > "$EV/$1.start" +} +finish() { # name rc + echo "$2" > "$EV/$1.rc" + { + echo "ended $(date -u +%FT%TZ)"; uptime; grep MemAvailable /proc/meminfo + echo ":18091 log lines $(wc -l < "$HOME/workspace/exp445-runlogs/own30b-18091-f881710a.log" 2>/dev/null)" + } > "$EV/$1.end" + echo "$1 rc=$2" +} +R=${RUN:+-$RUN} +TOK="--prompts 1,2,3,4 --new 16 --layers 0,23,47 --weights fp8 --attn fused --router device --lm-head gemv --prefill auto" + +ground check-full$R +echo "binary $B/own30b_check sha256 $(sha256sum "$B/own30b_check" | cut -d' ' -f1)" >> "$EV/check-full$R.start" +echo "cmd quietlock hold --owner STEP3 --minutes 20 -- flock /tmp/aien-gb10.lock env AIEN_OMEGA_SPIN_US=2000 $B/own30b_check chip $CK $G $EV/check-full$R $TOK --force-memory" >> "$EV/check-full$R.start" +# shellcheck disable=SC2086 +quietlock hold --owner STEP3 --minutes 20 --reason "ADR 0004 step 3 own30b_check chip (adapter present)" -- \ + flock /tmp/aien-gb10.lock sh -c 'echo "lock acquired $(date -u +%FT%TZ)" >> "$0.start"; shift; exec "$@"' "$EV/check-full$R" x \ + env AIEN_OMEGA_SPIN_US=2000 "$B/own30b_check" chip "$CK" "$G" "$EV/check-full$R" $TOK --force-memory \ + > "$EV/check-full$R.raw" 2> "$EV/check-full$R.err" +finish check-full$R $? + +if [ -n "${SKIP_DOOR:-}" ]; then echo "all done $(date -u +%FT%TZ) (door skipped)"; exit 0; fi +ground door$R +echo "binary $B/aien-serve-http sha256 $(sha256sum "$B/aien-serve-http" | cut -d' ' -f1)" >> "$EV/door$R.start" +quietlock hold --owner STEP3 --minutes 20 --reason "ADR 0004 step 3 door seeded sampling" -- \ + "$HERE/../adr0004-step0-baseline-20261015/door-window.sh" "$B/aien-serve-http" "$EV/door$R" 18103 > "$EV/door$R.raw" 2> "$EV/door$R.err" +finish door$R $? +echo "all done $(date -u +%FT%TZ)" diff --git a/docs/inference/evidence/adr0004-step3-20261031/MISSING-LOGS.md b/docs/inference/evidence/adr0004-step3-20261031/MISSING-LOGS.md new file mode 100644 index 00000000..fcbd2f20 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/MISSING-LOGS.md @@ -0,0 +1,15 @@ +# Two receipts listed in SHA256SUMS are not in the tree + +`SHA256SUMS` lists `g30-tokens/run.log` (sha256 05d851b2...) and `g30-speed/run.log` (sha256 57439099...). +Neither file was committed: the repository `.gitignore` line 3 ignores `*.log`, and the run worktree +(`/tmp/corechip/w557`) was removed after the rerun, so the two logs no longer exist. `sha256sum -c SHA256SUMS` +therefore reports 2 files it cannot read; every other listed file matches (checked by Main, 2026-10-31). + +Neither gate result depends on the missing logs. Main re-derived both from committed files: + +- `g30-tokens.rc` and `g30-speed.rc` are `0`; both `.raw` files end with `SUMMARY parity=PASS tokens=PASS`. +- `jq -c '[.prompts[] | .chip]' run.json | sha256sum` begins `bb1a0401175ab69d` for `g30-tokens/run.json`, + `g30-speed/run.json` and `../adr0004-step0-baseline-20261015/check-full-3/run.json`. +- The decode rates come from the `TOKENS` lines in `g30-speed.raw`: p1 44.7, p2 42.2, p3 43.5, p4 42.2 tok/s. + +`SHA256SUMS` is left as the lane wrote it. Future reruns should `git add -f` any `run.log` named in a manifest. diff --git a/docs/inference/evidence/adr0004-step3-20261031/README.md b/docs/inference/evidence/adr0004-step3-20261031/README.md new file mode 100644 index 00000000..4b7e3e24 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/README.md @@ -0,0 +1,24 @@ +# ADR 0004 step 3, G30 rerun in the quiet window (2026-10-31, CoreChip) + +Rerun of the G30 tokens and speed gates of `../adr0004-step3-20261015/` on the merged head, with Flint stopped +(GPU compute-apps empty at start of each step), driver `/tmp/corechip/quiet/driver.sh` under +`systemd-run --user --unit corechip-quiet`. + +- Source: PR head `9e6ceefdcbae4b649c61605c134dd253d757ae0c` (adr0004-step3 merged with main ab1084d6). +- Binary: `own30b_check` built natively from that head (`--locked --release`, `AIEN_REQUIRE_NATIVE_LIBS=1`, + omega a647b6a9 as in `omega.lock`), sha256 `99594b5d6bef2bf33389d9f557709da4807bd53ec39eca113cc9e6dfd8e2517c`. +- Command (both steps): `env AIEN_OMEGA_SPIN_US=2000 own30b_check chip ~/models/qwen3-30b-a3b-instruct-2507-fp8 + ../own30b-f-20261013T1745Z/golden.json --prompts 1,2,3,4 --new 16 --layers 0,23,47 --weights fp8 + --attn fused --router device --lm-head gemv --prefill auto --force-memory`. +- Locks: `g30-tokens` in spark-window 20261031T071217Z-ea2cba (`--gb10 shared --quiet none`) under + `flock -s /tmp/aien-gb10.lock`; `g30-speed` in spark-window 20261031T071440Z-97707a (`--gb10 none --quiet + exclusive`, verdict "quiet machine") under `flock -x /tmp/aien-gb10.lock`. Telemetry: `.dmon` + (`nvidia-smi dmon -s pucm -d 1`). Each step's `.start` records commit, binary sha, admission and box state. + +| Step | rc | Result | +|---|---|---| +| g30-tokens | 0 | `SUMMARY parity=PASS tokens=PASS`; `first_diff` null on 4 prompts; sha256 of `jq -c '[.prompts[] \| .chip]' run.json` begins `bb1a0401175ab69d`, the same as `../adr0004-step0-baseline-20261015/check-full-3`: IDENTICAL | +| g30-speed | 0 | same token hash `bb1a0401175ab69d`; decode tok/s p1 44.7, p2 42.2, p3 43.5, p4 42.2 against floors 37.927 / 35.017 / 36.375 / 35.502: all above | + +Decode tok/s are the binary's own `TOKENS` lines in `g30-speed.raw` (16 tokens per prompt, p2 stops at 7 on eos). +`SHA256SUMS` lists the receipts. diff --git a/docs/inference/evidence/adr0004-step3-20261031/SHA256SUMS b/docs/inference/evidence/adr0004-step3-20261031/SHA256SUMS new file mode 100644 index 00000000..e0beaa1b --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/SHA256SUMS @@ -0,0 +1,17 @@ +33b6a987d00f9d7b66d10b24b6eb3cd7a7cddb22ba67796337b5fca10a55f512 ./g30-speed.dmon +ac13c8a70732e72483a8726e19755a715321b78f9dae46a5e6194e5c2f9af186 ./g30-speed.end +80a6fb180cf794d56a02f8bdc829a02d4e8cc2fad02b182cc0fe79d0ac637b30 ./g30-speed.err +9d959846ba410a3f777440869e03cbdf588cf22f590e4a38a7133f402bf9c812 ./g30-speed.raw +9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa ./g30-speed.rc +ec87c9401c7f635dc3a7b579ea43cb9c6cd48450b230e42a72371825d2052c91 ./g30-speed/run.json +574390990a65ebae8bef59f311208a76f4dee4b1de842bce70851a42244f1568 ./g30-speed/run.log +e9d6309cbd5a0c90ceccd10c89a90f7a943d77adfd4ddd9c53fa999efe18745e ./g30-speed.start +9114a0ffdcec5f74b59637c9ede6afaee284265b2db4cb2f1105bf4f10bccb82 ./g30-tokens.dmon +44642f97b52d8d50e13227e4235bea35b9c64b19e67d41c0d4e73c05fe41e5aa ./g30-tokens.end +b0c9a1a0e801dacfe86fcde7018fa02de3472c829982738ded78155dbf50fb95 ./g30-tokens.err +7573ce7a3cb332025d124ab4beb0ad0ddaf6e0967f410289cba88739577373f2 ./g30-tokens.raw +9a271f2a916b0b6ee6cecb2426f0b3206ef074578be55d9bc94f6f3fe3ab86aa ./g30-tokens.rc +49a339d3ba09275ec2f1b0d2cc7477dd295ca785f6b623f46a912a9cb45f2ac6 ./g30-tokens/run.json +05d851b296c1a50c0d964d64fac6a02a6357468b2a20a5b683bf66b4e2d9188f ./g30-tokens/run.log +40d4ffae887e1e8703244448008edfa4d2840dd8da9c2c899c527be559a0a655 ./g30-tokens.start +3dfe954afb8ae23913d4629834621634d0054daeb0e5cf44b7c90c9cf59bd8f0 ./README.md diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-speed.dmon b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.dmon new file mode 100644 index 00000000..3af3f9f9 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.dmon @@ -0,0 +1,82 @@ +#Time gpu pwr gtemp mtemp sm mem enc dec jpg ofa mclk pclk fb bar1 ccpm +#HH:MM:SS Idx W C C % % % % % % MHz MHz MB MB MB + 02:14:42 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:43 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:44 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:45 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:46 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:47 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:48 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:49 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:50 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:51 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:52 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:14:53 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:54 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:14:55 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:56 0 5 42 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:57 0 5 42 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:58 0 5 42 - 0 0 0 0 0 0 - 208 - - 0 + 02:14:59 0 5 42 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:00 0 5 42 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:01 0 5 42 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:02 0 5 42 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:03 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:04 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:05 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:06 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:08 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:09 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:10 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:11 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:12 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:13 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:14 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:15 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:16 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:17 0 5 43 - 1 0 0 0 0 0 - 208 - - 0 + 02:15:18 0 5 43 - 2 0 0 0 0 0 - 208 - - 0 + 02:15:19 0 16 43 - 0 0 0 0 0 0 - 591 - - 0 + 02:15:20 0 5 43 - 0 0 0 0 0 0 - 591 - - 0 + 02:15:21 0 5 43 - 0 0 0 0 0 0 - 591 - - 0 + 02:15:22 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:23 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:24 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:25 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:26 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 +#Time gpu pwr gtemp mtemp sm mem enc dec jpg ofa mclk pclk fb bar1 ccpm +#HH:MM:SS Idx W C C % % % % % % MHz MHz MB MB MB + 02:15:27 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:28 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:29 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:30 0 5 43 - 0 0 0 0 0 0 - 208 - - 0 + 02:15:31 0 17 44 - 35 0 0 0 0 0 - 1339 - - 0 + 02:15:32 0 26 48 - 79 0 0 0 0 0 - 2548 - - 0 + 02:15:33 0 32 48 - 79 0 0 0 0 0 - 2548 - - 0 + 02:15:34 0 32 48 - 80 0 0 0 0 0 - 2548 - - 0 + 02:15:35 0 32 49 - 80 0 0 0 0 0 - 2548 - - 0 + 02:15:36 0 31 48 - 71 0 0 0 0 0 - 2301 - - 0 + 02:15:37 0 26 49 - 66 0 0 0 0 0 - 2151 - - 0 + 02:15:38 0 26 49 - 71 0 0 0 0 0 - 2216 - - 0 + 02:15:39 0 27 49 - 81 0 0 0 0 0 - 2424 - - 0 + 02:15:40 0 27 49 - 64 0 0 0 0 0 - 2275 - - 0 + 02:15:41 0 28 49 - 71 0 0 0 0 0 - 2229 - - 0 + 02:15:42 0 28 49 - 70 0 0 0 0 0 - 2132 - - 0 + 02:15:43 0 26 49 - 72 0 0 0 0 0 - 2151 - - 0 + 02:15:44 0 27 49 - 71 0 0 0 0 0 - 2203 - - 0 + 02:15:45 0 27 50 - 80 0 0 0 0 0 - 2398 - - 0 + 02:15:46 0 29 50 - 70 0 0 0 0 0 - 2197 - - 0 + 02:15:47 0 26 49 - 69 0 0 0 0 0 - 2125 - - 0 + 02:15:48 0 26 49 - 71 0 0 0 0 0 - 2171 - - 0 + 02:15:49 0 29 50 - 81 0 0 0 0 0 - 2437 - - 0 + 02:15:50 0 27 50 - 71 0 0 0 0 0 - 2171 - - 0 + 02:15:51 0 26 50 - 73 0 0 0 0 0 - 2223 - - 0 + 02:15:52 0 26 50 - 70 0 0 0 0 0 - 2164 - - 0 + 02:15:53 0 26 50 - 72 0 0 0 0 0 - 2203 - - 0 + 02:15:54 0 26 50 - 71 0 0 0 0 0 - 2210 - - 0 + 02:15:55 0 26 50 - 72 0 0 0 0 0 - 2164 - - 0 + 02:15:56 0 26 50 - 70 0 0 0 0 0 - 2145 - - 0 + 02:15:57 0 27 50 - 69 0 0 0 0 0 - 2236 - - 0 + 02:15:58 0 26 51 - 73 0 0 0 0 0 - 2203 - - 0 + 02:15:59 0 29 51 - 82 0 0 0 0 0 - 2431 - - 0 + 02:16:00 0 6 47 - 4 0 0 0 0 0 - 598 - - 0 diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-speed.end b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.end new file mode 100644 index 00000000..aa63b5c6 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.end @@ -0,0 +1,3 @@ +end 2026-10-31T07:16:03Z +min MemAvailable_kB during run 76526372 + 02:16:03 up 2 days, 7:09, 5 users, load average: 5.66, 8.21, 9.93 diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-speed.err b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.err new file mode 100644 index 00000000..e8352ad8 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.err @@ -0,0 +1,11 @@ + [5s] model.layers.4.mlp.experts.down + [11s] model.layers.9.mlp.experts.down + [17s] model.layers.14.mlp.experts.down + [22s] model.layers.19.mlp.experts.down + [26s] model.layers.24.mlp.experts.down + [28s] model.layers.29.mlp.experts.down + [30s] model.layers.34.mlp.experts.down + [31s] model.layers.39.mlp.experts.down + [33s] model.layers.44.mlp.experts.down + [34s] lm_head + [35s] kv fused cache 768 MB resident=true diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-speed.raw b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.raw new file mode 100644 index 00000000..40a8ca42 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.raw @@ -0,0 +1,44 @@ +mem available before load: 105.3 GB +engine native=true window_api=true fp8_api=true dattn_api=true weights=Fp8All attn=Fused spin_us=Some(2000) cta_budget=Some(1024) +prefill path gemm routing host (gemm_api=true) +attention path fused prefill_chunk 64 batched_prefill_possible true +router path device lm_head path gemv (router_api=true bf16_api=true) +decode graph OFF (dgraph_api=true, OWN30B_DECODE_GRAPH=1 to turn on) mutant none +whole-prompt prefill OFF device router/combine OFF +LOAD: 34.6s resident 30.53 GB host 0.67 GB peak_rss 31.94 GB (before 0.13 GB) kv_resident=true mem_available_after 75.9 GB +LOAD peak over resident+host: 0.74 GB (budget 6 GB) -> PASS +PARITY layer 0 over 20 positions (p2-short): attention cosine(min) 0.999999 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 8.79e-7 router x' rel(max) 1.54e-7 -> PASS +PARITY layer 23 over 20 positions (p2-short): attention cosine(min) 0.999957 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 9.69e-7 router x' rel(max) 2.05e-7 -> PASS +PARITY layer 47 over 20 positions (p2-short): attention cosine(min) 0.999997 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 7.30e-7 router x' rel(max) 2.15e-7 -> PASS +CONTROL routing-mutant: layer 0 moe cosine(min) 0.3692 -> CAUGHT +CONTROL fp8-scales-dropped: layer 0 moe cosine(min) 0.8582 -> CAUGHT +CONTROL attention-mutant-1: layer 0 attention cosine(min) 0.8221 over 20 positions -> CAUGHT +CONTROL router-mutant-1: layer 0 moe cosine(min) 0.7682 routing_agrees=false routing weights err(max) 6.70e-1 router x' rel(max) 2.76e1 over 4 positions -> CAUGHT +CONTROL router-mutant-2: layer 0 moe cosine(min) 0.5346 routing_agrees=false routing weights err(max) 2.20e-1 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +CONTROL router-mutant-3: layer 0 moe cosine(min) -0.1282 routing_agrees=true routing weights err(max) 6.26e-7 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +CONTROL router-mutant-4: layer 0 moe cosine(min) 1.0000 routing_agrees=true routing weights err(max) 7.73e-1 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +PREFILL chunk 1 (p3-medium, 204 tokens): 4.29s = 21.0 ms/token; per token: attention 8.8 ms experts 12.2 ms (routing 0.00 ms, sort+swiglu+combine 0.00 ms) host 0.6 ms chip-reported 18.6 ms launches 288.0; first tokens [12, 576, 50275, 55, 26467, 5711, 279, 18865] +PREFILL chunk 64 (p3-medium, 204 tokens): 2.91s = 14.3 ms/token; per token: attention 6.1 ms experts 8.0 ms (routing 1.10 ms, sort+swiglu+combine 0.62 ms) host 0.1 ms chip-reported 10.7 ms launches 51.8; first tokens [12, 576, 50275, 55, 26467, 5711, 279, 18865] +PREFILL chunk 64 vs 1: tokens IDENTICAL ; first-step logits cosine 0.9999987 max abs diff 5.32e-2 ; 21.0 -> 14.3 ms/token -> PASS +CONTROL gemm-mutant-1: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.1695 max abs diff 3.09e1 tokens [80238] vs clean [220] -> CAUGHT +CONTROL gemm-mutant-2: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.9568 max abs diff 8.19e0 tokens [3175] vs clean [220] -> CAUGHT +CONTROL gemm-mutant-3: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.9194 max abs diff 1.16e1 tokens [279] vs clean [220] -> CAUGHT +CONTROL gemm-mutants-off: the clean prefill after the mutants is bit-identical to before -> PASS +TOKENS p1-one-token: 1 prompt tokens, prefill 0.02s (20.0 ms/token; chunk 64, per token attention 8.0 ms experts 12.1 ms host 0.6 ms launches 288.0), decode 16 tokens in 358 ms = 22.4 ms/token = 44.7 tok/s; per step: attention 7.7 ms experts 11.5 ms lm_head 3.0 ms host 0.6 ms chip-reported 20.0 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: " and welcome to the 2024-25 season of the National" + cpu text: " and welcome to the 2024-25 season of the National" +TOKENS p2-short: 20 prompt tokens, prefill 0.33s (16.6 ms/token; chunk 64, per token attention 6.0 ms experts 10.5 ms host 0.1 ms launches 57.6), decode 7 tokens in 166 ms = 23.7 ms/token = 42.2 tok/s; per step: attention 8.1 ms experts 12.0 ms lm_head 3.4 ms host 0.6 ms chip-reported 21.2 ms launches 289.14285714285717; IDENTICAL + DECODE GRAPH OFF: 0 of 7 decode steps as one list (the first step is the prefill's lm_head); per step launches 289.1 submits 289.1; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "The capital of France is Paris." + cpu text: "The capital of France is Paris.<|im_end|>" +TOKENS p3-medium: 204 prompt tokens, prefill 2.85s (14.0 ms/token; chunk 64, per token attention 6.1 ms experts 7.7 ms host 0.1 ms launches 51.1), decode 16 tokens in 368 ms = 23.0 ms/token = 43.5 tok/s; per step: attention 8.5 ms experts 11.2 ms lm_head 2.9 ms host 0.6 ms chip-reported 20.6 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "- The DGX Spark uses the GB10 Grace Blackwell superchip," + cpu text: "- The DGX Spark uses the GB10 Grace Blackwell superchip," +TOKENS p4-long: 657 prompt tokens, prefill 9.67s (14.7 ms/token; chunk 64, per token attention 6.7 ms experts 7.9 ms host 0.1 ms launches 51.0), decode 16 tokens in 379 ms = 23.7 ms/token = 42.2 tok/s; per step: attention 9.1 ms experts 11.4 ms lm_head 2.9 ms host 0.6 ms chip-reported 21.3 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "What went wrong: \nIn **run 10**, the model's output" + cpu text: "What went wrong: \nIn **run 10**, the model's output" +SUMMARY parity=PASS tokens=PASS peak_rss=33.41 GB +receipt: /tmp/corechip/w557/docs/inference/evidence/adr0004-step3-20261031/g30-speed diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-speed.rc b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.rc new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.rc @@ -0,0 +1 @@ +0 diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-speed.start b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.start new file mode 100644 index 00000000..425899ba --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-speed.start @@ -0,0 +1,15 @@ +start 2026-10-31T07:14:06Z +sc commit 9e6ceefdcbae4b649c61605c134dd253d757ae0c worktree /tmp/corechip/w557 +binary /tmp/corechip/t557/release/own30b_check sha256 99594b5d6bef2bf33389d9f557709da4807bd53ec39eca113cc9e6dfd8e2517c +omega /tmp/corechip/omega636 a647b6a9821fffcf52ba9ce813f75afa4b84be62 +admission model /home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8 bytes 31175618584 need_kB 81861400 MemAvailable_kB 111008600 +window flags --gb10 none --quiet exclusive lease 20; chip lock: flock -x /tmp/aien-gb10.lock around the command +cmd env AIEN_OMEGA_SPIN_US=2000 /tmp/corechip/t557/release/own30b_check chip /home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8 /tmp/corechip/w557/docs/inference/evidence/own30b-f-20261013T1745Z/golden.json /tmp/corechip/w557/docs/inference/evidence/adr0004-step3-20261031/g30-speed --prompts 1,2,3,4 --new 16 --layers 0,23,47 --weights fp8 --attn fused --router device --lm-head gemv --prefill auto --force-memory +pid, process_name, used_gpu_memory [MiB] +name, driver_version, utilization.gpu [%], temperature.gpu, power.draw [W], pstate, clocks.current.sm [MHz], clocks.current.memory [MHz] +NVIDIA GB10, 580.173.02, 0 %, 48, 6.08 W, P8, 208 MHz, [N/A] +listeners: 100.64.0.2:18110 100.64.0.2:18112 100.64.0.2:18132 127.0.0.1:18080 127.0.0.1:18092 127.0.0.1:18095 127.0.0.1:18096 127.0.0.1:18171 + 02:14:06 up 2 days, 7:07, 5 users, load average: 6.57, 9.92, 10.66 +7.0.0-1019-nvidia +window 20261031T071440Z-97707a +lock acquired 2026-10-31T07:14:42Z diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-speed/run.json b/docs/inference/evidence/adr0004-step3-20261031/g30-speed/run.json new file mode 100644 index 00000000..6a2bf9b0 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-speed/run.json @@ -0,0 +1,384 @@ +{ + "checkpoint": "/home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8", + "controls": [ + { + "caught": true, + "control": "routing-mutant", + "moe_cosine_min": 0.3692025137900707 + }, + { + "caught": true, + "control": "fp8-scales-dropped", + "moe_cosine_min": 0.8582220221305831 + }, + { + "attn_cosine_min": 0.8221134324507205, + "caught": true, + "control": "attention-mutant-1" + }, + { + "caught": true, + "control": "router-mutant-1", + "moe_cosine_min": 0.7682029976699462, + "router_xprime_rel_max": 27.602657318115234, + "routing_agrees": false, + "routing_weight_err_max": 0.66987144947052 + }, + { + "caught": true, + "control": "router-mutant-2", + "moe_cosine_min": 0.5345981367501033, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": false, + "routing_weight_err_max": 0.21989747881889343 + }, + { + "caught": true, + "control": "router-mutant-3", + "moe_cosine_min": -0.1282351225769249, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": true, + "routing_weight_err_max": 6.258487701416016e-7 + }, + { + "caught": true, + "control": "router-mutant-4", + "moe_cosine_min": 0.999999999999559, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": true, + "routing_weight_err_max": 0.7731469869613647 + }, + { + "caught": true, + "control": "gemm-mutant-1", + "logits_cosine": 0.1695149104933057, + "max_abs_diff": 30.896467208862305 + }, + { + "caught": true, + "control": "gemm-mutant-2", + "logits_cosine": 0.9568050213120963, + "max_abs_diff": 8.191482543945312 + }, + { + "caught": true, + "control": "gemm-mutant-3", + "logits_cosine": 0.9193720714189647, + "max_abs_diff": 11.63990592956543 + } + ], + "engine": { + "attention": "fused", + "bf16_api": true, + "cta_budget": 1024, + "dattn_api": true, + "fp8_api": true, + "kv_resident": true, + "lm_head": "gemv", + "max_context": 8192, + "native": true, + "prefill_chunk": 64, + "prefill_path": "gemm", + "prefill_routing": "host", + "router": "device", + "router_api": true, + "spin_us": 2000, + "weights": "Fp8All", + "window_api": true + }, + "golden": "/tmp/corechip/w557/docs/inference/evidence/own30b-f-20261013T1745Z/golden.json", + "load": { + "host_bytes": 673505280, + "peak_rss_before_bytes": 133685248, + "peak_rss_bytes": 31942410240, + "resident_bytes": 30526627840, + "seconds": 34.615228974, + "transient_gb": 0.7422771200000007 + }, + "long_prompt": null, + "parity": [ + { + "attn_cosine_min": 0.9999988846132656, + "layer": 0, + "moe_cosine_min": 0.9999999999980523, + "moe_p95_rel_max": 1.210719347000122e-6, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 1.5420889099004853e-7, + "routing_agrees": true, + "routing_weight_err_max": 8.791685104370117e-7 + }, + { + "attn_cosine_min": 0.9999568509533563, + "layer": 23, + "moe_cosine_min": 0.9999999999963317, + "moe_p95_rel_max": 5.8067962527275085e-6, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 2.0500769437603594e-7, + "routing_agrees": true, + "routing_weight_err_max": 9.685754776000977e-7 + }, + { + "attn_cosine_min": 0.9999974833824463, + "layer": 47, + "moe_cosine_min": 0.9999999999997126, + "moe_p95_rel_max": 0.00001903623342514038, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 2.1530942717618018e-7, + "routing_agrees": true, + "routing_weight_err_max": 7.301568984985352e-7 + } + ], + "pass": true, + "prefill": { + "chunk": 64, + "launches_per_token_chunk": 51.76470588235294, + "launches_per_token_chunk1": 288.0, + "logits_cosine": 0.9999987410879339, + "logits_max_abs_diff": 0.053193092346191406, + "prefill_ms_chunk": 2912, + "prefill_ms_chunk1": 4290, + "prompt": "p3-medium", + "prompt_tokens": 204, + "tokens_identical": true + }, + "prompts": [ + { + "chip": [ + 323, + 10565, + 311, + 279, + 220, + 17, + 15, + 17, + 19, + 12, + 17, + 20, + 3200, + 315, + 279, + 5055 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 358, + "emitted": 16, + "first_diff": null, + "golden": [ + 323, + 10565, + 311, + 279, + 220, + 17, + 15, + 17, + 19, + 12, + 17, + 20, + 3200, + 315, + 279, + 5055 + ], + "name": "p1-one-token", + "per_step_ms": { + "attention": 7.669495875, + "chip_reported": 19.9677443125, + "experts": 11.4692528125, + "host": 0.59723225, + "launches": 271.0, + "lm_head": 2.9521545 + }, + "prefill_ms": 20, + "prompt_tokens": 1, + "tok_s": 44.6927374301676 + }, + { + "chip": [ + 785, + 6722, + 315, + 9625, + 374, + 12095, + 13 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 2024, + "timeline": null + }, + "decode_ms": 166, + "emitted": 7, + "first_diff": null, + "golden": [ + 785, + 6722, + 315, + 9625, + 374, + 12095, + 13, + 151645 + ], + "name": "p2-short", + "per_step_ms": { + "attention": 8.110753857142857, + "chip_reported": 21.235389714285713, + "experts": 11.963864142857144, + "host": 0.6341024285714285, + "launches": 289.14285714285717, + "lm_head": 3.374211 + }, + "prefill_ms": 332, + "prompt_tokens": 20, + "tok_s": 42.16867469879518 + }, + { + "chip": [ + 12, + 576, + 50275, + 55, + 26467, + 5711, + 279, + 18865, + 16, + 15, + 31071, + 5235, + 9157, + 2256, + 29662, + 11 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 368, + "emitted": 16, + "first_diff": null, + "golden": [ + 12, + 576, + 50275, + 55, + 26467, + 5711, + 279, + 18865, + 16, + 15, + 31071, + 5235, + 9157, + 2256, + 29662, + 11 + ], + "name": "p3-medium", + "per_step_ms": { + "attention": 8.5477095625, + "chip_reported": 20.62935875, + "experts": 11.2292750625, + "host": 0.5942076875, + "launches": 271.0, + "lm_head": 2.9398013125 + }, + "prefill_ms": 2854, + "prompt_tokens": 204, + "tok_s": 43.47826086956522 + }, + { + "chip": [ + 3838, + 3937, + 4969, + 25, + 2303, + 641, + 3070, + 6108, + 220, + 16, + 15, + 97219, + 279, + 1614, + 594, + 2550 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 379, + "emitted": 16, + "first_diff": null, + "golden": [ + 3838, + 3937, + 4969, + 25, + 2303, + 641, + 3070, + 6108, + 220, + 16, + 15, + 97219, + 279, + 1614, + 594, + 2550 + ], + "name": "p4-long", + "per_step_ms": { + "attention": 9.1390351875, + "chip_reported": 21.3202934375, + "experts": 11.350050875, + "host": 0.5950374375, + "launches": 271.0, + "lm_head": 2.9339095625 + }, + "prefill_ms": 9672, + "prompt_tokens": 657, + "tok_s": 42.21635883905013 + } + ] +} \ No newline at end of file diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.dmon b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.dmon new file mode 100644 index 00000000..3b86041d --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.dmon @@ -0,0 +1,110 @@ +#Time gpu pwr gtemp mtemp sm mem enc dec jpg ofa mclk pclk fb bar1 ccpm +#HH:MM:SS Idx W C C % % % % % % MHz MHz MB MB MB + 02:12:20 0 5 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:21 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:22 0 6 51 - 1 0 0 0 0 0 - 208 - - 0 + 02:12:23 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:24 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:25 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:26 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:27 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:28 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:29 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:30 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:31 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:32 0 6 51 - 1 0 0 0 0 0 - 208 - - 0 + 02:12:33 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:34 0 6 51 - 1 0 0 0 0 0 - 208 - - 0 + 02:12:35 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:36 0 5 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:37 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:38 0 6 51 - 1 0 0 0 0 0 - 208 - - 0 + 02:12:39 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:40 0 6 51 - 1 0 0 0 0 0 - 208 - - 0 + 02:12:41 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:42 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:43 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:44 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:45 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:46 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:47 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:48 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:49 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:50 0 5 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:51 0 6 51 - 1 0 0 0 0 0 - 208 - - 0 + 02:12:52 0 5 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:53 0 6 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:54 0 5 51 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:55 0 6 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:56 0 6 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:57 0 6 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:12:58 0 6 50 - 1 0 0 0 0 0 - 208 - - 0 + 02:12:59 0 6 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:00 0 6 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:01 0 5 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:02 0 5 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:03 0 5 50 - 0 0 0 0 0 0 - 208 - - 0 +#Time gpu pwr gtemp mtemp sm mem enc dec jpg ofa mclk pclk fb bar1 ccpm +#HH:MM:SS Idx W C C % % % % % % MHz MHz MB MB MB + 02:13:04 0 5 50 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:05 0 5 49 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:06 0 5 49 - 1 0 0 0 0 0 - 208 - - 0 + 02:13:07 0 5 49 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:08 0 5 49 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:09 0 5 49 - 1 0 0 0 0 0 - 208 - - 0 + 02:13:10 0 5 48 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:11 0 5 48 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:12 0 5 48 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:13 0 5 48 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:14 0 5 48 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:15 0 5 48 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:16 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:17 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:18 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:19 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:20 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:21 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:22 0 13 47 - 0 0 0 0 0 0 - 591 - - 0 + 02:13:23 0 6 47 - 0 0 0 0 0 0 - 591 - - 0 + 02:13:24 0 6 47 - 0 0 0 0 0 0 - 286 - - 0 + 02:13:25 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:26 0 5 47 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:27 0 5 46 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:28 0 5 46 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:29 0 5 46 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:30 0 5 46 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:31 0 5 46 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:32 0 5 46 - 0 0 0 0 0 0 - 208 - - 0 + 02:13:33 0 10 46 - 0 0 0 0 0 0 - 1677 - - 0 + 02:13:34 0 23 48 - 50 0 0 0 0 0 - 1696 - - 0 + 02:13:35 0 33 51 - 79 0 0 0 0 0 - 2548 - - 0 + 02:13:36 0 33 51 - 80 0 0 0 0 0 - 2548 - - 0 + 02:13:37 0 33 51 - 80 0 0 0 0 0 - 2548 - - 0 + 02:13:38 0 33 52 - 80 0 0 0 0 0 - 2548 - - 0 + 02:13:39 0 29 50 - 73 0 0 0 0 0 - 2197 - - 0 + 02:13:40 0 26 50 - 67 0 0 0 0 0 - 2086 - - 0 + 02:13:41 0 26 51 - 71 0 0 0 0 0 - 2190 - - 0 + 02:13:42 0 28 51 - 81 0 0 0 0 0 - 2145 - - 0 + 02:13:43 0 27 51 - 68 0 0 0 0 0 - 2268 - - 0 + 02:13:44 0 29 51 - 70 0 0 0 0 0 - 2398 - - 0 + 02:13:45 0 27 51 - 69 0 0 0 0 0 - 2171 - - 0 + 02:13:46 0 27 52 - 68 0 0 0 0 0 - 2216 - - 0 + 02:13:47 0 28 51 - 68 0 0 0 0 0 - 2197 - - 0 +#Time gpu pwr gtemp mtemp sm mem enc dec jpg ofa mclk pclk fb bar1 ccpm +#HH:MM:SS Idx W C C % % % % % % MHz MHz MB MB MB + 02:13:48 0 29 52 - 68 0 0 0 0 0 - 2437 - - 0 + 02:13:49 0 28 51 - 69 0 0 0 0 0 - 2177 - - 0 + 02:13:50 0 27 51 - 71 0 0 0 0 0 - 2119 - - 0 + 02:13:51 0 27 52 - 70 0 0 0 0 0 - 2151 - - 0 + 02:13:52 0 29 52 - 82 0 0 0 0 0 - 2158 - - 0 + 02:13:53 0 27 51 - 68 0 0 0 0 0 - 2125 - - 0 + 02:13:54 0 26 52 - 69 0 0 0 0 0 - 2145 - - 0 + 02:13:55 0 26 52 - 72 0 0 0 0 0 - 2158 - - 0 + 02:13:56 0 26 51 - 74 0 0 0 0 0 - 2164 - - 0 + 02:13:57 0 27 51 - 70 0 0 0 0 0 - 2236 - - 0 + 02:13:58 0 26 52 - 72 0 0 0 0 0 - 2158 - - 0 + 02:13:59 0 27 52 - 69 0 0 0 0 0 - 2216 - - 0 + 02:14:00 0 26 51 - 72 0 0 0 0 0 - 2184 - - 0 + 02:14:01 0 28 52 - 73 0 0 0 0 0 - 2249 - - 0 + 02:14:02 0 21 49 - 82 0 0 0 0 0 - 630 - - 0 + 02:14:03 0 6 48 - 6 0 0 0 0 0 - 591 - - 0 diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.end b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.end new file mode 100644 index 00000000..4d77fe1a --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.end @@ -0,0 +1,3 @@ +end 2026-10-31T07:14:06Z +min MemAvailable_kB during run 56801388 + 02:14:06 up 2 days, 7:07, 5 users, load average: 6.57, 9.92, 10.66 diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.err b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.err new file mode 100644 index 00000000..0c0a718e --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.err @@ -0,0 +1,11 @@ + [6s] model.layers.4.mlp.experts.down + [12s] model.layers.9.mlp.experts.down + [18s] model.layers.14.mlp.experts.down + [24s] model.layers.19.mlp.experts.down + [30s] model.layers.24.mlp.experts.down + [36s] model.layers.29.mlp.experts.down + [41s] model.layers.34.mlp.experts.down + [48s] model.layers.39.mlp.experts.down + [54s] model.layers.44.mlp.experts.down + [59s] lm_head + [61s] kv fused cache 768 MB resident=true diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.raw b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.raw new file mode 100644 index 00000000..b8115d83 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.raw @@ -0,0 +1,44 @@ +mem available before load: 88.9 GB +engine native=true window_api=true fp8_api=true dattn_api=true weights=Fp8All attn=Fused spin_us=Some(2000) cta_budget=Some(1024) +prefill path gemm routing host (gemm_api=true) +attention path fused prefill_chunk 64 batched_prefill_possible true +router path device lm_head path gemv (router_api=true bf16_api=true) +decode graph OFF (dgraph_api=true, OWN30B_DECODE_GRAPH=1 to turn on) mutant none +whole-prompt prefill OFF device router/combine OFF +LOAD: 60.4s resident 30.53 GB host 0.67 GB peak_rss 31.94 GB (before 0.13 GB) kv_resident=true mem_available_after 60.0 GB +LOAD peak over resident+host: 0.74 GB (budget 6 GB) -> PASS +PARITY layer 0 over 20 positions (p2-short): attention cosine(min) 0.999999 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 8.79e-7 router x' rel(max) 1.54e-7 -> PASS +PARITY layer 23 over 20 positions (p2-short): attention cosine(min) 0.999957 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 9.69e-7 router x' rel(max) 2.05e-7 -> PASS +PARITY layer 47 over 20 positions (p2-short): attention cosine(min) 0.999997 moe cosine(min) 1.000000 moe p95_rel(max) 0.0000 routing_agrees=true routing weights err(max) 7.30e-7 router x' rel(max) 2.15e-7 -> PASS +CONTROL routing-mutant: layer 0 moe cosine(min) 0.3692 -> CAUGHT +CONTROL fp8-scales-dropped: layer 0 moe cosine(min) 0.8582 -> CAUGHT +CONTROL attention-mutant-1: layer 0 attention cosine(min) 0.8221 over 20 positions -> CAUGHT +CONTROL router-mutant-1: layer 0 moe cosine(min) 0.7682 routing_agrees=false routing weights err(max) 6.70e-1 router x' rel(max) 2.76e1 over 4 positions -> CAUGHT +CONTROL router-mutant-2: layer 0 moe cosine(min) 0.5346 routing_agrees=false routing weights err(max) 2.20e-1 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +CONTROL router-mutant-3: layer 0 moe cosine(min) -0.1282 routing_agrees=true routing weights err(max) 6.26e-7 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +CONTROL router-mutant-4: layer 0 moe cosine(min) 1.0000 routing_agrees=true routing weights err(max) 7.73e-1 router x' rel(max) 1.09e-7 over 4 positions -> CAUGHT +PREFILL chunk 1 (p3-medium, 204 tokens): 4.26s = 20.9 ms/token; per token: attention 8.6 ms experts 12.1 ms (routing 0.00 ms, sort+swiglu+combine 0.00 ms) host 0.6 ms chip-reported 18.5 ms launches 288.0; first tokens [12, 576, 50275, 55, 26467, 5711, 279, 18865] +PREFILL chunk 64 (p3-medium, 204 tokens): 2.93s = 14.3 ms/token; per token: attention 6.1 ms experts 8.1 ms (routing 1.26 ms, sort+swiglu+combine 0.67 ms) host 0.1 ms chip-reported 10.6 ms launches 51.8; first tokens [12, 576, 50275, 55, 26467, 5711, 279, 18865] +PREFILL chunk 64 vs 1: tokens IDENTICAL ; first-step logits cosine 0.9999987 max abs diff 5.32e-2 ; 20.9 -> 14.3 ms/token -> PASS +CONTROL gemm-mutant-1: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.1695 max abs diff 3.09e1 tokens [80238] vs clean [220] -> CAUGHT +CONTROL gemm-mutant-2: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.9568 max abs diff 8.19e0 tokens [3175] vs clean [220] -> CAUGHT +CONTROL gemm-mutant-3: prefill of 80 tokens (p3-medium, chunk 64) first-step logits cosine 0.9194 max abs diff 1.16e1 tokens [279] vs clean [220] -> CAUGHT +CONTROL gemm-mutants-off: the clean prefill after the mutants is bit-identical to before -> PASS +TOKENS p1-one-token: 1 prompt tokens, prefill 0.02s (20.0 ms/token; chunk 64, per token attention 7.9 ms experts 12.0 ms host 0.6 ms launches 288.0), decode 16 tokens in 353 ms = 22.1 ms/token = 45.3 tok/s; per step: attention 7.6 ms experts 11.4 ms lm_head 2.9 ms host 0.6 ms chip-reported 19.8 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: " and welcome to the 2024-25 season of the National" + cpu text: " and welcome to the 2024-25 season of the National" +TOKENS p2-short: 20 prompt tokens, prefill 0.33s (16.7 ms/token; chunk 64, per token attention 6.1 ms experts 10.5 ms host 0.1 ms launches 57.6), decode 7 tokens in 165 ms = 23.6 ms/token = 42.4 tok/s; per step: attention 8.0 ms experts 11.9 ms lm_head 3.3 ms host 0.6 ms chip-reported 21.1 ms launches 289.14285714285717; IDENTICAL + DECODE GRAPH OFF: 0 of 7 decode steps as one list (the first step is the prefill's lm_head); per step launches 289.1 submits 289.1; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "The capital of France is Paris." + cpu text: "The capital of France is Paris.<|im_end|>" +TOKENS p3-medium: 204 prompt tokens, prefill 2.83s (13.9 ms/token; chunk 64, per token attention 5.9 ms experts 7.9 ms host 0.1 ms launches 51.1), decode 16 tokens in 367 ms = 22.9 ms/token = 43.6 tok/s; per step: attention 8.5 ms experts 11.3 ms lm_head 2.9 ms host 0.6 ms chip-reported 20.6 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "- The DGX Spark uses the GB10 Grace Blackwell superchip," + cpu text: "- The DGX Spark uses the GB10 Grace Blackwell superchip," +TOKENS p4-long: 657 prompt tokens, prefill 9.70s (14.8 ms/token; chunk 64, per token attention 6.6 ms experts 8.0 ms host 0.1 ms launches 51.0), decode 16 tokens in 374 ms = 23.4 ms/token = 42.8 tok/s; per step: attention 9.0 ms experts 11.3 ms lm_head 2.9 ms host 0.6 ms chip-reported 21.1 ms launches 271; IDENTICAL + DECODE GRAPH OFF: 0 of 16 decode steps as one list (the first step is the prefill's lm_head); per step launches 271.0 submits 271.0; per graph token launches 0.0 submits 0.0 record 0.0 us + chip text: "What went wrong: \nIn **run 10**, the model's output" + cpu text: "What went wrong: \nIn **run 10**, the model's output" +SUMMARY parity=PASS tokens=PASS peak_rss=33.41 GB +receipt: /tmp/corechip/w557/docs/inference/evidence/adr0004-step3-20261031/g30-tokens diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.rc b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.rc new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.rc @@ -0,0 +1 @@ +0 diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.start b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.start new file mode 100644 index 00000000..296355db --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens.start @@ -0,0 +1,15 @@ +start 2026-10-31T07:07:39Z +sc commit 9e6ceefdcbae4b649c61605c134dd253d757ae0c worktree /tmp/corechip/w557 +binary /tmp/corechip/t557/release/own30b_check sha256 99594b5d6bef2bf33389d9f557709da4807bd53ec39eca113cc9e6dfd8e2517c +omega /tmp/corechip/omega636 a647b6a9821fffcf52ba9ce813f75afa4b84be62 +admission model /home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8 bytes 31175618584 need_kB 81861400 MemAvailable_kB 93095724 +window flags --gb10 shared --quiet none lease 30; chip lock: flock -s /tmp/aien-gb10.lock around the command +cmd env AIEN_OMEGA_SPIN_US=2000 /tmp/corechip/t557/release/own30b_check chip /home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8 /tmp/corechip/w557/docs/inference/evidence/own30b-f-20261013T1745Z/golden.json /tmp/corechip/w557/docs/inference/evidence/adr0004-step3-20261031/g30-tokens --prompts 1,2,3,4 --new 16 --layers 0,23,47 --weights fp8 --attn fused --router device --lm-head gemv --prefill auto --force-memory +pid, process_name, used_gpu_memory [MiB] +name, driver_version, utilization.gpu [%], temperature.gpu, power.draw [W], pstate, clocks.current.sm [MHz], clocks.current.memory [MHz] +NVIDIA GB10, 580.173.02, 0 %, 53, 6.34 W, P8, 208 MHz, [N/A] +listeners: 100.64.0.2:18110 100.64.0.2:18112 100.64.0.2:18132 127.0.0.1:18080 127.0.0.1:18092 127.0.0.1:18095 127.0.0.1:18096 127.0.0.1:18171 + 02:07:40 up 2 days, 7:01, 5 users, load average: 13.39, 9.53, 10.55 +7.0.0-1019-nvidia +window 20261031T071217Z-ea2cba +lock acquired 2026-10-31T07:12:20Z diff --git a/docs/inference/evidence/adr0004-step3-20261031/g30-tokens/run.json b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens/run.json new file mode 100644 index 00000000..0052dba4 --- /dev/null +++ b/docs/inference/evidence/adr0004-step3-20261031/g30-tokens/run.json @@ -0,0 +1,384 @@ +{ + "checkpoint": "/home/drakestapleton/models/qwen3-30b-a3b-instruct-2507-fp8", + "controls": [ + { + "caught": true, + "control": "routing-mutant", + "moe_cosine_min": 0.3692025137900707 + }, + { + "caught": true, + "control": "fp8-scales-dropped", + "moe_cosine_min": 0.8582220221305831 + }, + { + "attn_cosine_min": 0.8221134324507205, + "caught": true, + "control": "attention-mutant-1" + }, + { + "caught": true, + "control": "router-mutant-1", + "moe_cosine_min": 0.7682029976699462, + "router_xprime_rel_max": 27.602657318115234, + "routing_agrees": false, + "routing_weight_err_max": 0.66987144947052 + }, + { + "caught": true, + "control": "router-mutant-2", + "moe_cosine_min": 0.5345981367501033, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": false, + "routing_weight_err_max": 0.21989747881889343 + }, + { + "caught": true, + "control": "router-mutant-3", + "moe_cosine_min": -0.1282351225769249, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": true, + "routing_weight_err_max": 6.258487701416016e-7 + }, + { + "caught": true, + "control": "router-mutant-4", + "moe_cosine_min": 0.999999999999559, + "router_xprime_rel_max": 1.0930641280992859e-7, + "routing_agrees": true, + "routing_weight_err_max": 0.7731469869613647 + }, + { + "caught": true, + "control": "gemm-mutant-1", + "logits_cosine": 0.1695149104933057, + "max_abs_diff": 30.896467208862305 + }, + { + "caught": true, + "control": "gemm-mutant-2", + "logits_cosine": 0.9568050213120963, + "max_abs_diff": 8.191482543945312 + }, + { + "caught": true, + "control": "gemm-mutant-3", + "logits_cosine": 0.9193720714189647, + "max_abs_diff": 11.63990592956543 + } + ], + "engine": { + "attention": "fused", + "bf16_api": true, + "cta_budget": 1024, + "dattn_api": true, + "fp8_api": true, + "kv_resident": true, + "lm_head": "gemv", + "max_context": 8192, + "native": true, + "prefill_chunk": 64, + "prefill_path": "gemm", + "prefill_routing": "host", + "router": "device", + "router_api": true, + "spin_us": 2000, + "weights": "Fp8All", + "window_api": true + }, + "golden": "/tmp/corechip/w557/docs/inference/evidence/own30b-f-20261013T1745Z/golden.json", + "load": { + "host_bytes": 673505280, + "peak_rss_before_bytes": 133689344, + "peak_rss_bytes": 31942434816, + "resident_bytes": 30526627840, + "seconds": 60.361253199, + "transient_gb": 0.7423016959999984 + }, + "long_prompt": null, + "parity": [ + { + "attn_cosine_min": 0.9999988846132656, + "layer": 0, + "moe_cosine_min": 0.9999999999980523, + "moe_p95_rel_max": 1.210719347000122e-6, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 1.5420889099004853e-7, + "routing_agrees": true, + "routing_weight_err_max": 8.791685104370117e-7 + }, + { + "attn_cosine_min": 0.9999568509533563, + "layer": 23, + "moe_cosine_min": 0.9999999999963317, + "moe_p95_rel_max": 5.8067962527275085e-6, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 2.0500769437603594e-7, + "routing_agrees": true, + "routing_weight_err_max": 9.685754776000977e-7 + }, + { + "attn_cosine_min": 0.9999974833824463, + "layer": 47, + "moe_cosine_min": 0.9999999999997126, + "moe_p95_rel_max": 0.00001903623342514038, + "pass": true, + "positions": 20, + "router_xprime_rel_max": 2.1530942717618018e-7, + "routing_agrees": true, + "routing_weight_err_max": 7.301568984985352e-7 + } + ], + "pass": true, + "prefill": { + "chunk": 64, + "launches_per_token_chunk": 51.76470588235294, + "launches_per_token_chunk1": 288.0, + "logits_cosine": 0.9999987410879339, + "logits_max_abs_diff": 0.053193092346191406, + "prefill_ms_chunk": 2926, + "prefill_ms_chunk1": 4256, + "prompt": "p3-medium", + "prompt_tokens": 204, + "tokens_identical": true + }, + "prompts": [ + { + "chip": [ + 323, + 10565, + 311, + 279, + 220, + 17, + 15, + 17, + 19, + 12, + 17, + 20, + 3200, + 315, + 279, + 5055 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 353, + "emitted": 16, + "first_diff": null, + "golden": [ + 323, + 10565, + 311, + 279, + 220, + 17, + 15, + 17, + 19, + 12, + 17, + 20, + 3200, + 315, + 279, + 5055 + ], + "name": "p1-one-token", + "per_step_ms": { + "attention": 7.587877625, + "chip_reported": 19.765311375, + "experts": 11.36627325, + "host": 0.5926516875, + "launches": 271.0, + "lm_head": 2.8735548125 + }, + "prefill_ms": 20, + "prompt_tokens": 1, + "tok_s": 45.32577903682719 + }, + { + "chip": [ + 785, + 6722, + 315, + 9625, + 374, + 12095, + 13 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 2024, + "timeline": null + }, + "decode_ms": 165, + "emitted": 7, + "first_diff": null, + "golden": [ + 785, + 6722, + 315, + 9625, + 374, + 12095, + 13, + 151645 + ], + "name": "p2-short", + "per_step_ms": { + "attention": 8.019086571428572, + "chip_reported": 21.058408142857143, + "experts": 11.935296142857142, + "host": 0.6328182857142857, + "launches": 289.14285714285717, + "lm_head": 3.300201428571429 + }, + "prefill_ms": 334, + "prompt_tokens": 20, + "tok_s": 42.42424242424242 + }, + { + "chip": [ + 12, + 576, + 50275, + 55, + 26467, + 5711, + 279, + 18865, + 16, + 15, + 31071, + 5235, + 9157, + 2256, + 29662, + 11 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 367, + "emitted": 16, + "first_diff": null, + "golden": [ + 12, + 576, + 50275, + 55, + 26467, + 5711, + 279, + 18865, + 16, + 15, + 31071, + 5235, + 9157, + 2256, + 29662, + 11 + ], + "name": "p3-medium", + "per_step_ms": { + "attention": 8.540546, + "chip_reported": 20.6109126875, + "experts": 11.268448, + "host": 0.5935046875, + "launches": 271.0, + "lm_head": 2.861042625 + }, + "prefill_ms": 2835, + "prompt_tokens": 204, + "tok_s": 43.596730245231605 + }, + { + "chip": [ + 3838, + 3937, + 4969, + 25, + 2303, + 641, + 3070, + 6108, + 220, + 16, + 15, + 97219, + 279, + 1614, + 594, + 2550 + ], + "decode_graph": { + "graph_launches": 0, + "graph_record_ns": 0, + "graph_submits": 0, + "graph_tokens": 0, + "mutant": "none", + "on": false, + "submits": 4336, + "timeline": null + }, + "decode_ms": 374, + "emitted": 16, + "first_diff": null, + "golden": [ + 3838, + 3937, + 4969, + 25, + 2303, + 641, + 3070, + 6108, + 220, + 16, + 15, + 97219, + 279, + 1614, + 594, + 2550 + ], + "name": "p4-long", + "per_step_ms": { + "attention": 8.9510455, + "chip_reported": 21.07087825, + "experts": 11.285418, + "host": 0.5936794375, + "launches": 271.0, + "lm_head": 2.8921263125 + }, + "prefill_ms": 9698, + "prompt_tokens": 657, + "tok_s": 42.780748663101605 + } + ] +} \ No newline at end of file ```