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/0827af73a5eb225a # 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#894 (code only) closed derived `0827af73a5eb225a` #894 Imported from GitHub aien-dev/aien-sovereign-core-mv#894 (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 `4b17ca34380d41d6155c0eab92313d362b716f00` · Head `feb1608c13aab64b325a7dcb70f502de45b692fc` ### Fetch it A git bundle of the pull request's head, 811395 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/0827af73a5eb225a.bundle -o 0827af73a5eb225a.bundle git fetch 0827af73a5eb225a.bundle refs/pull/894/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 894 feb1608c13aab64b325a7dcb70f502de45b692fc ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":894,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/894","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:13Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/Cargo.lock b/Cargo.lock index 8730a1cb..1dabb2bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -199,6 +199,7 @@ version = "0.1.0" dependencies = [ "aien-abi-core", "aien-expert-store", + "aien-heartbeat", "aien-kv-cache", "aien-omega-bf16", "aien-omega-dattn", diff --git a/crates/aien-cli/src/checkpoint.rs b/crates/aien-cli/src/checkpoint.rs index e8fd57c0..94cb75fc 100644 --- a/crates/aien-cli/src/checkpoint.rs +++ b/crates/aien-cli/src/checkpoint.rs @@ -486,7 +486,7 @@ fn snapshot_entries(dirfd: libc::c_int) -> std::io::Result> { continue; } let st = unsafe { st.assume_init() }; - if st.st_mode as u32 & libc::S_IFMT != libc::S_IFREG { + if st.st_mode & libc::S_IFMT != libc::S_IFREG { continue; } let size = if st.st_size < 0 { 0 } else { st.st_size as u64 }; @@ -652,10 +652,7 @@ impl Session { /// descriptor (`after_write_with_bytes`). #[allow(dead_code)] pub fn after_write(&mut self, pending: Pending, tool: &str) -> Result<(), String> { - let after_bytes = match fs::read(&pending.path) { - Ok(bytes) => Some(bytes), - Err(_) => None, - }; + let after_bytes = fs::read(&pending.path).ok(); self.after_write_with_bytes(pending, tool, after_bytes) } diff --git a/crates/aien-cli/src/fs_bind_linux.rs b/crates/aien-cli/src/fs_bind_linux.rs index 87f66fe7..75d44c7e 100644 --- a/crates/aien-cli/src/fs_bind_linux.rs +++ b/crates/aien-cli/src/fs_bind_linux.rs @@ -196,7 +196,7 @@ fn name_is_symlink(dirfd: libc::c_int, name: &OsStr) -> bool { return false; } let st = unsafe { st.assume_init() }; - st.st_mode as u32 & libc::S_IFMT == libc::S_IFLNK + st.st_mode & libc::S_IFMT == libc::S_IFLNK } /// True only when every component except the last opened, and the last is a @@ -288,8 +288,7 @@ fn open_beneath( let how = OpenHow { flags: (flags | libc::O_CLOEXEC) as u64, mode, - resolve: (libc::RESOLVE_BENEATH | libc::RESOLVE_NO_SYMLINKS | libc::RESOLVE_NO_MAGICLINKS) - as u64, + resolve: libc::RESOLVE_BENEATH | libc::RESOLVE_NO_SYMLINKS | libc::RESOLVE_NO_MAGICLINKS, }; // SAFETY: `c` is a valid C string, `how` matches the kernel `open_how` // layout, and a non-negative fd is owned by this function alone. @@ -733,7 +732,7 @@ fn list_dirfd(dirfd: libc::c_int) -> std::io::Result> { let len = if st.st_size < 0 { 0 } else { st.st_size as u64 }; out.push(DirEnt { name, - kind: kind_of(st.st_mode as u32), + kind: kind_of(st.st_mode), len, }); }; diff --git a/crates/aien-heartbeat/Cargo.toml b/crates/aien-heartbeat/Cargo.toml index afaf12ac..5c1a18ec 100644 --- a/crates/aien-heartbeat/Cargo.toml +++ b/crates/aien-heartbeat/Cargo.toml @@ -7,6 +7,10 @@ authors.workspace = true repository.workspace = true description = "Expert Heartbeat H1 (aienix#4): fixed-slot ring that streams MoE expert weights from NVMe into versioned memory slots, publish only after full read + digest" +[features] +# The policy is compiled Omega, attached through generated Omega Bridge declarations. +ribbon-omega = [] + [dependencies] blake3 = "1.8" libc = "0.2" @@ -16,3 +20,7 @@ serde_json = "1.0" [[bin]] name = "heartbeat_bench" path = "src/bin/heartbeat_bench.rs" + +[[bin]] +name = "ribbon_read_bench" +path = "src/bin/ribbon_read_bench.rs" diff --git a/crates/aien-heartbeat/src/bin/ribbon_read_bench.rs b/crates/aien-heartbeat/src/bin/ribbon_read_bench.rs new file mode 100644 index 00000000..0f1bf844 --- /dev/null +++ b/crates/aien-heartbeat/src/bin/ribbon_read_bench.rs @@ -0,0 +1,112 @@ +//! Expert Ribbon P1 (sc#629) read receipt: random verified expert reads through the bounded read adapter +//! from the real checkpoint on the NVMe. Read-only on the model; no GPU. +//! +//! ribbon_read_bench --model DIR [--manifest PATH] [--reads N] [--workers W] [--depth D] [--buffered] [--seed S] +//! +//! Each read = one whole expert (all six tensors, the two aligned segments), BLAKE3-verified before it counts. +//! Keeps `depth` reads in flight. Prints one JSON summary: payload GB/s, device GB/s, latency mean/p50/p95/max. +//! --buffered reads through the page cache: a warm cache makes it a memory copy, not an SSD figure. + +use std::collections::VecDeque; +use std::path::PathBuf; +use std::sync::Arc; +use std::time::{Duration, Instant}; + +use aien_heartbeat::{FileShards, Manifest, ReadAdapter, ReadConfig}; + +fn arg(args: &[String], name: &str, default: T) -> T { + args.iter() + .position(|a| a == name) + .and_then(|i| args.get(i + 1)) + .map(|v| v.parse().unwrap_or_else(|_| panic!("bad value for {name}"))) + .unwrap_or(default) +} + +fn main() { + let args: Vec = std::env::args().collect(); + let model: PathBuf = arg(&args, "--model", PathBuf::from(".")); + let manifest_path: PathBuf = arg( + &args, + "--manifest", + std::env::temp_dir().join("aien-ribbon-manifest.json"), + ); + let reads: usize = arg(&args, "--reads", 2000); + let workers: usize = arg(&args, "--workers", 8); + let depth: usize = arg(&args, "--depth", 16); + let seed: u64 = arg(&args, "--seed", 2026); + let direct = !args.iter().any(|a| a == "--buffered"); + + let m = match Manifest::load(&manifest_path) { + Ok(m) if m.model_dir == model => m, + _ => { + let t = Instant::now(); + let m = Manifest::build(&model).expect("manifest"); + m.save(&manifest_path).expect("save manifest"); + eprintln!( + "manifest built in {:.1} s ({} experts, model digest {})", + t.elapsed().as_secs_f64(), + m.experts.len(), + m.model_digest + ); + m + } + }; + let m = Arc::new(m); + let dev = Arc::new(FileShards::open(&m.shard_paths(), direct).expect("open shards")); + let r = ReadAdapter::new( + m.clone(), + dev, + ReadConfig { + workers, + queue_depth: depth, + }, + ); + + let mut s = seed; + let mut next = || { + s = s + .wrapping_mul(6364136223846793005) + .wrapping_add(1442695040888963407); + (s >> 33) as usize % m.experts.len() + }; + let mut lat: Vec = Vec::with_capacity(reads); + let mut inflight = VecDeque::new(); + let mut payload = 0u64; + let t0 = Instant::now(); + let mut submitted = 0usize; + while lat.len() < reads { + while submitted < reads && inflight.len() < depth { + let i = next(); + inflight.push_back((Instant::now(), r.submit(i).expect("submit"))); + submitted += 1; + } + let (ts, t) = inflight.pop_front().expect("in flight"); + let v = t.wait(Duration::from_secs(30)).expect("verified read"); + payload += v.payload().len() as u64; + lat.push(ts.elapsed().as_secs_f64() * 1e3); + } + let wall = t0.elapsed().as_secs_f64(); + let st = r.stats(); + lat.sort_by(|a, b| a.partial_cmp(b).unwrap()); + let pct = |p: f64| lat[((lat.len() as f64 * p) as usize).min(lat.len() - 1)]; + println!( + "{}", + serde_json::json!({ + "tool": "ribbon_read_bench", + "model_digest": m.model_digest, + "direct": direct, + "workers": workers, + "depth": depth, + "reads": reads, + "seed": seed, + "payload_bytes": payload, + "device_bytes": st.device_bytes, + "wall_s": wall, + "payload_GBps": payload as f64 / wall / 1e9, + "device_GBps": st.device_bytes as f64 / wall / 1e9, + "read_worker_s": st.read_ns as f64 / 1e9, + "digest_worker_s": st.digest_ns as f64 / 1e9, + "latency_ms": {"mean": lat.iter().sum::() / lat.len() as f64, "p50": pct(0.5), "p95": pct(0.95), "max": lat[lat.len() - 1]}, + }) + ); +} diff --git a/crates/aien-heartbeat/src/layout.rs b/crates/aien-heartbeat/src/layout.rs new file mode 100644 index 00000000..b78de54a --- /dev/null +++ b/crates/aien-heartbeat/src/layout.rs @@ -0,0 +1,205 @@ +//! Qwen3-MoE FP8 expert layout (Expert Ribbon P1, sc#629): which bytes of a verified expert payload are the +//! gate|up and down projections and their block-128 scales, checked against the model shape before any byte +//! is handed to a GPU slot. +//! +//! A payload is the expert's six tensors in file order (manifest [`crate::manifest::TensorRange`] offsets). +//! The chip wants, per expert, exactly what the resident loader uploads (`qwen3_moe_omega.rs`): +//! * gate|up weights `[2i][h]` e4m3 = `gate_proj.weight [i][h]` then `up_proj.weight [i][h]`, scales +//! `[2i/128][h/128]` bf16 = gate scales then up scales; +//! * down weights `[h][i]` e4m3, scales `[h/128][i/128]` bf16. +//! +//! Gate and up are adjacent in the checkpoint (safetensors orders tensors by name within a dtype), so the +//! gate|up weights are normally one borrowed slice; when they are not adjacent they are copied, never assumed. + +use std::borrow::Cow; + +use crate::error::HeartbeatError; +use crate::manifest::{ExpertEntry, TensorRange}; + +/// Quantisation format name recorded with every expert identity. +pub const FORMAT_FP8_BLOCK128: &str = "qwen3-fp8-e4m3/bf16-scale-inv/block128"; +pub const FP8_BLOCK: u64 = 128; + +/// Model dimensions the layout is checked against (config.json `hidden_size`, `moe_intermediate_size`). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ExpertShape { + pub hidden: u64, + pub inter: u64, +} + +impl ExpertShape { + pub fn gate_up_weight_bytes(&self) -> usize { + (2 * self.inter * self.hidden) as usize + } + pub fn down_weight_bytes(&self) -> usize { + (self.hidden * self.inter) as usize + } + pub fn gate_up_scales(&self) -> usize { + (2 * (self.inter / FP8_BLOCK) * (self.hidden / FP8_BLOCK)) as usize + } + pub fn down_scales(&self) -> usize { + ((self.hidden / FP8_BLOCK) * (self.inter / FP8_BLOCK)) as usize + } +} + +/// Payload ranges `(offset, len)` of the six tensors of one expert, validated. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ExpertLayout { + pub gate_w: (u64, u64), + pub up_w: (u64, u64), + pub down_w: (u64, u64), + pub gate_s: (u64, u64), + pub up_s: (u64, u64), + pub down_s: (u64, u64), +} + +fn find<'a>(e: &'a ExpertEntry, suffix: &str) -> Result<&'a TensorRange, HeartbeatError> { + let want = format!("model.layers.{}.mlp.experts.{}.{suffix}", e.layer, e.expert); + let mut hits = e.tensors.iter().filter(|t| t.name == want); + let t = hits.next().ok_or_else(|| { + HeartbeatError::Manifest(format!("expert ({},{}): missing {want}", e.layer, e.expert)) + })?; + if hits.next().is_some() { + return Err(HeartbeatError::Manifest(format!( + "expert ({},{}): duplicate {want}", + e.layer, e.expert + ))); + } + Ok(t) +} + +fn check( + t: &TensorRange, + dtype: &str, + shape: [u64; 2], + elem: u64, +) -> Result<(u64, u64), HeartbeatError> { + if t.dtype != dtype || t.shape != shape || t.len != shape[0] * shape[1] * elem { + return Err(HeartbeatError::Manifest(format!( + "{}: dtype {} shape {:?} len {} (want {dtype} {shape:?} len {})", + t.name, + t.dtype, + t.shape, + t.len, + shape[0] * shape[1] * elem + ))); + } + Ok((t.offset, t.len)) +} + +impl ExpertLayout { + /// Validates the six tensors of `e` (names, dtypes, shapes, lengths; no extra tensors) for `shape`. + pub fn for_entry(e: &ExpertEntry, shape: ExpertShape) -> Result { + let (h, i) = (shape.hidden, shape.inter); + if h % FP8_BLOCK != 0 || i % FP8_BLOCK != 0 { + return Err(HeartbeatError::Manifest(format!( + "shape {h}x{i} is not block-128" + ))); + } + if e.tensors.len() != 6 { + return Err(HeartbeatError::Manifest(format!( + "expert ({},{}): {} tensors, want 6", + e.layer, + e.expert, + e.tensors.len() + ))); + } + let (hb, ib) = (h / FP8_BLOCK, i / FP8_BLOCK); + let l = Self { + gate_w: check(find(e, "gate_proj.weight")?, "F8_E4M3", [i, h], 1)?, + up_w: check(find(e, "up_proj.weight")?, "F8_E4M3", [i, h], 1)?, + down_w: check(find(e, "down_proj.weight")?, "F8_E4M3", [h, i], 1)?, + gate_s: check(find(e, "gate_proj.weight_scale_inv")?, "BF16", [ib, hb], 2)?, + up_s: check(find(e, "up_proj.weight_scale_inv")?, "BF16", [ib, hb], 2)?, + down_s: check(find(e, "down_proj.weight_scale_inv")?, "BF16", [hb, ib], 2)?, + }; + let end = e.len; + for (o, n) in [l.gate_w, l.up_w, l.down_w, l.gate_s, l.up_s, l.down_s] { + if o + n > end { + return Err(HeartbeatError::Manifest(format!( + "expert ({},{}): tensor past payload end", + e.layer, e.expert + ))); + } + } + Ok(l) + } +} + +/// An expert payload as its segments in order (a ring lease, or a read adapter result). +pub struct Payload<'a> { + segs: Vec<&'a [u8]>, +} + +impl<'a> Payload<'a> { + pub fn new(segs: Vec<&'a [u8]>) -> Self { + Self { segs } + } + + pub fn len(&self) -> usize { + self.segs.iter().map(|s| s.len()).sum() + } + + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + + /// `len` bytes at payload offset `off`, borrowed when they lie in one segment. + pub fn bytes(&self, off: u64, len: u64) -> Result, HeartbeatError> { + let (off, len) = (off as usize, len as usize); + if off.checked_add(len).is_none_or(|end| end > self.len()) { + return Err(HeartbeatError::Manifest(format!( + "payload range {off}+{len} past the {}-byte payload", + self.len() + ))); + } + let mut base = 0usize; + for s in &self.segs { + if off >= base && off + len <= base + s.len() { + return Ok(Cow::Borrowed(&s[off - base..off - base + len])); + } + base += s.len(); + } + // Straddles a segment boundary (never for whole tensors, but correct anyway): copy. + let flat: Vec = self.segs.iter().flat_map(|s| s.iter().copied()).collect(); + Ok(Cow::Owned(flat[off..off + len].to_vec())) + } +} + +/// What a GPU slot pair is loaded from: gate|up and down weights (e4m3) and scales (bf16 bits). +#[derive(Debug)] +pub struct ExpertParts<'a> { + pub gate_up_w: Cow<'a, [u8]>, + pub gate_up_s: Vec, + pub down_w: Cow<'a, [u8]>, + pub down_s: Vec, +} + +fn bf16_words(b: &[u8]) -> Vec { + b.as_chunks::<2>() + .0 + .iter() + .map(|c| u16::from_le_bytes(*c)) + .collect() +} + +impl ExpertLayout { + /// Splits a verified payload into the chip layout. + pub fn parts<'a>(&self, p: &Payload<'a>) -> Result, HeartbeatError> { + let gate_up_w = if self.up_w.0 == self.gate_w.0 + self.gate_w.1 { + p.bytes(self.gate_w.0, self.gate_w.1 + self.up_w.1)? + } else { + let mut v = p.bytes(self.gate_w.0, self.gate_w.1)?.into_owned(); + v.extend_from_slice(&p.bytes(self.up_w.0, self.up_w.1)?); + Cow::Owned(v) + }; + let mut gate_up_s = bf16_words(&p.bytes(self.gate_s.0, self.gate_s.1)?); + gate_up_s.extend(bf16_words(&p.bytes(self.up_s.0, self.up_s.1)?)); + Ok(ExpertParts { + gate_up_w, + gate_up_s, + down_w: p.bytes(self.down_w.0, self.down_w.1)?, + down_s: bf16_words(&p.bytes(self.down_s.0, self.down_s.1)?), + }) + } +} diff --git a/crates/aien-heartbeat/src/lib.rs b/crates/aien-heartbeat/src/lib.rs index 0f1905a3..0cbb3046 100644 --- a/crates/aien-heartbeat/src/lib.rs +++ b/crates/aien-heartbeat/src/lib.rs @@ -12,12 +12,22 @@ pub mod aligned; pub mod error; +pub mod layout; pub mod manifest; +pub mod pager; +pub mod reader; +pub mod residency; pub mod ring; pub mod stream; pub use error::HeartbeatError; +pub use layout::{ExpertLayout, ExpertParts, ExpertShape, Payload}; pub use manifest::{ExpertEntry, Manifest}; +pub use pager::{ExpertPager, PagerError, PagerStats, Pinned, SlotBackend}; +pub use reader::{ + FakeShards, Fault, FileShards, ReadAdapter, ReadConfig, ReadError, ShardDevice, VerifiedExpert, +}; +pub use residency::{Acquire, ExpertId, MemoryBudget, Residency, ResidencyStats, SlotVersion}; pub use ring::{Lease, Ring, SlotTag}; pub use stream::{RotationStats, Schedule, StreamConfig, Streamer}; diff --git a/crates/aien-heartbeat/src/manifest.rs b/crates/aien-heartbeat/src/manifest.rs index 98eca08f..e80d1951 100644 --- a/crates/aien-heartbeat/src/manifest.rs +++ b/crates/aien-heartbeat/src/manifest.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; use crate::error::HeartbeatError; -pub const MANIFEST_SCHEMA: &str = "aien-heartbeat-manifest/1"; +pub const MANIFEST_SCHEMA: &str = "aien-heartbeat-manifest/2"; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct TensorRange { @@ -59,6 +59,10 @@ impl ExpertEntry { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Manifest { pub schema: String, + /// BLAKE3 over the index file, every expert shard's name and header bytes, and every expert's + /// `(layer, expert, digest)` in order: names the checkpoint by content, not by path. The per-expert + /// digests cover the weight bytes themselves, so this is not an index-only digest (sc#338). + pub model_digest: String, pub model_dir: PathBuf, pub shards: Vec, pub num_layers: u16, @@ -92,7 +96,10 @@ fn parse_expert_name(name: &str) -> Option<(u16, u16)> { } /// Read a safetensors header: returns (data section start, tensors). -fn read_header(path: &Path) -> Result<(u64, BTreeMap), HeartbeatError> { +#[allow(clippy::type_complexity)] +fn read_header( + path: &Path, +) -> Result<(u64, BTreeMap, Vec), HeartbeatError> { let f = File::open(path).map_err(|e| HeartbeatError::io(path.display().to_string(), e))?; let mut lenb = [0u8; 8]; f.read_exact_at(&mut lenb, 0) @@ -108,7 +115,7 @@ fn read_header(path: &Path) -> Result<(u64, BTreeMap) .map_err(|e| HeartbeatError::io("header", e))?; let map: BTreeMap = serde_json::from_slice(&h) .map_err(|e| HeartbeatError::Manifest(format!("header json: {e}")))?; - Ok((8 + hlen, map)) + Ok((8 + hlen, map, h)) } impl Manifest { @@ -116,11 +123,14 @@ impl Manifest { /// expert span once to compute its digest. Read-only on the model. pub fn build(model_dir: &Path) -> Result { let idx_path = model_dir.join("model.safetensors.index.json"); - let idx: Index = serde_json::from_slice( - &std::fs::read(&idx_path).map_err(|e| HeartbeatError::io("index", e))?, - ) - .map_err(|e| HeartbeatError::Manifest(format!("index json: {e}")))?; + let idx_bytes = std::fs::read(&idx_path).map_err(|e| HeartbeatError::io("index", e))?; + let idx: Index = serde_json::from_slice(&idx_bytes) + .map_err(|e| HeartbeatError::Manifest(format!("index json: {e}")))?; + let mut model_h = blake3::Hasher::new(); + model_h.update(b"aien-heartbeat-model/1\0"); + model_h.update(&(idx_bytes.len() as u64).to_le_bytes()); + model_h.update(&idx_bytes); let mut shards: Vec = Vec::new(); for (name, shard) in &idx.weight_map { if parse_expert_name(name).is_some() && !shards.contains(shard) { @@ -132,7 +142,11 @@ impl Manifest { // (layer, expert) -> tensors (shard, name, dtype, shape, abs offset, len) let mut groups: BTreeMap<(u16, u16), Vec<(u32, RawTensor)>> = BTreeMap::new(); for (si, shard) in shards.iter().enumerate() { - let (data_start, header) = read_header(&model_dir.join(shard))?; + let (data_start, header, raw_header) = read_header(&model_dir.join(shard))?; + model_h.update(&(shard.len() as u64).to_le_bytes()); + model_h.update(shard.as_bytes()); + model_h.update(&(raw_header.len() as u64).to_le_bytes()); + model_h.update(&raw_header); for (name, v) in header { let Some(key) = parse_expert_name(&name) else { continue; @@ -197,6 +211,9 @@ impl Manifest { h.update(&buf); } let digest = h.finalize().to_hex().to_string(); + model_h.update(&layer.to_le_bytes()); + model_h.update(&expert.to_le_bytes()); + model_h.update(digest.as_bytes()); experts.push(ExpertEntry { layer, expert, @@ -216,6 +233,7 @@ impl Manifest { } Ok(Self { schema: MANIFEST_SCHEMA.into(), + model_digest: model_h.finalize().to_hex().to_string(), model_dir: model_dir.to_path_buf(), shards, num_layers, diff --git a/crates/aien-heartbeat/src/pager.rs b/crates/aien-heartbeat/src/pager.rs new file mode 100644 index 00000000..0531ab17 --- /dev/null +++ b/crates/aien-heartbeat/src/pager.rs @@ -0,0 +1,314 @@ +//! Expert pager (Expert Ribbon P2, sc#630/#632): turns the router's exact top-k for one layer into pinned, +//! resident GPU slots. Hits pin; misses read the expert from the checkpoint (bounded, digest-verified +//! [`ReadAdapter`]), split it into the chip layout and load it into a slot pair through a [`SlotBackend`]. +//! Misses of one layer are read and loaded in parallel (each on its own thread; the read adapter bounds how +//! many reads are in the kernel at once). +//! +//! Exactness: the experts returned are exactly the ones asked for, in the same order. A miss that cannot be +//! served (read error, digest mismatch, every slot pinned) is an error; nothing is substituted or skipped. + +use std::collections::HashMap; +use std::sync::{Arc, Condvar, Mutex}; +use std::time::{Duration, Instant}; + +use crate::layout::{ExpertLayout, ExpertParts, ExpertShape}; +use crate::manifest::Manifest; +use crate::reader::{ReadAdapter, ReadError}; +use crate::residency::{Acquire, ExpertId, Residency, ResidencyStats, SlotVersion}; + +#[cfg(feature = "ribbon-omega")] +mod pipeline; + +/// The GPU side of a slot pair. The real one wraps two omega_gpu_fp8_slots pools (gate|up and down); +/// tests use a host fake. Must be callable from several threads at once (one load per slot at a time). +pub trait SlotBackend: Send + Sync { + fn slots(&self) -> usize; + /// Load `parts` into slot pair `slot`, returning the published versions. Refused (error) if the slot is + /// still read by a launch: the residency manager never asks for that, so a refusal is a bug, fail closed. + fn load(&self, slot: u32, id: ExpertId, parts: &ExpertParts<'_>) + -> Result; +} + +#[derive(Debug)] +pub enum PagerError { + Read { + id: ExpertId, + err: ReadError, + }, + Layout(String), + Backend { + id: ExpertId, + err: String, + }, + /// Every slot is pinned or being fetched: the capacity is too small for this request. + Exhausted { + id: ExpertId, + capacity: usize, + }, + UnknownExpert(ExpertId), +} + +impl std::fmt::Display for PagerError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Read { id, err } => write!(f, "expert {id:?}: read failed: {err}"), + Self::Layout(s) => write!(f, "expert layout: {s}"), + Self::Backend { id, err } => write!(f, "expert {id:?}: slot load failed: {err}"), + Self::Exhausted { id, capacity } => write!( + f, + "expert {id:?}: all {capacity} slots are pinned or loading (capacity too small for one request)" + ), + Self::UnknownExpert(id) => write!(f, "expert {id:?} is not in the manifest"), + } + } +} +impl std::error::Error for PagerError {} + +#[derive(Debug, Clone, Default)] +pub struct PagerStats { + pub requests: u64, + pub experts_hit: u64, + pub experts_missed: u64, + pub bytes_loaded: u64, + /// Wall time inside `ensure` spent on misses (read + verify + slot load), summed per call. + pub miss_wall_ns: u64, + /// Summed over miss threads: waiting for the verified read, and loading the slot pair. + pub read_wait_ns: u64, + pub slot_load_ns: u64, +} + +/// Slots pinned for one layer's launch, in the order the router gave the experts. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Pinned { + pub slots: Vec, + pub versions: Vec, +} + +pub struct ExpertPager { + manifest: Arc, + layouts: Vec, + index_of: HashMap, + reader: ReadAdapter, + backend: Arc, + res: Mutex, + fetch_done: Condvar, + stats: Mutex, + read_deadline: Duration, +} + +impl ExpertPager { + /// Validates every expert's layout against `shape` up front (a format mismatch fails here, not mid-run). + pub fn new( + manifest: Arc, + shape: ExpertShape, + reader: ReadAdapter, + backend: Arc, + read_deadline: Duration, + ) -> Result { + let layouts = manifest + .experts + .iter() + .map(|e| ExpertLayout::for_entry(e, shape)) + .collect::, _>>() + .map_err(|e| PagerError::Layout(e.to_string()))?; + let index_of = manifest + .experts + .iter() + .enumerate() + .map(|(i, e)| ((e.layer, e.expert), i)) + .collect(); + let slots = backend.slots(); + Ok(Self { + manifest, + layouts, + index_of, + reader, + backend, + res: Mutex::new(Residency::new(slots)), + fetch_done: Condvar::new(), + stats: Mutex::new(PagerStats::default()), + read_deadline, + }) + } + + pub fn manifest(&self) -> &Manifest { + &self.manifest + } + pub fn capacity(&self) -> usize { + self.res.lock().unwrap().capacity() + } + pub fn resident(&self) -> usize { + self.res.lock().unwrap().resident() + } + pub fn stats(&self) -> PagerStats { + self.stats.lock().unwrap().clone() + } + pub fn residency_stats(&self) -> ResidencyStats { + self.res.lock().unwrap().stats() + } + pub fn read_stats(&self) -> crate::reader::ReadStats { + self.reader.stats() + } + pub fn pinned(&self) -> u32 { + self.res.lock().unwrap().pinned() + } + + /// Pins exactly `experts` of `layer` (router order). On error nothing stays pinned. + pub fn ensure(&self, layer: u16, experts: &[u16]) -> Result { + let wait_start = Instant::now(); + let mut out: Vec> = vec![None; experts.len()]; + let mut fetch: Vec<(usize, u32, ExpertId)> = Vec::new(); // (position, slot, id) + { + let mut r = self.res.lock().unwrap(); + for (pos, &ex) in experts.iter().enumerate() { + let id = (layer, ex); + if !self.index_of.contains_key(&id) { + self.undo(&mut r, &out, &fetch); + return Err(PagerError::UnknownExpert(id)); + } + loop { + match r.acquire(id) { + Acquire::Hit { slot, ver } => { + out[pos] = Some((slot, ver)); + break; + } + Acquire::Fetch { slot, .. } => { + fetch.push((pos, slot, id)); + break; + } + Acquire::Pending => { + let Some(left) = self.read_deadline.checked_sub(wait_start.elapsed()) + else { + self.undo(&mut r, &out, &fetch); + return Err(PagerError::Read { + id, + err: ReadError::Deadline, + }); + }; + r = self.fetch_done.wait_timeout(r, left).unwrap().0; + } + Acquire::Exhausted => { + let capacity = r.capacity(); + self.undo(&mut r, &out, &fetch); + return Err(PagerError::Exhausted { id, capacity }); + } + } + } + } + } + let hits = (experts.len() - fetch.len()) as u64; + let t0 = Instant::now(); + let results: Vec> = if fetch.is_empty() { + Vec::new() + } else { + std::thread::scope(|sc| { + let hs: Vec<_> = fetch + .iter() + .map(|&(_, slot, id)| sc.spawn(move || self.fetch_one(slot, id))) + .collect(); + hs.into_iter() + .map(|h| { + h.join().unwrap_or_else(|_| { + Err(PagerError::Layout("miss thread panicked".into())) + }) + }) + .collect() + }) + }; + let miss_wall = t0.elapsed().as_nanos() as u64; + let mut first_err = None; + { + let mut r = self.res.lock().unwrap(); + for (&(pos, slot, _), res) in fetch.iter().zip(&results) { + match res { + Ok((ver, ..)) => { + r.fetched(slot, *ver); + out[pos] = Some((slot, *ver)); + } + Err(_) => r.fetch_failed(slot), + } + } + for res in &results { + if let Err(e) = res { + first_err.get_or_insert_with(|| format!("{e}")); + } + } + if first_err.is_some() { + for (slot, _) in out.iter().flatten() { + r.release(*slot); + } + } + } + self.fetch_done.notify_all(); + let mut s = self.stats.lock().unwrap(); + s.requests += 1; + s.experts_hit += hits; + s.experts_missed += fetch.len() as u64; + s.miss_wall_ns += miss_wall; + for (_, rw, sl, b) in results.iter().flatten() { + s.read_wait_ns += rw; + s.slot_load_ns += sl; + s.bytes_loaded += b; + } + drop(s); + if let Some(e) = results.into_iter().find_map(|r| r.err()) { + return Err(e); + } + let (slots, versions) = out + .into_iter() + .map(|o| o.expect("every position filled")) + .unzip(); + Ok(Pinned { slots, versions }) + } + + /// Drops the pins of a finished launch. + pub fn release(&self, p: &Pinned) { + let mut r = self.res.lock().unwrap(); + for &s in &p.slots { + r.release(s); + } + } + + fn undo( + &self, + r: &mut Residency, + out: &[Option<(u32, SlotVersion)>], + fetch: &[(usize, u32, ExpertId)], + ) { + for (slot, _) in out.iter().flatten() { + r.release(*slot); + } + for &(_, slot, _) in fetch { + r.fetch_failed(slot); + } + } + + /// Read + verify + split + slot load. Returns (version, read wait ns, slot load ns, bytes). + fn fetch_one( + &self, + slot: u32, + id: ExpertId, + ) -> Result<(SlotVersion, u64, u64, u64), PagerError> { + let idx = self.index_of[&id]; + let t0 = Instant::now(); + let v = self + .reader + .submit_wait(idx, self.read_deadline) + .and_then(|t| t.wait(self.read_deadline)) + .map_err(|err| PagerError::Read { id, err })?; + let rw = t0.elapsed().as_nanos() as u64; + let t1 = Instant::now(); + let payload = v.payload(); + let parts = self.layouts[idx] + .parts(&payload) + .map_err(|e| PagerError::Layout(e.to_string()))?; + let bytes = (parts.gate_up_w.len() + + parts.down_w.len() + + 2 * (parts.gate_up_s.len() + parts.down_s.len())) as u64; + let ver = self + .backend + .load(slot, id, &parts) + .map_err(|err| PagerError::Backend { id, err })?; + Ok((ver, rw, t1.elapsed().as_nanos() as u64, bytes)) + } +} diff --git a/crates/aien-heartbeat/src/pager/.crumb b/crates/aien-heartbeat/src/pager/.crumb new file mode 100644 index 00000000..5531b555 --- /dev/null +++ b/crates/aien-heartbeat/src/pager/.crumb @@ -0,0 +1,9 @@ +{ + "schema_version": "1.0.0", + "name": "pager", + "purpose": "Transport attachment from the existing expert reader and slot backend to the compiled Omega ribbon policy.", + "invariants": [ + "Generated Omega Bridge declarations define the native call boundary; no hand-written foreign signature. Check: om/ribbon/check_native.py", + "Read errors and consumer failures release the request's GPU pins. Check: cargo test -p aien-heartbeat --features ribbon-omega --test ribbon_store" + ] +} diff --git a/crates/aien-heartbeat/src/pager/pipeline.rs b/crates/aien-heartbeat/src/pager/pipeline.rs new file mode 100644 index 00000000..8722ef95 --- /dev/null +++ b/crates/aien-heartbeat/src/pager/pipeline.rs @@ -0,0 +1,328 @@ +// SPDX-License-Identifier: Apache-2.0 +//! Transport adapter for om/ribbon/pipeline.om. The Omega unit owns admission, +//! stage transitions, buffer budgets and publication. This adapter attaches the +//! existing read workers and GPU slot implementation to its returned actions. + +use super::*; +use crate::reader::{Ticket, VerifiedExpert}; + +mod native { + // Generated from pipeline.om by Omega Bridge, never handwritten declarations. + include!(env!("AIEN_RIBBON_BINDINGS")); +} + +struct Controller { + state: Box<[u64; 4096]>, + start: Instant, +} + +impl Controller { + fn call( + &mut self, + op: u64, + key: u64, + bytes: u64, + deadline: u64, + ok: u64, + ) -> Result<(u64, [u64; 8]), PagerError> { + let now = u64::try_from(self.start.elapsed().as_nanos()) + .map_err(|_| PagerError::Layout("ribbon clock overflow".into()))?; + let request = [op, key, bytes, deadline, ok, 0, now, 0]; + let mut out = [0; 8]; + let mut result = 0; + // SAFETY: generated binding; distinct, aligned, live arrays of the declared lengths. + let trap = unsafe { + native::omega_pipeline( + &mut result, + self.state.as_mut_ptr(), + 4096, + request.as_ptr(), + 8, + out.as_mut_ptr(), + 8, + ) + }; + if trap != 0 { + return Err(PagerError::Layout(format!("Omega ribbon trap {trap}"))); + } + Ok((result, out)) + } + + fn exact( + &mut self, + op: u64, + key: u64, + bytes: u64, + deadline: u64, + ok: u64, + ) -> Result<[u64; 8], PagerError> { + let (code, out) = self.call(op, key, bytes, deadline, ok)?; + if code != 0 { + return Err(PagerError::Layout(format!( + "Omega ribbon operation {op} refused {code}" + ))); + } + Ok(out) + } +} + +impl ExpertPager { + fn pipeline_submit( + &self, + ctrl: &mut Controller, + reads: &mut [Option], + layer: u16, + experts: &[u16], + ) -> Result { + let mut submitted = false; + loop { + let (code, action) = ctrl.call(3, 0, 0, 0, 0)?; + if code == 1 { + return Ok(submitted); + } + if code != 0 { + return Err(PagerError::Layout(format!("ribbon read refused {code}"))); + } + let pos = action[1] as usize; + let idx = self.index_of[&(layer, experts[pos])]; + reads[pos] = Some(self.reader.submit(idx).map_err(|err| PagerError::Read { + id: (layer, experts[pos]), + err, + })?); + submitted = true; + } + } + /// Run each exact expert as soon as its verified copy is visible. The caller + /// writes results by router position; completion order never changes routing + /// or the final reduction order. All slots remain pinned until this call ends. + pub fn for_each_ready( + &self, + layer: u16, + experts: &[u16], + buffers: usize, + mut consume: impl FnMut(usize, u32, SlotVersion) -> Result<(), String>, + ) -> Result<(), PagerError> { + if experts.is_empty() + || experts.len() > 64 + || !(1..=2).contains(&buffers) + || self.reader.queue_depth() < buffers + { + return Err(PagerError::Layout("invalid Omega ribbon bounds".into())); + } + let mut out = vec![None; experts.len()]; + let mut fetch = Vec::new(); + let wait_start = Instant::now(); + { + let mut r = self.res.lock().unwrap(); + for (pos, &expert) in experts.iter().enumerate() { + let id = (layer, expert); + if !self.index_of.contains_key(&id) { + self.undo(&mut r, &out, &fetch); + return Err(PagerError::UnknownExpert(id)); + } + loop { + match r.acquire(id) { + Acquire::Hit { slot, ver } => { + out[pos] = Some((slot, ver)); + break; + } + Acquire::Fetch { slot, .. } => { + fetch.push((pos, slot, id)); + break; + } + Acquire::Pending => { + let Some(left) = self.read_deadline.checked_sub(wait_start.elapsed()) + else { + self.undo(&mut r, &out, &fetch); + return Err(PagerError::Read { + id, + err: ReadError::Deadline, + }); + }; + r = self.fetch_done.wait_timeout(r, left).unwrap().0; + } + Acquire::Exhausted => { + let capacity = r.capacity(); + self.undo(&mut r, &out, &fetch); + return Err(PagerError::Exhausted { id, capacity }); + } + } + } + } + } + let mut reads: Vec> = (0..experts.len()).map(|_| None).collect(); + let mut ready: Vec> = (0..experts.len()).map(|_| None).collect(); + let mut tickets = vec![0; experts.len()]; + let start = Instant::now(); + let mut consumed_ns = 0; + let mut ctrl = Controller { + state: Box::new([0; 4096]), + start, + }; + let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let deadline = u64::try_from(self.read_deadline.as_nanos()) + .map_err(|_| PagerError::Layout("ribbon deadline overflow".into()))?; + let bytes = self.reader.staging_capacity() as u64; + if !fetch.is_empty() { + ctrl.exact( + 1, + fetch.len() as u64, + bytes + .checked_mul(buffers as u64) + .ok_or_else(|| PagerError::Layout("ribbon byte budget overflow".into()))?, + buffers as u64, + 0, + )?; + for &(pos, _, _) in &fetch { + tickets[pos] = ctrl.exact(2, pos as u64, bytes, deadline, 0)?[0]; + } + } + let mut done = vec![false; experts.len()]; + let mut count = 0; + // The synchronous control must also serialize cache-hit computation + // against reads for misses. Consume its hits before starting any I/O. + if buffers == 1 { + for pos in 0..experts.len() { + if tickets[pos] == 0 { + let (slot, ver) = out[pos].unwrap(); + let consuming = Instant::now(); + consume(pos, slot, ver).map_err(PagerError::Layout)?; + consumed_ns += consuming.elapsed().as_nanos() as u64; + done[pos] = true; + count += 1; + } + } + } + while count < experts.len() { + let mut progress = false; + if !fetch.is_empty() { + progress |= self.pipeline_submit(&mut ctrl, &mut reads, layer, experts)?; + for &(pos, _, id) in &fetch { + if let Some(read) = &reads[pos] { + match read.try_wait() { + Ok(Some(value)) => { + ctrl.exact(4, tickets[pos], 0, 0, 1)?; + reads[pos] = None; + ready[pos] = Some(value); + progress = true; + } + Ok(None) => {} + Err(err) => { + let _ = ctrl.call(4, tickets[pos], 0, 0, 0); + return Err(PagerError::Read { id, err }); + } + } + } + } + loop { + let (code, action) = ctrl.call(5, 0, 0, 0, 0)?; + if code == 1 { + break; + } + if code != 0 { + return Err(PagerError::Layout(format!("ribbon copy refused {code}"))); + } + let pos = action[1] as usize; + let (_, slot, id) = + fetch.iter().find(|x| x.0 == pos).copied().ok_or_else(|| { + PagerError::Layout("ribbon unknown copy position".into()) + })?; + let value = ready[pos].take().ok_or_else(|| { + PagerError::Layout("ribbon copy without verified bytes".into()) + })?; + let t = Instant::now(); + let payload = value.payload(); + let parts = self.layouts[value.index] + .parts(&payload) + .map_err(|e| PagerError::Layout(e.to_string()))?; + let ver = self + .backend + .load(slot, id, &parts) + .map_err(|err| PagerError::Backend { id, err })?; + ctrl.exact(6, tickets[pos], 0, 0, 1)?; + drop(parts); + drop(payload); + drop(value); + // Only the two-buffer mode looks ahead while the GPU consumes + // this expert. One buffer is the synchronous control: refill + // on the next loop, after consumption has retired. + if buffers == 2 { + self.pipeline_submit(&mut ctrl, &mut reads, layer, experts)?; + } + // Completion can acknowledge an expired copy without granting + // publication. Obtain the ready-state pin before exposing it. + ctrl.exact(7, tickets[pos], 0, 0, 0)?; + self.res.lock().unwrap().fetched(slot, ver); + out[pos] = Some((slot, ver)); + self.fetch_done.notify_all(); + { + let mut stats = self.stats.lock().unwrap(); + stats.slot_load_ns += t.elapsed().as_nanos() as u64; + stats.bytes_loaded += self.manifest.experts[self.index_of[&id]].len; + } + let consuming = Instant::now(); + consume(pos, slot, ver).map_err(PagerError::Layout)?; + consumed_ns += consuming.elapsed().as_nanos() as u64; + ctrl.exact(8, tickets[pos], 0, 0, 0)?; + ctrl.exact(9, tickets[pos], 0, 0, 0)?; + done[pos] = true; + count += 1; + progress = true; + } + } + // Cache hits need no staging operation. Preserve their pre-acquired pins. + for pos in 0..experts.len() { + if !done[pos] && tickets[pos] == 0 { + let (slot, ver) = out[pos].unwrap(); + let consuming = Instant::now(); + consume(pos, slot, ver).map_err(PagerError::Layout)?; + consumed_ns += consuming.elapsed().as_nanos() as u64; + done[pos] = true; + count += 1; + progress = true; + } + } + if !progress { + if start.elapsed() >= self.read_deadline { + return Err(PagerError::Read { + id: (layer, experts[0]), + err: ReadError::Deadline, + }); + } + std::thread::sleep(Duration::from_micros(50)); + } + } + Ok(()) + })); + // A worker owns its buffer until it actually finishes. Cancelling a ticket + // only requests cancellation; dropping the receiver never frees its buffer. + for read in reads.iter().flatten() { + read.cancel(); + } + let _ = ctrl.call(11, 0, 0, 0, 0); + { + let mut r = self.res.lock().unwrap(); + for entry in out.iter().flatten() { + r.release(entry.0); + } + for &(pos, slot, _) in &fetch { + if out[pos].is_none() { + r.fetch_failed(slot); + } + } + } + self.fetch_done.notify_all(); + let mut stats = self.stats.lock().unwrap(); + stats.requests += 1; + stats.experts_hit += (experts.len() - fetch.len()) as u64; + stats.experts_missed += fetch.len() as u64; + stats.miss_wall_ns += (start.elapsed().as_nanos() as u64).saturating_sub(consumed_ns); + match result { + Ok(value) => value, + Err(payload) => { + drop(stats); + std::panic::resume_unwind(payload) + } + } + } +} diff --git a/crates/aien-heartbeat/src/reader.rs b/crates/aien-heartbeat/src/reader.rs new file mode 100644 index 00000000..971d4ff6 --- /dev/null +++ b/crates/aien-heartbeat/src/reader.rs @@ -0,0 +1,547 @@ +//! Bounded expert read adapter (Expert Ribbon P1, sc#629): random reads of one selected expert from the +//! checkpoint shards into a fixed pool of aligned staging buffers, verified against the manifest digest +//! before anyone can see the bytes. +//! +//! * Bounded: `queue_depth` staging buffers, allocated once. `submit` refuses with [`ReadError::QueueFull`] +//! when all are in use (no unbounded queue, no hidden allocation). +//! * Verified: a [`VerifiedExpert`] exists only after the whole expert was read and its BLAKE3 matched. A short +//! read, EOF, I/O error or digest mismatch returns an explicit error and publishes nothing. +//! * Cancellation and deadlines: [`Ticket::cancel`] and [`Ticket::wait`]'s deadline. A read that is already in +//! the kernel cannot be interrupted; its result is discarded and the buffer returns to the pool when it ends. +//! * Shutdown: dropping the adapter closes the queue and joins every worker (outstanding tickets see +//! [`ReadError::Shutdown`]). +//! * Device: [`ShardDevice`]. [`FileShards`] is the Linux one (O_DIRECT or buffered, chosen by measurement, see +//! the README); [`FakeShards`] is a deterministic in-memory one with injectable latency and faults for tests. + +use std::collections::VecDeque; +use std::fs::{File, OpenOptions}; +use std::os::unix::fs::{FileExt, OpenOptionsExt}; +use std::path::PathBuf; +use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; +use std::sync::mpsc::{self, Receiver, RecvTimeoutError, SyncSender}; +use std::sync::{Arc, Condvar, Mutex}; +use std::thread::JoinHandle; +use std::time::{Duration, Instant}; + +use crate::aligned::{round_down, round_up, AlignedBuf}; +use crate::layout::Payload; +use crate::manifest::{ExpertEntry, Manifest}; + +/// Positional reads from the checkpoint shards. +pub trait ShardDevice: Send + Sync { + fn read_at(&self, shard: u32, buf: &mut [u8], off: u64) -> std::io::Result; + /// Alignment of buffers, offsets and lengths the device needs (4096 for O_DIRECT, 1 otherwise). + fn align(&self) -> usize; +} + +/// The shard files, read-only, O_DIRECT or buffered. +pub struct FileShards { + files: Vec, + direct: bool, +} + +impl FileShards { + pub fn open(paths: &[PathBuf], direct: bool) -> Result { + let mut files = Vec::with_capacity(paths.len()); + for p in paths { + let mut o = OpenOptions::new(); + o.read(true); + if direct { + o.custom_flags(libc::O_DIRECT); + } + files.push( + o.open(p) + .map_err(|e| ReadError::Io(format!("open {}: {e}", p.display())))?, + ); + } + Ok(Self { files, direct }) + } +} + +impl ShardDevice for FileShards { + fn read_at(&self, shard: u32, buf: &mut [u8], off: u64) -> std::io::Result { + let f = self + .files + .get(shard as usize) + .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::InvalidInput, "shard index"))?; + f.read_at(buf, off) + } + fn align(&self) -> usize { + if self.direct { + crate::IO_ALIGN + } else { + 1 + } + } +} + +/// A fault the fake device applies to one read call (counted from 0 over the device's life). +#[derive(Debug)] +pub enum Fault { + /// The call returns EIO. + Eio, + /// The call returns at most this many bytes, then every later call on the same request returns 0 (EOF). + Short(usize), + /// The call succeeds but flips one byte of what it returns. + Flip, + /// The call blocks until the sender is dropped or sends (a stalled NVMe), then reads normally. + Stall(Receiver<()>), +} + +/// Deterministic in-memory shards for tests: optional fixed latency per read and a fault plan by call index. +pub struct FakeShards { + pub shards: Vec>, + pub latency: Duration, + faults: Mutex>, + calls: AtomicU64, + eof_after_short: Mutex>, +} + +impl FakeShards { + pub fn new(shards: Vec>, latency: Duration) -> Self { + Self { + shards, + latency, + faults: Mutex::new(VecDeque::new()), + calls: AtomicU64::new(0), + eof_after_short: Mutex::new(None), + } + } + /// Apply `f` to read call number `call` (0-based over the device's life). + pub fn fault_at(&self, call: u64, f: Fault) { + self.faults.lock().unwrap().push_back((call, f)); + } + pub fn calls(&self) -> u64 { + self.calls.load(Ordering::Relaxed) + } +} + +impl ShardDevice for FakeShards { + fn read_at(&self, shard: u32, buf: &mut [u8], off: u64) -> std::io::Result { + let call = self.calls.fetch_add(1, Ordering::Relaxed); + if !self.latency.is_zero() { + std::thread::sleep(self.latency); + } + if let Some(c) = *self.eof_after_short.lock().unwrap() { + if call == c + 1 { + return Ok(0); + } + } + let fault = { + let mut q = self.faults.lock().unwrap(); + q.iter() + .position(|(c, _)| *c == call) + .and_then(|i| q.remove(i)) + .map(|(_, f)| f) + }; + let data = &self.shards[shard as usize]; + let start = (off as usize).min(data.len()); + let mut n = buf.len().min(data.len() - start); + match fault { + Some(Fault::Eio) => return Err(std::io::Error::from_raw_os_error(libc::EIO)), + Some(Fault::Short(m)) => { + n = n.min(m); + *self.eof_after_short.lock().unwrap() = Some(call); + } + Some(Fault::Stall(ref rx)) => { + let _ = rx.recv(); + } + _ => {} + } + buf[..n].copy_from_slice(&data[start..start + n]); + if let (Some(Fault::Flip), true) = (&fault, n > 0) { + buf[n / 2] ^= 0x5A; + } + Ok(n) + } + fn align(&self) -> usize { + 1 + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ReadError { + /// Every staging buffer is in use (bounded queue). + QueueFull, + /// The expert does not fit one staging buffer. + TooLarge { + need: usize, + cap: usize, + }, + Io(String), + /// Fewer bytes than the manifest span (EOF or a short read that never completed). + ShortRead { + expert: (u16, u16), + wanted: usize, + got: usize, + }, + DigestMismatch { + expert: (u16, u16), + }, + Cancelled, + /// The waiter's deadline passed before the read finished (a stalled read). + Deadline, + Shutdown, + Manifest(String), +} + +impl std::fmt::Display for ReadError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{self:?}") + } +} +impl std::error::Error for ReadError {} + +#[derive(Debug, Clone, Copy)] +pub struct ReadConfig { + /// Reader threads (parallel reads in flight). + pub workers: usize, + /// Staging buffers = the most requests in flight or waiting to be consumed. + pub queue_depth: usize, +} + +#[derive(Debug, Clone, Default)] +pub struct ReadStats { + /// Successfully queued jobs, observable when submit returns. + pub reads_submitted: u64, + pub reads_ok: u64, + pub payload_bytes: u64, + pub device_bytes: u64, + pub read_ns: u64, + pub digest_ns: u64, + pub errors: u64, + pub queue_full: u64, +} + +struct Pool { + bufs: Mutex>, + returned: Condvar, + cap: usize, +} + +impl Pool { + fn give_back(&self, b: AlignedBuf) { + self.bufs.lock().unwrap().push(b); + self.returned.notify_all(); + } +} + +/// A whole, digest-checked expert in a staging buffer. The buffer returns to the pool on drop. +pub struct VerifiedExpert { + pub index: usize, + pub layer: u16, + pub expert: u16, + buf: Option, + ranges: Vec<(usize, usize)>, + pool: Arc, +} + +impl VerifiedExpert { + pub fn payload(&self) -> Payload<'_> { + let b = self.buf.as_ref().expect("buffer").as_slice(); + Payload::new(self.ranges.iter().map(|&(o, l)| &b[o..o + l]).collect()) + } +} + +impl Drop for VerifiedExpert { + fn drop(&mut self) { + if let Some(b) = self.buf.take() { + self.pool.give_back(b); + } + } +} + +type Reply = Result; + +struct Job { + index: usize, + buf: AlignedBuf, + cancel: Arc, + reply: SyncSender, +} + +/// One submitted read. +pub struct Ticket { + rx: Receiver, + cancel: Arc, +} + +impl Ticket { + /// Poll the existing worker without blocking the consumer's GPU work. + pub fn try_wait(&self) -> Result, ReadError> { + match self.rx.try_recv() { + Ok(result) => result.map(Some), + Err(mpsc::TryRecvError::Empty) => Ok(None), + Err(mpsc::TryRecvError::Disconnected) => Err(ReadError::Shutdown), + } + } + /// Request cancellation: a read not yet started is skipped; one in progress is discarded. + pub fn cancel(&self) { + self.cancel.store(true, Ordering::Release); + } + /// Wait up to `deadline` for the verified expert. On timeout the request is cancelled. + pub fn wait(self, deadline: Duration) -> Result { + match self.rx.recv_timeout(deadline) { + Ok(r) => r, + Err(RecvTimeoutError::Timeout) => { + self.cancel(); + Err(ReadError::Deadline) + } + Err(RecvTimeoutError::Disconnected) => Err(ReadError::Shutdown), + } + } +} + +pub struct ReadAdapter { + manifest: Arc, + pool: Arc, + tx: Option>, + workers: Vec>, + stats: Arc>, + queue_depth: usize, +} + +/// Bytes one staging buffer needs for any expert of `m` on a device of alignment `align`. +pub fn staging_bytes(m: &Manifest, align: usize) -> usize { + m.experts + .iter() + .map(|e| { + e.segments + .iter() + .map(|s| round_up(s.len as usize + align, align.max(crate::IO_ALIGN))) + .sum::() + }) + .max() + .unwrap_or(crate::IO_ALIGN) +} + +impl ReadAdapter { + pub fn new(manifest: Arc, dev: Arc, cfg: ReadConfig) -> Self { + assert!(cfg.workers > 0 && cfg.queue_depth > 0); + let cap = staging_bytes(&manifest, dev.align()); + let pool = Arc::new(Pool { + bufs: Mutex::new((0..cfg.queue_depth).map(|_| AlignedBuf::new(cap)).collect()), + returned: Condvar::new(), + cap, + }); + let (tx, rx) = mpsc::sync_channel::(cfg.queue_depth); + let rx = Arc::new(Mutex::new(rx)); + let stats = Arc::new(Mutex::new(ReadStats::default())); + let workers = (0..cfg.workers) + .map(|_| { + let (rx, dev, m, pool, stats) = ( + rx.clone(), + dev.clone(), + manifest.clone(), + pool.clone(), + stats.clone(), + ); + std::thread::spawn(move || loop { + let job = match rx.lock().unwrap().recv() { + Ok(j) => j, + Err(_) => return, + }; + let r = run_job(&*dev, &m, &pool, &stats, job.index, job.buf, &job.cancel); + // A waiter that gave up (deadline) dropped its receiver: the buffer comes back via drop. + let _ = job.reply.send(r); + }) + }) + .collect(); + Self { + manifest, + pool, + tx: Some(tx), + workers, + stats, + queue_depth: cfg.queue_depth, + } + } + + pub fn manifest(&self) -> &Manifest { + &self.manifest + } + + pub fn staging_capacity(&self) -> usize { + self.pool.cap + } + + pub fn queue_depth(&self) -> usize { + self.queue_depth + } + + pub fn stats(&self) -> ReadStats { + self.stats.lock().unwrap().clone() + } + + /// Queue a read of `manifest.experts[index]`. Refuses (QueueFull) when every staging buffer is in use. + pub fn submit(&self, index: usize) -> Result { + if index >= self.manifest.experts.len() { + return Err(ReadError::Manifest(format!("expert index {index}"))); + } + let buf = match self.pool.bufs.lock().unwrap().pop() { + Some(b) => b, + None => { + self.stats.lock().unwrap().queue_full += 1; + return Err(ReadError::QueueFull); + } + }; + let (rtx, rrx) = mpsc::sync_channel(1); + let cancel = Arc::new(AtomicBool::new(false)); + let job = Job { + index, + buf, + cancel: cancel.clone(), + reply: rtx, + }; + let tx = self.tx.as_ref().ok_or(ReadError::Shutdown)?; + if let Err(mpsc::SendError(j)) = tx.send(job) { + self.pool.give_back(j.buf); + return Err(ReadError::Shutdown); + } + self.stats.lock().unwrap().reads_submitted += 1; + Ok(Ticket { rx: rrx, cancel }) + } + + /// Submit, waiting (up to `wait`) for a free staging buffer instead of refusing. + pub fn submit_wait(&self, index: usize, wait: Duration) -> Result { + let t0 = Instant::now(); + loop { + match self.submit(index) { + Err(ReadError::QueueFull) => { + let left = wait.saturating_sub(t0.elapsed()); + if left.is_zero() { + return Err(ReadError::QueueFull); + } + let g = self.pool.bufs.lock().unwrap(); + if g.is_empty() { + let _ = self.pool.returned.wait_timeout(g, left).unwrap(); + } + } + r => return r, + } + } + } +} + +impl Drop for ReadAdapter { + fn drop(&mut self) { + self.tx.take(); + for w in self.workers.drain(..) { + let _ = w.join(); + } + } +} + +fn run_job( + dev: &dyn ShardDevice, + m: &Manifest, + pool: &Arc, + stats: &Mutex, + index: usize, + mut buf: AlignedBuf, + cancel: &AtomicBool, +) -> Reply { + let e = &m.experts[index]; + let fail = |buf: AlignedBuf, err: ReadError| { + pool.give_back(buf); + if err != ReadError::Cancelled { + stats.lock().unwrap().errors += 1; + } + Err(err) + }; + if cancel.load(Ordering::Acquire) { + return fail(buf, ReadError::Cancelled); + } + let t0 = Instant::now(); + let (ranges, device) = match read_expert(dev, e, buf.as_mut_slice()) { + Ok(v) => v, + Err(err) => return fail(buf, err), + }; + let read_ns = t0.elapsed().as_nanos() as u64; + if cancel.load(Ordering::Acquire) { + return fail(buf, ReadError::Cancelled); + } + let t1 = Instant::now(); + let expected = match e.digest_bytes() { + Ok(d) => d, + Err(err) => return fail(buf, ReadError::Manifest(err.to_string())), + }; + let mut h = blake3::Hasher::new(); + for &(o, l) in &ranges { + h.update(&buf.as_slice()[o..o + l]); + } + if h.finalize().as_bytes() != &expected { + return fail( + buf, + ReadError::DigestMismatch { + expert: (e.layer, e.expert), + }, + ); + } + { + let mut s = stats.lock().unwrap(); + s.reads_ok += 1; + s.payload_bytes += e.len; + s.device_bytes += device; + s.read_ns += read_ns; + s.digest_ns += t1.elapsed().as_nanos() as u64; + } + Ok(VerifiedExpert { + index, + layer: e.layer, + expert: e.expert, + buf: Some(buf), + ranges, + pool: pool.clone(), + }) +} + +/// Reads every segment of `e` into its own aligned window of `buf`. Returns the payload ranges and the device bytes. +pub fn read_expert( + dev: &dyn ShardDevice, + e: &ExpertEntry, + buf: &mut [u8], +) -> Result<(Vec<(usize, usize)>, u64), ReadError> { + let align = dev.align().max(1); + let window_align = align.max(crate::IO_ALIGN); + let mut ranges = Vec::with_capacity(e.segments.len()); + let (mut base, mut device) = (0usize, 0u64); + for seg in &e.segments { + let astart = round_down(seg.start, align as u64); + let off = (seg.start - astart) as usize; + let need = off + seg.len as usize; + let window = round_up(need, align); + if base + window > buf.len() { + return Err(ReadError::TooLarge { + need: base + window, + cap: buf.len(), + }); + } + let w = &mut buf[base..base + window]; + let mut got = 0usize; + while got < need { + match dev.read_at(seg.shard, &mut w[got..], astart + got as u64) { + Ok(0) => break, + Ok(n) => got += n, + Err(err) if err.kind() == std::io::ErrorKind::Interrupted => {} + Err(err) => { + return Err(ReadError::Io(format!( + "read expert ({},{}): {err}", + e.layer, e.expert + ))) + } + } + } + if got < need { + return Err(ReadError::ShortRead { + expert: (e.layer, e.expert), + wanted: need, + got, + }); + } + ranges.push((base + off, seg.len as usize)); + device += got as u64; + base += round_up(window, window_align); + } + Ok((ranges, device)) +} diff --git a/crates/aien-heartbeat/src/residency.rs b/crates/aien-heartbeat/src/residency.rs new file mode 100644 index 00000000..298b5ae9 --- /dev/null +++ b/crates/aien-heartbeat/src/residency.rs @@ -0,0 +1,405 @@ +//! Bounded expert residency (Expert Ribbon P2, sc#630): which (layer, expert) lives in which GPU slot, +//! who is using it, and which slot to reuse next. Host-only; the GPU side is behind +//! [`crate::pager::SlotBackend`]. +//! +//! Slot life cycle (one slot = one gate|up slot + one down slot on the device): +//! ```text +//! FREE --acquire(miss)--> FETCHING(id) --fetched(ver)--> READY(id, ver) pinned by the requester +//! FETCHING(id) --fetch_failed--> FREE (nothing published) +//! READY, pins > 0 = IN USE (never chosen as a victim) +//! READY, pins == 0 = EVICTABLE (least recently used one is reused on a miss) +//! ``` +//! Exactly the router's experts run: a miss waits for that expert or fails; nothing is substituted. +//! When every slot is pinned or fetching the request fails with [`Acquire::Exhausted`] (backpressure, explicit). + +use std::collections::HashMap; + +/// `(layer, expert)`. +pub type ExpertId = (u16, u16); + +/// Device versions of one slot pair (omega_gpu_fp8_slots versions of the gate|up and the down slot). +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub struct SlotVersion { + pub gate_up: u64, + pub down: u64, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum State { + Free, + Fetching(ExpertId), + Ready(ExpertId, SlotVersion), +} + +#[derive(Debug, Clone, Copy)] +struct Slot { + state: State, + pins: u32, + last_use: u64, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum Acquire { + /// Resident: pinned for the caller. + Hit { slot: u32, ver: SlotVersion }, + /// Not resident: `slot` is reserved (FETCHING) for the caller, who must call `fetched` or `fetch_failed`. + Fetch { + slot: u32, + evicted: Option, + }, + /// Another request is fetching this expert right now. + Pending, + /// Every slot is pinned or fetching. + Exhausted, +} + +#[derive(Debug, Clone, Default, PartialEq, Eq)] +pub struct ResidencyStats { + pub hits: u64, + pub misses: u64, + pub evictions: u64, + pub fetch_failures: u64, + pub exhausted: u64, + pub pinned_high: u32, +} + +#[derive(Debug)] +pub struct Residency { + slots: Vec, + map: HashMap, + tick: u64, + pinned: u32, + stats: ResidencyStats, +} + +impl Residency { + pub fn new(slots: usize) -> Self { + assert!(slots > 0 && slots <= u32::MAX as usize); + Self { + slots: vec![ + Slot { + state: State::Free, + pins: 0, + last_use: 0, + }; + slots + ], + map: HashMap::new(), + tick: 0, + pinned: 0, + stats: ResidencyStats::default(), + } + } + + pub fn capacity(&self) -> usize { + self.slots.len() + } + + pub fn stats(&self) -> ResidencyStats { + self.stats.clone() + } + + /// Experts currently READY (resident). + pub fn resident(&self) -> usize { + self.slots + .iter() + .filter(|s| matches!(s.state, State::Ready(..))) + .count() + } + + /// Slot and version of `id` if READY (no pin taken). + pub fn lookup(&self, id: ExpertId) -> Option<(u32, SlotVersion)> { + let s = *self.map.get(&id)?; + match self.slots[s as usize].state { + State::Ready(_, v) => Some((s, v)), + _ => None, + } + } + + pub fn pins(&self, slot: u32) -> u32 { + self.slots[slot as usize].pins + } + + fn pin(&mut self, slot: u32) { + self.tick += 1; + let s = &mut self.slots[slot as usize]; + s.pins += 1; + s.last_use = self.tick; + self.pinned += 1; + self.stats.pinned_high = self.stats.pinned_high.max(self.pinned); + } + + pub fn acquire(&mut self, id: ExpertId) -> Acquire { + if let Some(&slot) = self.map.get(&id) { + return match self.slots[slot as usize].state { + State::Ready(_, ver) => { + self.pin(slot); + self.stats.hits += 1; + Acquire::Hit { slot, ver } + } + State::Fetching(_) => Acquire::Pending, + State::Free => unreachable!("map points at a free slot"), + }; + } + // Victim: a free slot first, else the least recently used unpinned READY slot. + let victim = self + .slots + .iter() + .position(|s| s.state == State::Free) + .or_else(|| { + self.slots + .iter() + .enumerate() + .filter(|(_, s)| s.pins == 0 && matches!(s.state, State::Ready(..))) + .min_by_key(|(_, s)| s.last_use) + .map(|(i, _)| i) + }); + let Some(v) = victim else { + self.stats.exhausted += 1; + return Acquire::Exhausted; + }; + let evicted = match self.slots[v].state { + State::Ready(old, _) => { + self.map.remove(&old); + self.stats.evictions += 1; + Some(old) + } + _ => None, + }; + self.slots[v].state = State::Fetching(id); + self.map.insert(id, v as u32); + self.stats.misses += 1; + Acquire::Fetch { + slot: v as u32, + evicted, + } + } + + /// The fetch into `slot` completed and was published at `ver`: READY, pinned for the requester. + pub fn fetched(&mut self, slot: u32, ver: SlotVersion) { + let State::Fetching(id) = self.slots[slot as usize].state else { + panic!("fetched on a slot that is not fetching"); + }; + self.slots[slot as usize].state = State::Ready(id, ver); + self.pin(slot); + } + + /// The fetch into `slot` failed: the slot is FREE, the expert is not resident. + pub fn fetch_failed(&mut self, slot: u32) { + let State::Fetching(id) = self.slots[slot as usize].state else { + panic!("fetch_failed on a slot that is not fetching"); + }; + self.map.remove(&id); + self.slots[slot as usize].state = State::Free; + self.stats.fetch_failures += 1; + } + + pub fn release(&mut self, slot: u32) { + let s = &mut self.slots[slot as usize]; + assert!(s.pins > 0, "release without a pin"); + s.pins -= 1; + self.pinned -= 1; + } + + /// Total pins outstanding (0 between requests). + pub fn pinned(&self) -> u32 { + self.pinned + } +} + +/// Memory ledger for admitting expert slots (sc#630): everything else is budgeted first, slots get what is +/// left, and a request for more is refused rather than assumed. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct MemoryBudget { + /// MemAvailable at load time (bytes). + pub available: u64, + /// Kept free for the OS, the driver and other processes. + pub headroom: u64, + /// Resident non-expert weights (attention, router, lm_head, host embedding). + pub non_expert: u64, + /// KV cache at the configured max context. + pub kv: u64, + /// Launch scratch, staging buffers and other transients. + pub scratch: u64, +} + +impl MemoryBudget { + pub fn for_slots(&self) -> u64 { + self.available + .saturating_sub(self.headroom) + .saturating_sub(self.non_expert) + .saturating_sub(self.kv) + .saturating_sub(self.scratch) + } + + /// Admits `want` slots of `slot_bytes` each, or refuses with the ledger. + pub fn admit(&self, want: usize, slot_bytes: u64) -> Result<(), String> { + let need = want as u64 * slot_bytes; + if need > self.for_slots() { + return Err(format!( + "expert slots need {need} bytes ({want} x {slot_bytes}) but only {} are left: available {} - headroom {} - non-expert {} - kv {} - scratch {}", + self.for_slots(), + self.available, + self.headroom, + self.non_expert, + self.kv, + self.scratch + )); + } + Ok(()) + } +} + +/// `MemAvailable` from /proc/meminfo, bytes. +pub fn mem_available() -> Option { + let s = std::fs::read_to_string("/proc/meminfo").ok()?; + let l = s.lines().find(|l| l.starts_with("MemAvailable:"))?; + let kb: u64 = l.split_whitespace().nth(1)?.parse().ok()?; + Some(kb * 1024) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn v(n: u64) -> SlotVersion { + SlotVersion { + gate_up: n, + down: n + 1000, + } + } + + fn load(r: &mut Residency, id: ExpertId, n: u64) -> u32 { + match r.acquire(id) { + Acquire::Fetch { slot, .. } => { + r.fetched(slot, v(n)); + slot + } + other => panic!("{other:?}"), + } + } + + #[test] + fn miss_then_hit_and_release() { + let mut r = Residency::new(2); + let s = load(&mut r, (0, 5), 1); + assert_eq!(r.pins(s), 1); + r.release(s); + assert_eq!(r.acquire((0, 5)), Acquire::Hit { slot: s, ver: v(1) }); + r.release(s); + assert_eq!(r.stats().hits, 1); + assert_eq!(r.stats().misses, 1); + assert_eq!(r.pinned(), 0); + } + + #[test] + fn lru_eviction_order_and_layer_crossing_identities() { + let mut r = Residency::new(3); + for (i, id) in [(0, 1), (1, 1), (2, 1)].into_iter().enumerate() { + let s = load(&mut r, id, i as u64 + 1); + r.release(s); + } + // touch (0,1) so (1,1) is the least recent + let Acquire::Hit { slot, .. } = r.acquire((0, 1)) else { + panic!() + }; + r.release(slot); + match r.acquire((3, 1)) { + Acquire::Fetch { evicted, slot } => { + assert_eq!( + evicted, + Some((1, 1)), + "same expert number, other layer: distinct ids" + ); + r.fetched(slot, v(9)); + r.release(slot); + } + o => panic!("{o:?}"), + } + assert!(r.lookup((1, 1)).is_none()); + assert!(r.lookup((0, 1)).is_some() && r.lookup((2, 1)).is_some()); + assert_eq!(r.stats().evictions, 1); + } + + #[test] + fn pinned_slots_are_never_evicted_and_exhaustion_is_explicit() { + let mut r = Residency::new(2); + let a = load(&mut r, (0, 0), 1); + let b = load(&mut r, (0, 1), 2); + assert_eq!(r.acquire((0, 2)), Acquire::Exhausted); + assert_eq!(r.stats().exhausted, 1); + r.release(b); + match r.acquire((0, 2)) { + Acquire::Fetch { slot, evicted } => { + assert_eq!((slot, evicted), (b, Some((0, 1)))); + r.fetched(slot, v(3)); + r.release(slot); + } + o => panic!("{o:?}"), + } + assert_eq!(r.lookup((0, 0)).map(|x| x.0), Some(a), "pinned slot kept"); + r.release(a); + } + + #[test] + fn simultaneous_readers_share_a_slot() { + let mut r = Residency::new(1); + let s = load(&mut r, (4, 4), 1); + assert!(matches!(r.acquire((4, 4)), Acquire::Hit { .. })); + assert_eq!(r.pins(s), 2); + assert_eq!(r.acquire((4, 5)), Acquire::Exhausted); + r.release(s); + assert_eq!( + r.acquire((4, 5)), + Acquire::Exhausted, + "one reader still holds it" + ); + r.release(s); + assert!(matches!(r.acquire((4, 5)), Acquire::Fetch { .. })); + } + + #[test] + fn fetching_is_pending_for_others_and_failure_recovers() { + let mut r = Residency::new(2); + let Acquire::Fetch { slot, .. } = r.acquire((1, 2)) else { + panic!() + }; + assert_eq!(r.acquire((1, 2)), Acquire::Pending); + r.fetch_failed(slot); + assert!(r.lookup((1, 2)).is_none()); + assert_eq!(r.stats().fetch_failures, 1); + let s2 = load(&mut r, (1, 2), 7); + assert_eq!(r.lookup((1, 2)), Some((s2, v(7)))); + r.release(s2); + } + + #[test] + fn aba_reuse_gets_new_versions() { + // The same slot holds (0,0), then (0,1), then (0,0) again: the backend version differs each time, + // so a stale (slot, version) handle from the first load can never match the third. + let mut r = Residency::new(1); + let s = load(&mut r, (0, 0), 1); + r.release(s); + let s1 = load(&mut r, (0, 1), 2); + r.release(s1); + let s2 = load(&mut r, (0, 0), 3); + assert_eq!((s, s1, s2), (0, 0, 0)); + assert_eq!(r.lookup((0, 0)), Some((0, v(3)))); + r.release(s2); + } + + #[test] + fn budget_admits_and_refuses() { + let b = MemoryBudget { + available: 100, + headroom: 10, + non_expert: 20, + kv: 30, + scratch: 5, + }; + assert_eq!(b.for_slots(), 35); + assert!(b.admit(7, 5).is_ok()); + let e = b.admit(8, 5).unwrap_err(); + assert!(e.contains("need 40"), "{e}"); + } +} diff --git a/crates/aien-heartbeat/tests/ribbon_store.rs b/crates/aien-heartbeat/tests/ribbon_store.rs new file mode 100644 index 00000000..dbe028e9 --- /dev/null +++ b/crates/aien-heartbeat/tests/ribbon_store.rs @@ -0,0 +1,831 @@ +//! Expert Ribbon P1/P2 host tests (sc#629, sc#630): FP8 expert layout, bounded verified read adapter with +//! injected faults, residency through the pager with a fake GPU backend. Synthetic checkpoint with the real +//! Qwen3 FP8 names, dtypes and shapes (hidden 256, moe intermediate 128), F8 tensors first then the BF16 +//! scales, as safetensors groups them, so every expert is two segments. + +use std::collections::{BTreeMap, HashMap}; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::{mpsc, Arc, Mutex}; +use std::time::Duration; + +use aien_heartbeat::{ + ExpertId, ExpertLayout, ExpertPager, ExpertParts, ExpertShape, FakeShards, Fault, FileShards, + Manifest, PagerError, ReadAdapter, ReadConfig, ReadError, SlotBackend, SlotVersion, +}; + +const L: u16 = 3; +const E: u16 = 4; +const SHAPE: ExpertShape = ExpertShape { + hidden: 256, + inter: 128, +}; + +fn tmpdir(tag: &str) -> PathBuf { + let d = std::env::temp_dir().join(format!("aien-ribbon-{tag}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&d); + std::fs::create_dir_all(&d).unwrap(); + d +} + +fn byte(l: u16, e: u16, p: usize, k: usize) -> u8 { + ((l as usize * 131 + e as usize * 17 + p * 7 + k * 13) % 251) as u8 +} + +/// (name, dtype, shape, bytes) for one expert's six tensors. +fn expert_tensors(l: u16, e: u16) -> Vec<(String, &'static str, Vec, Vec)> { + let (h, i) = (SHAPE.hidden, SHAPE.inter); + let mut v = Vec::new(); + for (p, (proj, shape)) in [ + ("gate_proj", [i, h]), + ("up_proj", [i, h]), + ("down_proj", [h, i]), + ] + .into_iter() + .enumerate() + { + let n = (shape[0] * shape[1]) as usize; + v.push(( + format!("model.layers.{l}.mlp.experts.{e}.{proj}.weight"), + "F8_E4M3", + shape.to_vec(), + (0..n).map(|k| byte(l, e, p, k)).collect(), + )); + let sshape = [shape[0] / 128, shape[1] / 128]; + let sn = (sshape[0] * sshape[1]) as usize; + v.push(( + format!("model.layers.{l}.mlp.experts.{e}.{proj}.weight_scale_inv"), + "BF16", + sshape.to_vec(), + (0..sn) + .flat_map(|k| (0x3C00u16 + (l * 8 + e) + k as u16 + p as u16).to_le_bytes()) + .collect(), + )); + } + v +} + +/// One shard: all F8 tensors sorted by name, then all BF16 tensors sorted by name (safetensors' grouping). +fn write_model(dir: &Path) -> Vec { + let mut all: Vec<(String, &str, Vec, Vec)> = Vec::new(); + for l in 0..L { + for e in 0..E { + all.extend(expert_tensors(l, e)); + } + } + all.push(( + "model.norm.weight".into(), + "BF16", + vec![256], + vec![1u8; 512], + )); + all.sort_by(|a, b| (a.1 != "F8_E4M3", &a.0).cmp(&(b.1 != "F8_E4M3", &b.0))); + let mut header = serde_json::Map::new(); + let mut data = Vec::new(); + let mut weight_map = BTreeMap::new(); + for (name, dtype, shape, bytes) in &all { + let a = data.len(); + data.extend(bytes); + header.insert( + name.clone(), + serde_json::json!({"dtype": dtype, "shape": shape, "data_offsets": [a, data.len()]}), + ); + weight_map.insert(name.clone(), "model-00001-of-00001.safetensors".to_string()); + } + let h = serde_json::to_vec(&header).unwrap(); + let mut file = (h.len() as u64).to_le_bytes().to_vec(); + file.extend(&h); + file.extend(&data); + std::fs::write(dir.join("model-00001-of-00001.safetensors"), &file).unwrap(); + std::fs::write( + dir.join("model.safetensors.index.json"), + serde_json::to_vec(&serde_json::json!({"metadata": {}, "weight_map": weight_map})).unwrap(), + ) + .unwrap(); + file +} + +/// What the resident loader uploads for one expert, built straight from the tensors (the oracle). +fn oracle(l: u16, e: u16) -> (Vec, Vec, Vec, Vec) { + let t = expert_tensors(l, e); + let get = |suffix: &str| t.iter().find(|x| x.0.ends_with(suffix)).unwrap().3.clone(); + let words = |b: Vec| -> Vec { + b.as_chunks::<2>() + .0 + .iter() + .map(|c| u16::from_le_bytes(*c)) + .collect() + }; + let mut gu = get("gate_proj.weight"); + gu.extend(get("up_proj.weight")); + let mut gus = words(get("gate_proj.weight_scale_inv")); + gus.extend(words(get("up_proj.weight_scale_inv"))); + ( + gu, + gus, + get("down_proj.weight"), + words(get("down_proj.weight_scale_inv")), + ) +} + +fn setup(tag: &str) -> (PathBuf, Arc, Vec) { + let d = tmpdir(tag); + let file = write_model(&d); + let m = Arc::new(Manifest::build(&d).unwrap()); + (d, m, file) +} + +fn fake(file: &[u8], latency: Duration) -> Arc { + Arc::new(FakeShards::new(vec![file.to_vec()], latency)) +} + +fn idx(m: &Manifest, id: ExpertId) -> usize { + m.experts + .iter() + .position(|e| (e.layer, e.expert) == id) + .unwrap() +} + +// ---------------- sc#629: layout, index, verified reads ---------------- + +#[test] +fn manifest_has_a_content_model_digest_and_two_segments_per_expert() { + let (d, m, _) = setup("digest"); + assert_eq!(m.experts.len(), (L * E) as usize); + assert!(m.experts.iter().all(|e| e.segments.len() == 2)); + assert_eq!(m.model_digest.len(), 64); + // Same bytes -> same digest; one weight byte changed -> different model digest. + assert_eq!(Manifest::build(&d).unwrap().model_digest, m.model_digest); + let p = d.join("model-00001-of-00001.safetensors"); + let mut f = std::fs::read(&p).unwrap(); + let off = m.experts[5].segments[0].start as usize + 3; + f[off] ^= 1; + std::fs::write(&p, &f).unwrap(); + let m2 = Manifest::build(&d).unwrap(); + assert_ne!(m2.model_digest, m.model_digest); + assert_ne!(m2.experts[5].digest, m.experts[5].digest); +} + +#[test] +fn every_expert_round_trips_byte_for_byte_through_a_verified_random_read() { + let (d, m, _) = setup("roundtrip"); + let dev = Arc::new(FileShards::open(&m.shard_paths(), false).unwrap()); + let r = ReadAdapter::new( + m.clone(), + dev, + ReadConfig { + workers: 3, + queue_depth: 4, + }, + ); + // Random order, not layer order: (2,1), (0,3), (1,0), ... + let order: Vec = (0..L * E) + .map(|k| ((k * 7 % (L * E)) / E, (k * 7 % (L * E)) % E)) + .collect(); + for id in order { + let i = idx(&m, id); + let v = r.submit(i).unwrap().wait(Duration::from_secs(5)).unwrap(); + assert_eq!((v.layer, v.expert), id); + let layout = ExpertLayout::for_entry(&m.experts[i], SHAPE).unwrap(); + let parts = layout.parts(&v.payload()).unwrap(); + let (gu, gus, dn, dns) = oracle(id.0, id.1); + assert_eq!(&*parts.gate_up_w, &gu[..], "{id:?} gate|up weights"); + assert!( + matches!(parts.gate_up_w, std::borrow::Cow::Borrowed(_)), + "gate and up adjacent: no copy" + ); + assert_eq!(parts.gate_up_s, gus); + assert_eq!(&*parts.down_w, &dn[..]); + assert_eq!(parts.down_s, dns); + } + assert_eq!(r.stats().reads_ok, (L * E) as u64); + let _ = std::fs::remove_dir_all(d); +} + +#[test] +fn layout_refuses_wrong_shape_and_missing_tensor() { + let (_, m, _) = setup("layout"); + let e = &m.experts[0]; + let bad = ExpertShape { + hidden: 256, + inter: 256, + }; + assert!(ExpertLayout::for_entry(e, bad).is_err()); + let mut e2 = e.clone(); + e2.tensors.retain(|t| !t.name.ends_with("up_proj.weight")); + let err = ExpertLayout::for_entry(&e2, SHAPE).unwrap_err().to_string(); + assert!(err.contains("5 tensors"), "{err}"); + let mut e3 = e.clone(); + e3.tensors[0].dtype = "BF16".into(); + assert!(ExpertLayout::for_entry(&e3, SHAPE).is_err()); +} + +fn adapter(m: &Arc, dev: Arc, depth: usize) -> ReadAdapter { + ReadAdapter::new( + m.clone(), + dev, + ReadConfig { + workers: 2, + queue_depth: depth, + }, + ) +} + +#[test] +fn eio_short_read_eof_and_corruption_return_explicit_errors_and_free_the_buffer() { + let (_, m, file) = setup("faults"); + let dev = fake(&file, Duration::ZERO); + let r = adapter(&m, dev.clone(), 1); + let w = Duration::from_secs(5); + dev.fault_at(0, Fault::Eio); + assert!(matches!( + r.submit(0).unwrap().wait(w), + Err(ReadError::Io(_)) + )); + // Short read then EOF on the same segment. + let c = dev.calls(); + dev.fault_at(c, Fault::Short(100)); + assert!(matches!( + r.submit(1).unwrap().wait(w), + Err(ReadError::ShortRead { .. }) + )); + let c = dev.calls(); + dev.fault_at(c + 1, Fault::Flip); // second segment (scales) corrupted + assert!(matches!( + r.submit(2).unwrap().wait(w), + Err(ReadError::DigestMismatch { expert: (0, 2) }) + )); + // Depth 1: the single staging buffer came back after every failure. + let ok = r.submit(3).unwrap().wait(w).unwrap(); + assert_eq!((ok.layer, ok.expert), (0, 3)); + assert_eq!(r.stats().errors, 3); +} + +#[test] +fn bounded_queue_refuses_when_every_staging_buffer_is_in_use() { + let (_, m, file) = setup("bounded"); + let r = adapter(&m, fake(&file, Duration::ZERO), 2); + let w = Duration::from_secs(5); + let a = r.submit(0).unwrap().wait(w).unwrap(); + let b = r.submit(1).unwrap().wait(w).unwrap(); + assert_eq!(r.submit(2).err(), Some(ReadError::QueueFull)); + drop(a); + let c = r.submit(2).unwrap().wait(w).unwrap(); + assert_eq!(c.expert, 2); + drop((b, c)); + assert!(r.stats().queue_full >= 1); +} + +#[test] +fn stalled_read_hits_the_deadline_and_cancel_skips_queued_work() { + let (_, m, file) = setup("stall"); + let dev = fake(&file, Duration::ZERO); + let r = ReadAdapter::new( + m.clone(), + dev.clone(), + ReadConfig { + workers: 1, + queue_depth: 3, + }, + ); + let (tx, rx) = mpsc::channel(); + dev.fault_at(0, Fault::Stall(rx)); + let stalled = r.submit(0).unwrap(); + let queued = r.submit(1).unwrap(); // behind the stalled one (one worker) + queued.cancel(); + assert_eq!( + stalled.wait(Duration::from_millis(50)).err(), + Some(ReadError::Deadline) + ); + tx.send(()).unwrap(); // the NVMe "recovers"; its result is discarded + assert_eq!( + queued.wait(Duration::from_secs(5)).err(), + Some(ReadError::Cancelled) + ); + // Every buffer returns: three more reads fit. + let w = Duration::from_secs(5); + let held: Vec<_> = (2..5) + .map(|i| r.submit_wait(i, w).unwrap().wait(w).unwrap()) + .collect(); + assert_eq!(held.len(), 3); +} + +#[test] +fn shutdown_with_reads_in_flight_is_deterministic() { + let (_, m, file) = setup("shutdown"); + let r = adapter(&m, fake(&file, Duration::from_millis(5)), 4); + let ts: Vec<_> = (0..4).map(|i| r.submit(i).unwrap()).collect(); + drop(r); // joins the workers after the queue drains + for t in ts { + // finished before shutdown, or the reply channel closed: never a hang, never a partial result + match t.wait(Duration::from_secs(5)) { + Ok(v) => assert!(!v.payload().is_empty()), + Err(e) => assert_eq!(e, ReadError::Shutdown), + } + } +} + +// ---------------- sc#630: pager + residency with a fake GPU backend ---------------- + +/// (expert, gate|up weights, gate|up scales, down weights, down scales) held by one fake slot pair. +type SlotBytes = (ExpertId, Vec, Vec, Vec, Vec); + +/// Host stand-in for the two omega slot pools: keeps the bytes per slot and versions like the chip API. +struct FakeBackend { + slots: usize, + data: Mutex>, + next: AtomicU64, + fail_on: Mutex>, + loads: AtomicU64, +} + +impl FakeBackend { + fn new(slots: usize) -> Arc { + Arc::new(Self { + slots, + data: Mutex::new(HashMap::new()), + next: AtomicU64::new(1), + fail_on: Mutex::new(None), + loads: AtomicU64::new(0), + }) + } +} + +impl SlotBackend for FakeBackend { + fn slots(&self) -> usize { + self.slots + } + fn load(&self, slot: u32, id: ExpertId, p: &ExpertParts<'_>) -> Result { + if *self.fail_on.lock().unwrap() == Some(id) { + return Err("injected GPU copy failure".into()); + } + self.loads.fetch_add(1, Ordering::Relaxed); + self.data.lock().unwrap().insert( + slot, + ( + id, + p.gate_up_w.to_vec(), + p.gate_up_s.clone(), + p.down_w.to_vec(), + p.down_s.clone(), + ), + ); + let v = self.next.fetch_add(2, Ordering::Relaxed); + Ok(SlotVersion { + gate_up: v, + down: v + 1, + }) + } +} + +fn pager(m: &Arc, file: &[u8], slots: usize) -> (ExpertPager, Arc) { + let be = FakeBackend::new(slots); + let r = ReadAdapter::new( + m.clone(), + fake(file, Duration::ZERO), + ReadConfig { + workers: 4, + queue_depth: 8, + }, + ); + let p = ExpertPager::new(m.clone(), SHAPE, r, be.clone(), Duration::from_secs(5)).unwrap(); + (p, be) +} + +#[test] +fn pager_pins_exactly_the_routed_experts_and_slots_hold_their_bytes() { + let (_, m, file) = setup("pager"); + let (p, be) = pager(&m, &file, 6); + let want = [3u16, 0, 2]; + let pin = p.ensure(1, &want).unwrap(); + assert_eq!(pin.slots.len(), 3); + { + let d = be.data.lock().unwrap(); + for (k, &s) in pin.slots.iter().enumerate() { + let (id, gu, gus, dn, dns) = &d[&s]; + assert_eq!(*id, (1, want[k]), "router order kept"); + assert_eq!( + (gu, gus, dn, dns), + ( + &oracle(1, want[k]).0, + &oracle(1, want[k]).1, + &oracle(1, want[k]).2, + &oracle(1, want[k]).3 + ) + ); + } + } + assert_eq!(p.pinned(), 3); + p.release(&pin); + assert_eq!(p.pinned(), 0); + // Same request again: all hits, no new loads, same slots and versions. + let again = p.ensure(1, &want).unwrap(); + assert_eq!(again, pin); + p.release(&again); + assert_eq!(be.loads.load(Ordering::Relaxed), 3); + let s = p.stats(); + assert_eq!((s.experts_missed, s.experts_hit), (3, 3)); +} + +#[test] +fn cache_pressure_evicts_lru_never_a_pinned_slot() { + let (_, m, file) = setup("pressure"); + let (p, be) = pager(&m, &file, 4); + let a = p.ensure(0, &[0, 1]).unwrap(); // held + let b = p.ensure(1, &[0, 1]).unwrap(); + p.release(&b); + // 2 free-able slots left (layer 1); layer 2 needs 2: evicts layer 1, not layer 0 (pinned) + let c = p.ensure(2, &[2, 3]).unwrap(); + assert!(c.slots.iter().all(|s| !a.slots.contains(s))); + assert_eq!(p.residency_stats().evictions, 2); + // Everything pinned now: a third request cannot be served, and says so. + match p.ensure(0, &[3]) { + Err(PagerError::Exhausted { capacity: 4, .. }) => {} + o => panic!("{o:?}"), + } + assert_eq!(p.pinned(), 4, "the failed request left nothing pinned"); + p.release(&a); + p.release(&c); + // Repeated layer-crossing churn keeps bytes right. + for round in 0..20u16 { + let l = round % L; + let ex = [(round % E), ((round + 1) % E)]; + let pin = p.ensure(l, &ex).unwrap(); + let d = be.data.lock().unwrap(); + for (k, s) in pin.slots.iter().enumerate() { + assert_eq!(d[s].0, (l, ex[k])); + assert_eq!(d[s].1, oracle(l, ex[k]).0); + } + drop(d); + p.release(&pin); + } + assert_eq!(p.pinned(), 0); +} + +#[test] +fn a_failed_fetch_fails_closed_and_recovers() { + let (_, m, file) = setup("failclosed"); + let (p, be) = pager(&m, &file, 4); + *be.fail_on.lock().unwrap() = Some((2, 1)); + match p.ensure(2, &[0, 1, 2]) { + Err(PagerError::Backend { id: (2, 1), .. }) => {} + o => panic!("{o:?}"), + } + assert_eq!( + p.pinned(), + 0, + "the good experts of the failed request were released" + ); + assert_eq!( + p.resident(), + 2, + "experts that did load stay resident and correct" + ); + *be.fail_on.lock().unwrap() = None; + let ok = p.ensure(2, &[0, 1, 2]).unwrap(); + p.release(&ok); + assert_eq!(p.resident(), 3); +} + +#[test] +fn corrupt_checkpoint_bytes_never_reach_a_slot() { + let (_, m, file) = setup("corrupt"); + let be = FakeBackend::new(4); + let dev = fake(&file, Duration::ZERO); + dev.fault_at(0, Fault::Flip); + let r = ReadAdapter::new( + m.clone(), + dev, + ReadConfig { + workers: 1, + queue_depth: 2, + }, + ); + let p = ExpertPager::new(m.clone(), SHAPE, r, be.clone(), Duration::from_secs(5)).unwrap(); + match p.ensure(0, &[1]) { + Err(PagerError::Read { + err: ReadError::DigestMismatch { .. }, + .. + }) => {} + o => panic!("{o:?}"), + } + assert_eq!(be.loads.load(Ordering::Relaxed), 0); + assert_eq!(p.resident(), 0); +} + +#[test] +fn simultaneous_requests_share_slots_and_wait_for_in_flight_fetches() { + let (_, m, file) = setup("concurrent"); + let (p, be) = pager(&m, &file, 8); + let p = Arc::new(p); + let hs: Vec<_> = (0..4) + .map(|_| { + let p = p.clone(); + std::thread::spawn(move || { + let pin = p.ensure(1, &[0, 1, 2, 3]).unwrap(); + std::thread::sleep(Duration::from_millis(5)); + p.release(&pin); + pin + }) + }) + .collect(); + let pins: Vec<_> = hs.into_iter().map(|h| h.join().unwrap()).collect(); + assert!( + pins.windows(2).all(|w| w[0] == w[1]), + "everyone got the same slots and versions" + ); + assert_eq!( + be.loads.load(Ordering::Relaxed), + 4, + "each expert loaded once" + ); + assert_eq!(p.pinned(), 0); +} + +#[test] +#[cfg(feature = "ribbon-omega")] +fn omega_pipeline_keeps_router_positions_and_releases_after_callback_failure() { + let (_, m, file) = setup("omega-order"); + for buffers in [1, 2] { + let (p, be) = pager(&m, &file, 4); + let want = [3, 0, 2]; + let mut seen = vec![false; want.len()]; + p.for_each_ready(1, &want, buffers, |pos, slot, _| { + let d = be.data.lock().unwrap(); + assert_eq!(d[&slot].0, (1, want[pos])); + assert_eq!(d[&slot].1, oracle(1, want[pos]).0); + seen[pos] = true; + Ok(()) + }) + .unwrap(); + assert!(seen.into_iter().all(|x| x)); + assert_eq!(p.pinned(), 0); + assert!(p + .for_each_ready(2, &want, buffers, |_, _, _| Err("consumer failed".into())) + .is_err()); + assert_eq!(p.pinned(), 0); + p.for_each_ready(2, &want, buffers, |_, _, _| Ok(())) + .unwrap(); + assert_eq!(p.pinned(), 0); + let panicked = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let _ = p.for_each_ready(0, &want, buffers, |_, _, _| panic!("consumer panic")); + })); + assert!(panicked.is_err()); + assert_eq!(p.pinned(), 0, "panic must release pre-acquired pins"); + p.for_each_ready(0, &want, buffers, |_, _, _| Ok(())) + .unwrap(); + } +} + +#[test] +#[cfg(feature = "ribbon-omega")] +fn omega_pipeline_rejects_corrupt_reads_and_failed_device_copies() { + let (_, m, file) = setup("omega-failure"); + let dev = fake(&file, Duration::ZERO); + dev.fault_at(0, Fault::Flip); + let be = FakeBackend::new(4); + let reader = adapter(&m, dev, 2); + let p = ExpertPager::new(m.clone(), SHAPE, reader, be.clone(), Duration::from_secs(5)).unwrap(); + assert!(p + .for_each_ready(0, &[1], 2, |_, _, _| panic!("corrupt bytes published")) + .is_err()); + assert_eq!(be.loads.load(Ordering::Relaxed), 0); + assert_eq!(p.pinned(), 0); + *be.fail_on.lock().unwrap() = Some((0, 1)); + assert!(p + .for_each_ready(0, &[1], 2, |_, _, _| panic!("failed copy published")) + .is_err()); + assert_eq!(p.pinned(), 0); + *be.fail_on.lock().unwrap() = None; + p.for_each_ready(0, &[1], 2, |_, _, _| Ok(())).unwrap(); + assert_eq!(p.pinned(), 0); +} + +#[test] +fn pending_fetch_wait_has_a_deadline_even_when_its_owner_is_stalled() { + use std::sync::atomic::AtomicBool; + struct Stalled { + backend: Arc, + entered: Arc, + wait: Mutex>, + } + impl SlotBackend for Stalled { + fn slots(&self) -> usize { + self.backend.slots() + } + fn load( + &self, + slot: u32, + id: ExpertId, + parts: &ExpertParts<'_>, + ) -> Result { + self.entered.store(true, Ordering::Release); + self.wait.lock().unwrap().recv().unwrap(); + self.backend.load(slot, id, parts) + } + } + let (_, m, file) = setup("pending-deadline"); + let entered = Arc::new(AtomicBool::new(false)); + let (release, wait) = mpsc::channel(); + let backend = Arc::new(Stalled { + backend: FakeBackend::new(2), + entered: entered.clone(), + wait: Mutex::new(wait), + }); + let reader = adapter(&m, fake(&file, Duration::ZERO), 2); + let pager = + Arc::new(ExpertPager::new(m, SHAPE, reader, backend, Duration::from_millis(50)).unwrap()); + let owner_pager = pager.clone(); + let owner = std::thread::spawn(move || { + let pin = owner_pager.ensure(0, &[0]).unwrap(); + owner_pager.release(&pin); + }); + for _ in 0..1000 { + if entered.load(Ordering::Acquire) { + break; + } + std::thread::sleep(Duration::from_millis(1)); + } + let (send, recv) = mpsc::channel(); + let waiter_pager = pager.clone(); + let waiter = std::thread::spawn(move || { + let result = waiter_pager.ensure(0, &[0]); + let deadline = matches!( + result, + Err(PagerError::Read { + err: ReadError::Deadline, + .. + }) + ); + if let Ok(pin) = result { + waiter_pager.release(&pin); + } + send.send(deadline).unwrap(); + }); + let bounded = recv.recv_timeout(Duration::from_millis(500)); + release.send(()).unwrap(); + owner.join().unwrap(); + waiter.join().unwrap(); + assert_eq!( + bounded, + Ok(true), + "waiter must time out before the owner is released" + ); + assert_eq!(pager.pinned(), 0); +} + +#[cfg(feature = "ribbon-omega")] +#[test] +fn omega_one_buffer_serializes_and_two_buffers_prepare_next_during_consumption() { + for buffers in [1, 2] { + let (_, m, file) = setup(&format!("omega-overlap-{buffers}")); + let segments = m.experts[0].segments.len() as u64; + let dev = fake(&file, Duration::from_millis(1)); + let p = ExpertPager::new( + m.clone(), + SHAPE, + adapter(&m, dev.clone(), 2), + FakeBackend::new(4), + Duration::from_secs(2), + ) + .unwrap(); + let mut first = true; + p.for_each_ready(0, &[0, 1], buffers, |_, _, _| { + if first { + first = false; + if buffers == 1 { + assert_eq!( + dev.calls(), + segments, + "control must not start the next read" + ); + } else { + let until = std::time::Instant::now() + Duration::from_secs(1); + while dev.calls() < 2 * segments && std::time::Instant::now() < until { + std::thread::sleep(Duration::from_millis(1)); + } + assert_eq!( + dev.calls(), + 2 * segments, + "next read must progress while consumer holds the first expert" + ); + } + } + Ok(()) + }) + .unwrap(); + let calls = dev.calls(); + p.for_each_ready(0, &[0, 1], buffers, |_, _, _| Ok(())) + .unwrap(); + assert_eq!( + dev.calls(), + calls, + "cache hits perform no extra reads in either mode" + ); + assert_eq!(p.pinned(), 0); + } +} + +#[cfg(feature = "ribbon-omega")] +#[test] +fn omega_serial_control_does_not_overlap_cache_hits_with_miss_reads() { + for buffers in [1, 2] { + for reversed in [false, true] { + let (_, m, file) = setup(&format!("omega-mixed-{buffers}-{reversed}")); + let segments = m.experts[0].segments.len() as u64; + let dev = fake(&file, Duration::from_millis(2)); + let p = ExpertPager::new( + m.clone(), + SHAPE, + adapter(&m, dev.clone(), 2), + FakeBackend::new(4), + Duration::from_secs(2), + ) + .unwrap(); + p.for_each_ready(0, &[0], buffers, |_, _, _| Ok(())) + .unwrap(); + let before = dev.calls(); + let submitted = p.read_stats().reads_submitted; + let ids = if reversed { [1, 0] } else { [0, 1] }; + p.for_each_ready(0, &ids, buffers, |pos, _, _| { + if ids[pos] == 0 { + if buffers == 1 { + assert_eq!( + p.read_stats().reads_submitted, + submitted, + "no read may be queued before the cached consumer retires" + ); + } else { + assert_eq!( + p.read_stats().reads_submitted, + submitted + 1, + "two buffers must queue the miss before the cached consumer" + ); + } + } + Ok(()) + }) + .unwrap(); + assert_eq!(dev.calls(), before + segments); + assert_eq!(p.pinned(), 0); + } + } +} + +#[cfg(feature = "ribbon-omega")] +#[test] +fn late_copy_never_becomes_resident_and_retry_recovers() { + struct LateCopy(Arc); + impl SlotBackend for LateCopy { + fn slots(&self) -> usize { + self.0.slots() + } + fn load( + &self, + slot: u32, + id: ExpertId, + parts: &ExpertParts<'_>, + ) -> Result { + let ver = self.0.load(slot, id, parts)?; + if self.0.loads.load(Ordering::Relaxed) == 1 { + std::thread::sleep(Duration::from_millis(150)); + } + Ok(ver) + } + } + let (_, m, file) = setup("late-copy"); + let be = FakeBackend::new(2); + let reader = ReadAdapter::new( + m.clone(), + fake(&file, Duration::ZERO), + ReadConfig { + workers: 1, + queue_depth: 2, + }, + ); + let p = ExpertPager::new( + m, + SHAPE, + reader, + Arc::new(LateCopy(be.clone())), + Duration::from_millis(100), + ) + .unwrap(); + assert!(p + .for_each_ready(0, &[1], 1, |_, _, _| panic!("expired copy consumed")) + .is_err()); + assert_eq!( + be.loads.load(Ordering::Relaxed), + 1, + "copy actually completed" + ); + assert_eq!(p.resident(), 0, "expired copy must not be published"); + assert_eq!(p.pinned(), 0); + p.for_each_ready(0, &[1], 1, |_, _, _| Ok(())).unwrap(); + assert_eq!( + be.loads.load(Ordering::Relaxed), + 2, + "retry must reload, not hit expired publication" + ); + assert_eq!(p.pinned(), 0); +} diff --git a/crates/aien-inference-abi/Cargo.toml b/crates/aien-inference-abi/Cargo.toml index a177d1b9..950dc944 100644 --- a/crates/aien-inference-abi/Cargo.toml +++ b/crates/aien-inference-abi/Cargo.toml @@ -22,6 +22,7 @@ aien-omega-moe = { path = "../aien-omega-moe" } aien-omega-fp8 = { path = "../aien-omega-fp8" } aien-omega-dattn = { path = "../aien-omega-dattn" } aien-omega-router = { path = "../aien-omega-router" } +aien-heartbeat = { path = "../aien-heartbeat" } aien-omega-bf16 = { path = "../aien-omega-bf16" } aien-omega-pf = { path = "../aien-omega-pf" } aien-omega-dgraph = { path = "../aien-omega-dgraph" } @@ -33,6 +34,7 @@ regex-syntax = "0.8" [features] +ribbon-omega = ["aien-heartbeat/ribbon-omega"] # Off by default: a production build fails closed (no reference weights, no # silent CPU fallback behind the GPU backend). Only dev/test builds turn it on. dev-fallback = [] diff --git a/crates/aien-inference-abi/src/bin/own30b_check.rs b/crates/aien-inference-abi/src/bin/own30b_check.rs index e4bfdfca..2a4a4736 100644 --- a/crates/aien-inference-abi/src/bin/own30b_check.rs +++ b/crates/aien-inference-abi/src/bin/own30b_check.rs @@ -20,6 +20,7 @@ //! runs greedy continuations of the 4 fixed prompts, writes tokens and top-2 margins. //! own30b_check chip [--new N] [--layers 0,23,47] //! [--max-context 8192] [--prompts 1,2,3,4] [--force-memory] +//! [--paged-experts SLOTS [--manifest PATH] [--read-workers W] [--read-depth D]] //! [--weights bf16|fp8-experts|fp8] //! [--router auto|host|device] [--lm-head auto|dense|gemv] [--router-mutants 1,2,3,4] //! [--prefill auto|gemv|gemm] [--prefill-routing host|device] [--prefill-chunk N] @@ -40,12 +41,12 @@ use aien_inference_abi::qwen3_coder::{ compute_logits, forward_token, load_qwen3_coder, Qwen3CoderState, }; use aien_inference_abi::qwen3_moe::load_qwen3_fp8_moe_layer; -use aien_inference_abi::qwen3_moe_omega::dgraph; use aien_inference_abi::qwen3_moe_omega::{ current_rss_bytes, load_attention_layer_f32, peak_rss_bytes, replay_attention, replay_moe, AttnPath, DevicePaths, GenerateParams, LmHead, OmegaModelUploader, PathChoice, Qwen3MoeConfig, Qwen3MoeOmegaEngine, StepTiming, WeightFormat, }; +use aien_inference_abi::qwen3_moe_omega::{dgraph, ribbon}; use aien_inference_abi::tokenizer::ChatTokenizer as Tokenizer; const PROMPT_TEXTS: [(&str, &str); 4] = [ @@ -240,6 +241,11 @@ struct Args { gemm_mutants: Vec, /// Also run a prompt of at least this many tokens: chunk 1 against the batched chunk, tokens and hidden state. long_prompt: usize, + /// Expert Ribbon: page the experts into this many GPU slots (0 = all resident). + paged_slots: usize, + ribbon_manifest: PathBuf, + read_workers: usize, + read_depth: usize, } fn parse_choice(v: &str, host_word: &str, flag: &str) -> PathChoice { @@ -278,6 +284,10 @@ fn parse_args() -> Args { prefill_device_routing: false, gemm_mutants: vec![1, 2, 3], long_prompt: 0, + paged_slots: 0, + ribbon_manifest: std::env::temp_dir().join("aien-ribbon-manifest.json"), + read_workers: 16, + read_depth: 32, }; while let Some(arg) = it.next() { match arg.as_str() { @@ -344,6 +354,24 @@ fn parse_args() -> Args { ) } "--tokens-only" => a.tokens_only = true, + "--paged-experts" => { + a.paged_slots = it + .next() + .expect("--paged-experts SLOTS") + .parse() + .expect("number") + } + "--manifest" => a.ribbon_manifest = PathBuf::from(it.next().expect("--manifest PATH")), + "--read-workers" => { + a.read_workers = it + .next() + .expect("--read-workers N") + .parse() + .expect("number") + } + "--read-depth" => { + a.read_depth = it.next().expect("--read-depth N").parse().expect("number") + } "--whole-prompt" => a.whole_prompt = true, "--prefill-device-host" => a.wp_device_host = true, "--prefill" => { @@ -457,8 +485,24 @@ fn chip(a: &Args) { }; let avail = mem_available_gb(); say(format!("mem available before load: {avail:.1} GB")); - if avail < 70.0 && !a.force_memory { - say("REFUSED: less than 70 GB available (another model may be loaded); --force-memory to override".into()); + let config0 = Qwen3MoeConfig::from_checkpoint(&a.checkpoint).expect("config.json"); + // Paged experts: the slot pools (exact) plus a fixed 6 GB for attention, lm_head, KV and scratch. + let (h0, i0) = (config0.hidden, config0.moe_intermediate); + let pool_bytes = a.paged_slots * (3 * h0 * i0 + 4 * 3 * (h0 / 128) * (i0 / 128)); + let need_gb = if a.paged_slots > 0 { + pool_bytes as f64 / 1e9 + 6.0 + } else { + 70.0 + }; + if a.paged_slots > 0 { + say(format!( + "RIBBON: {} slots, pools {:.2} GB; memory gate {need_gb:.1} GB", + a.paged_slots, + pool_bytes as f64 / 1e9 + )); + } + if avail < need_gb && !a.force_memory { + say(format!("REFUSED: less than {need_gb:.1} GB available (another model may be loaded); --force-memory to override")); std::process::exit(3); } let golden: serde_json::Value = @@ -489,12 +533,32 @@ fn chip(a: &Args) { // ---- load ---- let t0 = Instant::now(); let mut n = 0usize; - let (mut engine, report) = Qwen3MoeOmegaEngine::load_omega_paths( + let paged = (a.paged_slots > 0).then(|| { + ribbon::open_omega( + &a.checkpoint, + h0, + i0, + &ribbon::RibbonOptions { + manifest: a.ribbon_manifest.clone(), + slots: a.paged_slots, + read: aien_heartbeat::ReadConfig { + workers: a.read_workers, + queue_depth: a.read_depth, + }, + direct: true, + read_deadline: std::time::Duration::from_secs(30), + }, + &mut |s| eprintln!(" {s}"), + ) + .expect("expert ribbon") + }); + let (mut engine, report) = Qwen3MoeOmegaEngine::load_omega_experts( &a.checkpoint, a.max_context, a.format, a.attn, a.paths, + paged.clone(), &mut |s| { n += 1; if n.is_multiple_of(20) || s.starts_with("kv") || s == "lm_head" { @@ -967,12 +1031,17 @@ fn chip(a: &Args) { let params = GenerateParams::greedy(a.new_tokens, config.eos_token_ids.clone()); // Start this prompt's timeline from zero (earlier sections also ran graph tokens). let _ = engine.take_decode_timeline(); + let rb0 = paged.as_ref().map(|p| (p.stats(), p.read_stats())); + let generation_start = Instant::now(); + let mut token_elapsed_ms = Vec::new(); let o = engine .generate(ids, ¶ms, &mut |t| { + token_elapsed_ms.push(generation_start.elapsed().as_secs_f64() * 1000.0); got.push(t); true }) .expect("generate"); + let generation_wall_ms = generation_start.elapsed().as_secs_f64() * 1000.0; // The golden list includes a final stop id when the CPU stopped; ours consumed it. let want_cmp: Vec = want .iter() @@ -1054,6 +1123,34 @@ fn chip(a: &Args) { per_graph(dt.graph_submits), per_graph(dt.graph_record_ns) / 1e3, )); + let mut ribbon_json = serde_json::Value::Null; + if let (Some(p), Some((s0, r0))) = (&paged, &rb0) { + let (s, r) = (p.stats(), p.read_stats()); + let hit = s.experts_hit - s0.experts_hit; + let miss = s.experts_missed - s0.experts_missed; + let bytes = s.bytes_loaded - s0.bytes_loaded; + let slot_ns = s.slot_load_ns - s0.slot_load_ns; + let read_ns = s.read_wait_ns - s0.read_wait_ns; + let miss_wall = s.miss_wall_ns - s0.miss_wall_ns; + let dev_bytes = r.device_bytes - r0.device_bytes; + say(format!( + " RIBBON {} slots: experts hit {hit} miss {miss} (hit rate {:.4}); loaded {bytes} B; miss wall {:.1} ms; per decode step page {:.2} ms; prefill page {:.1} ms; summed read wait {:.1} ms; summed slot load {:.1} ms; device read {dev_bytes} B; resident {}", + p.capacity(), + hit as f64 / (hit + miss).max(1) as f64, + miss_wall as f64 / 1e6, + dt.page_ns as f64 / steps / 1e6, + pt.page_ns as f64 / 1e6, + read_ns as f64 / 1e6, + slot_ns as f64 / 1e6, + p.resident(), + )); + ribbon_json = serde_json::json!({"slots": p.capacity(), "hit": hit, "miss": miss, + "bytes_loaded": bytes, "miss_wall_ns": miss_wall, "read_wait_ns": read_ns, + "read_syscall_ns": r.read_ns - r0.read_ns, "verify_ns": r.digest_ns - r0.digest_ns, + "reads_submitted": r.reads_submitted - r0.reads_submitted, + "slot_load_ns": slot_ns, "device_read_bytes": dev_bytes, "decode_page_ns": dt.page_ns, + "prefill_page_ns": pt.page_ns, "decode_steps": o.emitted_tokens}); + } let mut timeline_json = serde_json::Value::Null; if let Some(t) = engine.take_decode_timeline() { let lines = timeline_table(&t, &config); @@ -1072,7 +1169,9 @@ fn chip(a: &Args) { )); results.push(serde_json::json!({ "name": name, "prompt_tokens": ids.len(), "chip": got, "golden": want, "first_diff": first_diff, - "prefill_ms": o.prefill_ms, "decode_ms": o.decode_ms, "emitted": o.emitted_tokens, "tok_s": tok_s, + "prefill_ms": o.prefill_ms, "decode_ms": o.decode_ms, "emitted": o.emitted_tokens, "tok_s": tok_s, "ribbon": ribbon_json, + "first_visible_token_ms": token_elapsed_ms.first(), "token_elapsed_ms": token_elapsed_ms, + "generation_wall_ms": generation_wall_ms, "peak_rss_after_generation_bytes": peak_rss_bytes(), "per_step_ms": {"attention": dt.attention_ns as f64 / 1e6 / steps, "experts": dt.experts_ns as f64 / 1e6 / steps, "lm_head": dt.lm_head_ns as f64 / 1e6 / steps, "host": dt.host_ns as f64 / 1e6 / steps, "chip_reported": dt.chip_ns as f64 / 1e6 / steps, "launches": dt.launches as f64 / steps}, @@ -1140,6 +1239,7 @@ fn chip(a: &Args) { let doc = serde_json::json!({ "checkpoint": a.checkpoint.display().to_string(), "golden": a.golden.display().to_string(), + "native_identity": serde_json::from_str::(&aien_omega_gpu::native_identity().to_json()).expect("native identity JSON"), "engine": {"native": aien_omega_gpu::is_native(), "window_api": OmegaModelUploader::uses_window_api(), "fp8_api": OmegaModelUploader::uses_fp8_api(), "router_api": OmegaModelUploader::uses_router_api(), "bf16_api": OmegaModelUploader::uses_bf16_api(), "dattn_api": OmegaModelUploader::uses_dattn_api(), "weights": format!("{:?}", a.format), "attention": engine.attention_path(), "router": router_path, "lm_head": lm_head_path, "prefill_chunk": engine.prefill_chunk, "prefill_path": if engine.prefill_gemm { "gemm" } else { "gemv" }, "prefill_routing": if engine.prefill_device_routing { "device" } else { "host" }, diff --git a/crates/aien-inference-abi/src/qwen3_moe_omega.rs b/crates/aien-inference-abi/src/qwen3_moe_omega.rs index d51e7499..bb37e465 100644 --- a/crates/aien-inference-abi/src/qwen3_moe_omega.rs +++ b/crates/aien-inference-abi/src/qwen3_moe_omega.rs @@ -44,6 +44,8 @@ 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; +/// Expert Ribbon: FP8 experts paged from the NVMe into GPU slots (aienix#4, sc#632). +pub mod ribbon; pub mod w8a8_control; mod whole_prompt; @@ -1090,6 +1092,8 @@ pub enum ExpertWeights { gate_up: Arc, down: Arc, }, + /// FP8 experts paged from the NVMe into GPU slots (Expert Ribbon); one pool shared by all layers. + Paged(Arc), } /// The whole model: resident matmuls on the device, bf16 embedding and f32 norms/routers on the host. @@ -1235,6 +1239,65 @@ pub fn load_qwen3_moe_omega_from_paths( format: WeightFormat, paths: DevicePaths, progress: &mut dyn FnMut(&str), +) -> Result<(Qwen3MoeOmegaWeights, LoadReport), String> { + load_from_inner(config, source, uploader, format, paths, None, progress) +} + +/// As [`load_qwen3_moe_omega_from_paths`] with the experts paged (Expert Ribbon): no expert bytes are read +/// or uploaded; every layer gets [`ExpertWeights::Paged`] over the one shared slot pool. Needs FP8 experts. +pub fn load_qwen3_moe_omega_paged_from( + config: &Qwen3MoeConfig, + source: &mut dyn TensorSource, + uploader: &dyn ModelUploader, + format: WeightFormat, + paths: DevicePaths, + paged: Arc, + progress: &mut dyn FnMut(&str), +) -> Result<(Qwen3MoeOmegaWeights, LoadReport), String> { + if !format.fp8_experts() { + return Err("paged experts need FP8 experts (--weights fp8-experts or fp8)".into()); + } + load_from_inner( + config, + source, + uploader, + format, + paths, + Some(paged), + progress, + ) +} + +/// As [`load_qwen3_moe_omega_paged_from`] from a checkpoint directory. +pub fn load_qwen3_moe_omega_paged( + dir: &Path, + uploader: &dyn ModelUploader, + format: WeightFormat, + paths: DevicePaths, + paged: Arc, + progress: &mut dyn FnMut(&str), +) -> Result<(Qwen3MoeOmegaWeights, LoadReport), String> { + let config = Qwen3MoeConfig::from_checkpoint(dir)?; + let mut source = ShardSource::open(dir)?; + load_qwen3_moe_omega_paged_from( + &config, + &mut source, + uploader, + format, + paths, + paged, + progress, + ) +} + +fn load_from_inner( + config: &Qwen3MoeConfig, + source: &mut dyn TensorSource, + uploader: &dyn ModelUploader, + format: WeightFormat, + paths: DevicePaths, + paged: Option>, + progress: &mut dyn FnMut(&str), ) -> Result<(Qwen3MoeOmegaWeights, LoadReport), String> { config.validate()?; let device_router: Option> = if paths.router == PathChoice::Host { @@ -1263,10 +1326,18 @@ pub fn load_qwen3_moe_omega_from_paths( let qkv_n = config.qkv_n(); // Transient host buffers, sized once for the largest use and reused for every layer. - let mut bits: Vec = vec![0; h * config.gate_up_n().max(qkv_n).max(qd)]; - let mut fp8: Vec = vec![0; (e * 2 * i * h).max(qd * h + 2 * kvd * h)]; + let gu_cols = if paged.is_some() { + 0 + } else { + config.gate_up_n() + }; + let mut bits: Vec = vec![0; h * gu_cols.max(qkv_n).max(qd)]; + // Paged experts never pass through these buffers: size them for attention only. + let ex_bytes = if paged.is_some() { 0 } else { e * 2 * i * h }; + let ex_scales = if paged.is_some() { 0 } else { e * 2 * ib * kb }; + let mut fp8: Vec = vec![0; ex_bytes.max(qd * h + 2 * kvd * h)]; let mut scales: Vec = - vec![0; (e * 2 * ib * kb).max((qd / FP8_BLOCK + 2 * (kvd / FP8_BLOCK)) * kb)]; + vec![0; ex_scales.max((qd / FP8_BLOCK + 2 * (kvd / FP8_BLOCK)) * kb)]; let mut small: Vec = Vec::new(); let read_bf16_f32 = |source: &mut dyn TensorSource, @@ -1381,104 +1452,112 @@ pub fn load_qwen3_moe_omega_from_paths( }; progress(&format!("{p}.self_attn.o_proj")); - // --- experts gate|up: per expert gate [i][h] then up [i][h]; columns e*2i (gate), e*2i+i (up) --- - let gu_n = config.gate_up_n(); - for ex in 0..e { - for (j, proj) in ["gate_proj", "up_proj"].into_iter().enumerate() { - let w0 = (ex * 2 + j) * i * h; - let s0 = (ex * 2 + j) * ib * kb; - let base = format!("{p}.mlp.experts.{ex}.{proj}"); + // Expert Ribbon: no expert bytes are read here; the pager reads them on first use. + let experts = if let Some(pe) = &paged { + progress(&format!("{p}.mlp.experts paged")); + ExpertWeights::Paged(pe.clone()) + } else { + // --- experts gate|up: per expert gate [i][h] then up [i][h]; columns e*2i (gate), e*2i+i (up) --- + let gu_n = config.gate_up_n(); + for ex in 0..e { + for (j, proj) in ["gate_proj", "up_proj"].into_iter().enumerate() { + let w0 = (ex * 2 + j) * i * h; + let s0 = (ex * 2 + j) * ib * kb; + let base = format!("{p}.mlp.experts.{ex}.{proj}"); + source.read_into( + &format!("{base}.weight"), + "F8_E4M3", + &[i, h], + &mut fp8[w0..w0 + i * h], + )?; + read_scales( + source, + &format!("{base}.weight_scale_inv"), + &[ib, kb], + &mut scales[s0..s0 + ib * kb], + )?; + } + } + let sources: Vec = (0..e) + .flat_map(|ex| (0..2).map(move |j| (ex, j))) + .map(|(ex, j)| { + let w0 = (ex * 2 + j) * i * h; + let s0 = (ex * 2 + j) * ib * kb; + Fp8Source { + weights: &fp8[w0..w0 + i * h], + scales: &scales[s0..s0 + ib * kb], + rows: i, + col0: config.gate_up_col0(ex) + j * i, + } + }) + .collect(); + let gate_up_fp8 = if format.fp8_experts() { + // [e][2i][h] bytes with scales [e][2ib][kb]: the capsule GATE_UP layout, as the chip wants it. + resident += e * 2 * i * h + e * 2 * ib * kb * 4; + Some(uploader.upload_fp8( + e, + 2 * i, + h, + &fp8[..e * 2 * i * h], + &scales[..e * 2 * ib * kb], + )?) + } else { + None + }; + let gate_up = if gate_up_fp8.is_none() { + dequant_fp8_sources_to_bf16_cols(&sources, h, &mut bits[..h * gu_n], gu_n)?; + resident += 2 * h * gu_n; + Some(uploader.upload_experts(h, gu_n, &bits[..h * gu_n])?) + } else { + None + }; + progress(&format!("{p}.mlp.experts.gate_up")); + + // --- experts down: per expert [h][i]; columns e*h --- + let dn_n = config.down_n(); + for ex in 0..e { + let base = format!("{p}.mlp.experts.{ex}.down_proj"); source.read_into( &format!("{base}.weight"), "F8_E4M3", - &[i, h], - &mut fp8[w0..w0 + i * h], + &[h, i], + &mut fp8[ex * h * i..(ex + 1) * h * i], )?; read_scales( source, &format!("{base}.weight_scale_inv"), - &[ib, kb], - &mut scales[s0..s0 + ib * kb], + &[kb, ib], + &mut scales[ex * kb * ib..(ex + 1) * kb * ib], )?; } - } - let sources: Vec = (0..e) - .flat_map(|ex| (0..2).map(move |j| (ex, j))) - .map(|(ex, j)| { - let w0 = (ex * 2 + j) * i * h; - let s0 = (ex * 2 + j) * ib * kb; - Fp8Source { - weights: &fp8[w0..w0 + i * h], - scales: &scales[s0..s0 + ib * kb], - rows: i, - col0: config.gate_up_col0(ex) + j * i, + let sources: Vec = (0..e) + .map(|ex| Fp8Source { + weights: &fp8[ex * h * i..(ex + 1) * h * i], + scales: &scales[ex * kb * ib..(ex + 1) * kb * ib], + rows: h, + col0: config.down_col0(ex), + }) + .collect(); + let experts = if format.fp8_experts() { + resident += e * h * i + e * kb * ib * 4; + let down = + uploader.upload_fp8(e, h, i, &fp8[..e * h * i], &scales[..e * kb * ib])?; + ExpertWeights::Fp8 { + gate_up: gate_up_fp8.expect("fp8 gate_up"), + down, } - }) - .collect(); - let gate_up_fp8 = if format.fp8_experts() { - // [e][2i][h] bytes with scales [e][2ib][kb]: the capsule GATE_UP layout, as the chip wants it. - resident += e * 2 * i * h + e * 2 * ib * kb * 4; - Some(uploader.upload_fp8( - e, - 2 * i, - h, - &fp8[..e * 2 * i * h], - &scales[..e * 2 * ib * kb], - )?) - } else { - None - }; - let gate_up = if gate_up_fp8.is_none() { - dequant_fp8_sources_to_bf16_cols(&sources, h, &mut bits[..h * gu_n], gu_n)?; - resident += 2 * h * gu_n; - Some(uploader.upload_experts(h, gu_n, &bits[..h * gu_n])?) - } else { - None - }; - progress(&format!("{p}.mlp.experts.gate_up")); - - // --- experts down: per expert [h][i]; columns e*h --- - let dn_n = config.down_n(); - for ex in 0..e { - let base = format!("{p}.mlp.experts.{ex}.down_proj"); - source.read_into( - &format!("{base}.weight"), - "F8_E4M3", - &[h, i], - &mut fp8[ex * h * i..(ex + 1) * h * i], - )?; - read_scales( - source, - &format!("{base}.weight_scale_inv"), - &[kb, ib], - &mut scales[ex * kb * ib..(ex + 1) * kb * ib], - )?; - } - let sources: Vec = (0..e) - .map(|ex| Fp8Source { - weights: &fp8[ex * h * i..(ex + 1) * h * i], - scales: &scales[ex * kb * ib..(ex + 1) * kb * ib], - rows: h, - col0: config.down_col0(ex), - }) - .collect(); - let experts = if format.fp8_experts() { - resident += e * h * i + e * kb * ib * 4; - let down = uploader.upload_fp8(e, h, i, &fp8[..e * h * i], &scales[..e * kb * ib])?; - ExpertWeights::Fp8 { - gate_up: gate_up_fp8.expect("fp8 gate_up"), - down, - } - } else { - dequant_fp8_sources_to_bf16_cols(&sources, i, &mut bits[..i * dn_n], dn_n)?; - resident += 2 * i * dn_n; - let down = uploader.upload_experts(i, dn_n, &bits[..i * dn_n])?; - ExpertWeights::Bf16 { - gate_up: gate_up.expect("bf16 gate_up"), - down, - } + } else { + dequant_fp8_sources_to_bf16_cols(&sources, i, &mut bits[..i * dn_n], dn_n)?; + resident += 2 * i * dn_n; + let down = uploader.upload_experts(i, dn_n, &bits[..i * dn_n])?; + ExpertWeights::Bf16 { + gate_up: gate_up.expect("bf16 gate_up"), + down, + } + }; + progress(&format!("{p}.mlp.experts.down")); + experts }; - progress(&format!("{p}.mlp.experts.down")); layers.push(OmegaLayer { input_norm: read_bf16_f32( @@ -1511,9 +1590,6 @@ pub fn load_qwen3_moe_omega_from_paths( }); if let (Some(router), Some(layer)) = (&device_router, layers.last()) { let li = layers.len() - 1; - let ExpertWeights::Fp8 { gate_up, down } = &layer.experts else { - return Err(format!("layer {li}: the device router needs FP8 experts")); - }; // The router carries the bf16 gate weights; the host copy is an exact widening of them. let gate_bf16: Vec = layer .router @@ -1523,13 +1599,26 @@ pub fn load_qwen3_moe_omega_from_paths( router .set_layer(li, &gate_bf16, &layer.post_norm) .map_err(|e| format!("router layer {li}: {e}"))?; - let (mut gu, mut dn) = (Vec::with_capacity(2 * e), Vec::with_capacity(2 * e)); - for ex in 0..e { - let (w, s) = gate_up.tensor_entry(ex)?; - gu.extend([w, s]); - let (w, s) = down.tensor_entry(ex)?; - dn.extend([w, s]); - } + let (gu, dn) = match &layer.experts { + ExpertWeights::Fp8 { gate_up, down } => { + let (mut gu, mut dn) = (Vec::with_capacity(2 * e), Vec::with_capacity(2 * e)); + for ex in 0..e { + let (w, s) = gate_up.tensor_entry(ex)?; + gu.extend([w, s]); + let (w, s) = down.tensor_entry(ex)?; + dn.extend([w, s]); + } + (gu, dn) + } + // The paged path never reads the router's group tables (ribbon.rs). + ExpertWeights::Paged(_) => ( + ribbon::directory_placeholder(e), + ribbon::directory_placeholder(e), + ), + ExpertWeights::Bf16 { .. } => { + return Err(format!("layer {li}: the device router needs FP8 experts")) + } + }; router .set_directory(li, &gu, &dn) .map_err(|e| format!("router directory layer {li}: {e}"))?; @@ -1951,11 +2040,16 @@ pub(crate) mod test_support { } fn set_directory(&self, layer: usize, gu: &[u64], dn: &[u64]) -> Result<(), String> { assert_eq!((gu.len(), dn.len()), (2 * self.experts, 2 * self.experts)); - // tensor_entry of expert x is (x + 1, 0): the directory must list them in order. - assert!(gu - .chunks(2) - .enumerate() - .all(|(x, p)| p == [x as u64 + 1, 0])); + // tensor_entry of expert x is (x + 1, 0): the directory must list them in order. A paged + // load (Expert Ribbon) sets the fixed placeholder instead: its tables are never read. + let placeholder = super::ribbon::directory_placeholder(self.experts); + assert!( + (gu == placeholder.as_slice() && dn == placeholder.as_slice()) + || gu + .chunks(2) + .enumerate() + .all(|(x, p)| p == [x as u64 + 1, 0]) + ); self.directories.lock().unwrap().push(layer); Ok(()) } @@ -3204,6 +3298,9 @@ pub struct StepTiming { pub graph_launches: u64, pub graph_submits: u64, pub graph_record_ns: u64, + /// Expert Ribbon only (inside `experts_ns`): wall time pinning the top-k in slots, misses read + /// from the NVMe and loaded included. + pub page_ns: u64, } impl StepTiming { @@ -3212,6 +3309,7 @@ impl StepTiming { self.graph_launches += o.graph_launches; self.graph_submits += o.graph_submits; self.graph_record_ns += o.graph_record_ns; + self.page_ns += o.page_ns; self.route_ns += o.route_ns; self.moe_host_ns += o.moe_host_ns; self.total_ns += o.total_ns; @@ -3921,12 +4019,30 @@ impl Qwen3MoeOmegaEngine { attn: AttnPath, paths: DevicePaths, progress: &mut dyn FnMut(&str), + ) -> Result<(Self, LoadReport), String> { + Self::load_omega_experts(dir, max_context, format, attn, paths, None, progress) + } + + /// As [`Self::load_omega_paths`] with the experts paged into GPU slots (Expert Ribbon) when + /// `paged` is given: no expert bytes are read at load, every expert comes from the pager. + pub fn load_omega_experts( + dir: &Path, + max_context: usize, + format: WeightFormat, + attn: AttnPath, + paths: DevicePaths, + paged: Option>, + progress: &mut dyn FnMut(&str), ) -> Result<(Self, LoadReport), String> { if !aien_omega_gpu::is_native() { return Err("this binary carries the CPU stub of the Omega engine (build with AIEN_OMEGA_DIR or AIEN_OMEGA_GPU_LIB)".into()); } - let (weights, report) = - load_qwen3_moe_omega_paths(dir, &OmegaModelUploader, format, paths, progress)?; + let (weights, report) = match paged { + None => load_qwen3_moe_omega_paths(dir, &OmegaModelUploader, format, paths, progress)?, + Some(p) => { + load_qwen3_moe_omega_paged(dir, &OmegaModelUploader, format, paths, p, progress)? + } + }; let geometry = KvGeometry::from(&weights.config); let fused = match attn { AttnPath::Split => false, @@ -4186,7 +4302,7 @@ impl Qwen3MoeOmegaEngine { // group table on the chip: no host RMSNorm, router matmul, top-k or table build. // The host routing mutant (a host-side swap of the chosen ids) needs the host path. let device_router = match (&self.weights.device_router, &layer.experts) { - (Some(r), ExpertWeights::Fp8 { .. }) + (Some(r), ExpertWeights::Fp8 { .. } | ExpertWeights::Paged(_)) if self.device_routing && !self.routing_mutant && self.draft_allowed.is_none() => @@ -4312,6 +4428,42 @@ impl Qwen3MoeOmegaEngine { } timing.host_ns += th.elapsed().as_nanos() as u64; } + // --- Expert Ribbon: pin the top-k in GPU slots (misses paged in), two grouped launches --- + ExpertWeights::Paged(paged) => { + // With the device router the resident path reads the router's normed row on the + // chip; read the same row back (exact: see ribbon.rs). Host routing already has it. + let row: &[f32] = match (device_router, addrs.is_some()) { + (Some(router), true) => { + if post_device.is_empty() { + post_device = vec![0.0f32; h]; + router.read_post(&mut post_device).map_err(|e| { + format!("layer {layer_idx} router readback: {e}") + })?; + } + &post_device + } + _ => &post, + }; + let f = paged.ffn( + layer_idx, + &experts, + row, + &mut gu_out, + &mut act_all, + &mut down_all, + )?; + timing.chip_ns += f.chip_ns; + timing.host_ns += f.host_ns; + timing.launches += f.launches; + timing.page_ns += f.page_ns; + let th = Instant::now(); + for (slot, &w) in topk_weights.iter().enumerate() { + for (m, d) in moe_out.iter_mut().zip(&down_all[slot * h..(slot + 1) * h]) { + *m += w * d; + } + } + timing.host_ns += th.elapsed().as_nanos() as u64; + } } for (xi, m) in x.iter_mut().zip(&moe_out) { *xi += m; diff --git a/crates/aien-inference-abi/src/qwen3_moe_omega/ribbon.rs b/crates/aien-inference-abi/src/qwen3_moe_omega/ribbon.rs new file mode 100644 index 00000000..00199a85 --- /dev/null +++ b/crates/aien-inference-abi/src/qwen3_moe_omega/ribbon.rs @@ -0,0 +1,742 @@ +//! Expert Ribbon in the OWN-30B engine (aienix#4, sc#632): FP8 experts paged from the NVMe into a +//! fixed pool of GPU slots instead of all 6144 experts resident. +//! +//! Per layer and token, [`PagedExperts::ffn`] takes the router's exact top-k, pins those experts in +//! slots through the [`ExpertPager`] (hits pin; misses are read from the checkpoint, BLAKE3-verified, +//! split into the chip layout and loaded into a free slot), runs one gate|up and one down grouped +//! launch over the pinned (slot, version) pairs (`omega_gpu_fp8_slots_gemv_grouped_f32`, the same +//! kernel as the resident tensor) and releases the pins. Nothing is substituted: a miss that cannot be +//! served fails the step. +//! +//! Exactness against the resident path: the activation row is the same bits. With the device router +//! the resident path reads the router's normed row on the chip (`grouped_dev`); here it is read back +//! (`read_post`: the router's row times 2^-64) and packed again (times 2^64), both exact powers of two. +//! The expert bytes and scales are the checkpoint's, as the resident loader uploads them. +//! +//! The router still writes its group tables from a directory; the paged path never reads them, so +//! [`directory_placeholder`] fills the directory with fixed non-zero words (the router refuses zero +//! words). A device-side slot table that would let the router address slots directly is P3, not here. + +use std::sync::Arc; +use std::time::{Duration, Instant}; + +use aien_heartbeat::reader::ReadStats; +use aien_heartbeat::{ + ExpertId, ExpertPager, ExpertParts, ExpertShape, Manifest, PagerStats, ReadAdapter, ReadConfig, + ResidencyStats, ShardDevice, SlotBackend, SlotVersion, +}; + +/// One pool of FP8 slots of a single projection shape `[n][k]` (gate|up or down). +pub trait SlotGemv: Send + Sync + std::fmt::Debug { + fn slots(&self) -> usize; + fn n(&self) -> usize; + fn k(&self) -> usize; + /// Copies one expert projection into `slot` and returns its new version. Refused while pinned. + fn load(&self, slot: u32, key: u64, w: &[u8], scales: &[u16]) -> Result; + /// One grouped launch over `(slots[g], versions[g])`; `x` is one shared row or one row per group. + /// Returns the chip-reported kernel ns. + fn grouped( + &self, + slots: &[u32], + versions: &[u64], + x: &[f32], + y: &mut [f32], + ) -> Result; +} + +/// The chip pool (`omega_gpu_fp8_slots`, omega#533). +#[derive(Debug)] +pub struct OmegaSlotGemv(aien_omega_fp8::Fp8Slots); + +impl OmegaSlotGemv { + pub fn alloc(slots: usize, n: usize, k: usize) -> Result { + aien_omega_fp8::Fp8Slots::alloc(slots, n, k) + .map(Self) + .map_err(|e| format!("fp8 slot pool {slots} x [{n}][{k}]: {e}")) + } + pub fn pool_stats(&self) -> aien_omega_fp8::SlotPoolStats { + self.0.stats() + } + /// Device bytes of one slot (weights + f32 scales). + pub fn slot_bytes(&self) -> usize { + self.0.slot_bytes() + } +} + +impl SlotGemv for OmegaSlotGemv { + fn slots(&self) -> usize { + self.0.slots() + } + fn n(&self) -> usize { + self.0.n() + } + fn k(&self) -> usize { + self.0.k() + } + fn load(&self, slot: u32, key: u64, w: &[u8], scales: &[u16]) -> Result { + self.0 + .load(slot as usize, key, w, scales) + .map_err(|e| e.to_string()) + } + fn grouped( + &self, + slots: &[u32], + versions: &[u64], + x: &[f32], + y: &mut [f32], + ) -> Result { + self.0 + .grouped_f32(slots, versions, x, y) + .map(|i| i.elapsed_ns) + .map_err(|e| e.to_string()) + } +} + +/// Content key of one projection of one expert in a slot (omega records it with the slot). +pub fn slot_key(id: ExpertId, down: bool) -> u64 { + ((id.0 as u64) << 17) | ((id.1 as u64) << 1) | down as u64 +} + +/// The two pools as the pager's slot pair: slot `s` of gate|up and slot `s` of down hold one expert. +#[derive(Debug)] +struct SlotPair { + gate_up: Arc, + down: Arc, +} + +impl SlotBackend for SlotPair { + fn slots(&self) -> usize { + self.gate_up.slots() + } + fn load( + &self, + slot: u32, + id: ExpertId, + parts: &ExpertParts<'_>, + ) -> Result { + let gate_up = self.gate_up.load( + slot, + slot_key(id, false), + &parts.gate_up_w, + &parts.gate_up_s, + )?; + let down = self + .down + .load(slot, slot_key(id, true), &parts.down_w, &parts.down_s)?; + Ok(SlotVersion { gate_up, down }) + } +} + +/// Where one paged FFN call spent its time. +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] +pub struct FfnTiming { + /// Wall time in `ensure` (hits are near zero; misses read, verify and load). + pub page_ns: u64, + pub chip_ns: u64, + pub host_ns: u64, + pub launches: u64, +} + +/// The paged expert weights of every layer: one slot pool pair shared by all layers. +pub struct PagedExperts { + pager: ExpertPager, + gate_up: Arc, + down: Arc, + inter: usize, + hidden: usize, + #[cfg(feature = "ribbon-omega")] + pipeline_buffers: Option, +} + +impl std::fmt::Debug for PagedExperts { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "PagedExperts {{ slots: {}, resident: {}, gate_up: {:?}, down: {:?} }}", + self.pager.capacity(), + self.pager.resident(), + self.gate_up, + self.down + ) + } +} + +/// Fixed non-zero directory words for the router in paged mode (never dereferenced: see the module doc). +pub fn directory_placeholder(experts: usize) -> Vec { + (0..2 * experts as u64) + .map(|j| 0xDEAD_0000_0000_0000 | (j + 1)) + .collect() +} + +impl PagedExperts { + /// `manifest` must describe the same checkpoint the rest of the model is loaded from; every + /// expert's layout is checked against `hidden` x `inter` here. + pub fn new( + manifest: Arc, + hidden: usize, + inter: usize, + dev: Arc, + read: ReadConfig, + gate_up: Arc, + down: Arc, + read_deadline: Duration, + ) -> Result { + if gate_up.slots() != down.slots() || gate_up.slots() == 0 { + return Err(format!( + "slot pools differ or are empty: gate|up {} slots, down {}", + gate_up.slots(), + down.slots() + )); + } + if (gate_up.n(), gate_up.k()) != (2 * inter, hidden) + || (down.n(), down.k()) != (hidden, inter) + { + return Err(format!( + "slot shapes gate|up [{}][{}] down [{}][{}] do not fit hidden {hidden} inter {inter}", + gate_up.n(), + gate_up.k(), + down.n(), + down.k() + )); + } + let reader = ReadAdapter::new(manifest.clone(), dev, read); + let backend = Arc::new(SlotPair { + gate_up: gate_up.clone(), + down: down.clone(), + }); + let shape = ExpertShape { + hidden: hidden as u64, + inter: inter as u64, + }; + let pager = ExpertPager::new(manifest, shape, reader, backend, read_deadline) + .map_err(|e| e.to_string())?; + let pipeline_buffers = std::env::var("AIEN_RIBBON_OMEGA_BUFFERS") + .ok() + .map(|v| { + v.parse::() + .map_err(|_| "AIEN_RIBBON_OMEGA_BUFFERS must be 1 or 2") + }) + .transpose()?; + if let Some(n) = pipeline_buffers { + if !(1..=2).contains(&n) { + return Err("AIEN_RIBBON_OMEGA_BUFFERS must be 1 or 2".into()); + } + if !cfg!(feature = "ribbon-omega") { + return Err("Omega ribbon binding is not built".into()); + } + } + Ok(Self { + pager, + gate_up, + down, + inter, + hidden, + #[cfg(feature = "ribbon-omega")] + pipeline_buffers, + }) + } + + pub fn capacity(&self) -> usize { + self.pager.capacity() + } + pub fn resident(&self) -> usize { + self.pager.resident() + } + pub fn pinned(&self) -> u32 { + self.pager.pinned() + } + pub fn stats(&self) -> PagerStats { + self.pager.stats() + } + pub fn residency_stats(&self) -> ResidencyStats { + self.pager.residency_stats() + } + pub fn read_stats(&self) -> ReadStats { + self.pager.read_stats() + } + pub fn manifest(&self) -> &Manifest { + self.pager.manifest() + } + + /// The expert FFN of one token in one layer: `gu_out = gate|up(x)`, SwiGLU into `act_all`, + /// `down_all = down(act_all)`, one row per expert in router order. The combine stays with the caller. + pub fn ffn( + &self, + layer: usize, + experts: &[u32], + x: &[f32], + gu_out: &mut [f32], + act_all: &mut [f32], + down_all: &mut [f32], + ) -> Result { + let (i, h, k) = (self.inter, self.hidden, experts.len()); + if x.len() != h + || gu_out.len() < k * 2 * i + || act_all.len() < k * i + || down_all.len() < k * h + { + return Err(format!( + "paged ffn layer {layer}: buffer sizes do not fit {k} experts" + )); + } + let ids: Vec = experts + .iter() + .map(|&e| u16::try_from(e).map_err(|_| format!("expert id {e}"))) + .collect::>()?; + let layer16 = u16::try_from(layer).map_err(|_| format!("layer {layer}"))?; + let mut t = FfnTiming::default(); + let t0 = Instant::now(); + #[cfg(feature = "ribbon-omega")] + if let Some(buffers) = self.pipeline_buffers { + self.pager + .for_each_ready(layer16, &ids, buffers, |g, slot, ver| { + t.chip_ns += self.gate_up.grouped( + &[slot], + &[ver.gate_up], + x, + &mut gu_out[g * 2 * i..(g + 1) * 2 * i], + )?; + let host = Instant::now(); + super::swiglu( + &gu_out[g * 2 * i..(g + 1) * 2 * i], + i, + &mut act_all[g * i..(g + 1) * i], + ); + t.host_ns += host.elapsed().as_nanos() as u64; + t.chip_ns += self.down.grouped( + &[slot], + &[ver.down], + &act_all[g * i..(g + 1) * i], + &mut down_all[g * h..(g + 1) * h], + )?; + t.launches += 2; + Ok(()) + }) + .map_err(|e| format!("layer {layer} Omega pipeline: {e}"))?; + t.page_ns = (t0.elapsed().as_nanos() as u64).saturating_sub(t.chip_ns + t.host_ns); + return Ok(t); + } + let pinned = self + .pager + .ensure(layer16, &ids) + .map_err(|e| format!("layer {layer} expert pager: {e}"))?; + t.page_ns = t0.elapsed().as_nanos() as u64; + // The pins are dropped on every exit from here on. + struct Release<'a>(&'a ExpertPager, &'a aien_heartbeat::Pinned); + impl Drop for Release<'_> { + fn drop(&mut self) { + self.0.release(self.1); + } + } + let _release = Release(&self.pager, &pinned); + let gu_ver: Vec = pinned.versions.iter().map(|v| v.gate_up).collect(); + let dn_ver: Vec = pinned.versions.iter().map(|v| v.down).collect(); + t.chip_ns += self + .gate_up + .grouped(&pinned.slots, &gu_ver, x, &mut gu_out[..k * 2 * i]) + .map_err(|e| format!("layer {layer} gate_up slots: {e}"))?; + t.launches += 1; + let th = Instant::now(); + for g in 0..k { + super::swiglu( + &gu_out[g * 2 * i..(g + 1) * 2 * i], + i, + &mut act_all[g * i..(g + 1) * i], + ); + } + t.host_ns += th.elapsed().as_nanos() as u64; + t.chip_ns += self + .down + .grouped( + &pinned.slots, + &dn_ver, + &act_all[..k * i], + &mut down_all[..k * h], + ) + .map_err(|e| format!("layer {layer} down slots: {e}"))?; + t.launches += 1; + Ok(t) + } +} + +#[cfg(test)] +mod tests { + //! Paged vs resident on the tiny in-memory model, with host fakes for the slot pools: the same + //! logits bit for bit at every position, at the smallest capacity (top_k slots: every layer + //! evicts) and with room for everything; a corrupted slot load changes them (the check has teeth); + //! a capacity below top_k fails the step instead of computing something else. + use super::super::test_support::*; + use super::super::*; + use super::*; + use std::collections::BTreeMap; + use std::sync::Mutex; + + /// Host slot pool: the resident host GEMV over `slots` expert-sized regions, with omega's + /// version rule (a launch names the version it pinned; a reloaded slot refuses the old one). + #[derive(Debug)] + struct HostSlots { + inner: Mutex<(HostFp8, Vec, u64)>, + corrupt: bool, + } + + impl HostSlots { + fn new(slots: usize, n: usize, k: usize, corrupt: bool) -> Arc { + let sc = (n / FP8_BLOCK) * (k / FP8_BLOCK); + Arc::new(Self { + inner: Mutex::new(( + HostFp8 { + experts: slots, + n, + k, + w: vec![0; slots * n * k], + scales: vec![0; slots * sc], + dev: None, + gemm: None, + }, + vec![0; slots], + 0, + )), + corrupt, + }) + } + } + + impl SlotGemv for HostSlots { + fn slots(&self) -> usize { + self.inner.lock().unwrap().1.len() + } + fn n(&self) -> usize { + self.inner.lock().unwrap().0.n + } + fn k(&self) -> usize { + self.inner.lock().unwrap().0.k + } + fn load(&self, slot: u32, _key: u64, w: &[u8], scales: &[u16]) -> Result { + let mut g = self.inner.lock().unwrap(); + let (n, k) = (g.0.n, g.0.k); + let sc = (n / FP8_BLOCK) * (k / FP8_BLOCK); + let s = slot as usize; + assert_eq!((w.len(), scales.len()), (n * k, sc)); + g.0.w[s * n * k..(s + 1) * n * k].copy_from_slice(w); + if self.corrupt { + g.0.w[s * n * k] ^= 0x01; + } + g.0.scales[s * sc..(s + 1) * sc].copy_from_slice(scales); + g.2 += 1; + let v = g.2; + g.1[s] = v; + Ok(v) + } + fn grouped( + &self, + slots: &[u32], + versions: &[u64], + x: &[f32], + y: &mut [f32], + ) -> Result { + let g = self.inner.lock().unwrap(); + for (&s, &v) in slots.iter().zip(versions) { + if g.1[s as usize] != v { + return Err(format!( + "slot {s}: version {v} is stale (now {})", + g.1[s as usize] + )); + } + } + g.0.grouped_f32(slots, x, y) + } + } + + /// The in-memory checkpoint as one safetensors shard + index (F8 tensors first, then BF16, each + /// sorted by name, as safetensors groups them), so the manifest and reader see real files. + fn write_checkpoint(src: &MemorySource, dir: &std::path::Path) { + let mut all: Vec<_> = src.tensors.iter().collect(); + all.sort_by(|a, b| (a.1 .0 != "F8_E4M3", a.0).cmp(&(b.1 .0 != "F8_E4M3", b.0))); + let shard = "model-00001-of-00001.safetensors"; + let (mut header, mut data, mut map) = (serde_json::Map::new(), Vec::new(), BTreeMap::new()); + for (name, (dtype, shape, bytes)) in all { + let a = data.len(); + data.extend_from_slice(bytes); + header.insert( + name.clone(), + serde_json::json!({"dtype": dtype, "shape": shape, "data_offsets": [a, data.len()]}), + ); + map.insert(name.clone(), shard.to_string()); + } + let h = serde_json::to_vec(&header).unwrap(); + let mut file = (h.len() as u64).to_le_bytes().to_vec(); + file.extend(&h); + file.extend(&data); + std::fs::write(dir.join(shard), file).unwrap(); + std::fs::write( + dir.join("model.safetensors.index.json"), + serde_json::to_vec(&serde_json::json!({"metadata": {}, "weight_map": map})).unwrap(), + ) + .unwrap(); + } + + fn tmpdir(tag: &str) -> std::path::PathBuf { + let d = std::env::temp_dir().join(format!( + "aien-ribbon-{tag}-{}-{}", + std::process::id(), + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_nanos() + )); + std::fs::create_dir_all(&d).unwrap(); + d + } + + fn paged_engine( + c: &Qwen3MoeConfig, + dir: &std::path::Path, + slots: usize, + fakes: bool, + corrupt: bool, + ) -> (Qwen3MoeOmegaEngine, Arc) { + paged_engine_mode(c, dir, slots, fakes, corrupt, None) + } + + fn paged_engine_mode( + c: &Qwen3MoeConfig, + dir: &Path, + slots: usize, + fakes: bool, + corrupt: bool, + pipeline: Option, + ) -> (Qwen3MoeOmegaEngine, Arc) { + let m = Arc::new(Manifest::build(dir).unwrap()); + let dev = Arc::new(aien_heartbeat::FileShards::open(&m.shard_paths(), false).unwrap()); + let (h, i) = (c.hidden, c.moe_intermediate); + #[allow(unused_mut)] + let mut paged = PagedExperts::new( + m, + h, + i, + dev, + ReadConfig { + workers: 2, + queue_depth: 4, + }, + HostSlots::new(slots, 2 * i, h, corrupt), + HostSlots::new(slots, h, i, false), + Duration::from_secs(10), + ) + .unwrap(); + #[cfg(feature = "ribbon-omega")] + { + paged.pipeline_buffers = pipeline; + } + #[cfg(not(feature = "ribbon-omega"))] + { + assert!(pipeline.is_none()); + } + let paged = Arc::new(paged); + let mut src = MemorySource::for_config(c); + let up = RecordingUploader { + device_fakes: fakes, + ..Default::default() + }; + let (w, _) = load_qwen3_moe_omega_paged_from( + c, + &mut src, + &up, + WeightFormat::Fp8All, + DevicePaths::default(), + paged.clone(), + &mut |_| {}, + ) + .unwrap(); + assert!( + !src.reads.iter().any(|n| n.contains(".mlp.experts.")), + "a paged load must not read expert bytes" + ); + let kv = HostKv::new(&KvGeometry::from(c), 32); + (Qwen3MoeOmegaEngine::new(w, Box::new(kv)), paged) + } + + fn resident_engine(c: &Qwen3MoeConfig, fakes: bool) -> Qwen3MoeOmegaEngine { + let mut src = MemorySource::for_config(c); + let up = RecordingUploader { + device_fakes: fakes, + ..Default::default() + }; + let (w, _) = load_qwen3_moe_omega_from_paths( + c, + &mut src, + &up, + WeightFormat::Fp8All, + DevicePaths::default(), + &mut |_| {}, + ) + .unwrap(); + Qwen3MoeOmegaEngine::new(w, Box::new(HostKv::new(&KvGeometry::from(c), 32))) + } + + /// Prompt then greedy decode; logits bits at every position. + fn run(e: &mut Qwen3MoeOmegaEngine, steps: usize) -> Vec> { + let mut out = Vec::new(); + let mut tok = 5u32; + for p in 0..steps { + let hidden = e.step(if p < 4 { [5, 9, 17, 2][p] } else { tok }).unwrap(); + let lg = e.logits(&hidden).unwrap(); + tok = lg + .iter() + .enumerate() + .fold((0, f32::MIN), |b, (j, &v)| if v > b.1 { (j, v) } else { b }) + .0 as u32; + out.push(lg.iter().map(|v| v.to_bits()).collect()); + } + out + } + + #[test] + fn paged_experts_give_the_resident_logits_bit_for_bit_at_any_capacity() { + let c = tiny_config(); + let dir = tmpdir("parity"); + write_checkpoint(&MemorySource::for_config(&c), &dir); + let all = c.layers * c.experts; + for fakes in [false, true] { + let want = run(&mut resident_engine(&c, fakes), 10); + for slots in [c.top_k, c.top_k + 1, all] { + let (mut e, paged) = paged_engine(&c, &dir, slots, fakes, false); + let got = run(&mut e, 10); + assert_eq!(got, want, "device router {fakes}, {slots} slots"); + let s = paged.stats(); + assert_eq!(s.requests, (10 * c.layers) as u64); + assert_eq!( + s.experts_hit + s.experts_missed, + (10 * c.layers * c.top_k) as u64 + ); + assert!( + s.experts_missed >= (c.layers * c.top_k) as u64, + "the first token misses everything" + ); + if slots == all { + // Room for everything: each expert is read at most once. + assert!(s.experts_missed <= all as u64, "{s:?}"); + } else { + assert!( + s.experts_missed > all as u64, + "smallest pools must evict: {s:?}" + ); + } + assert_eq!(paged.pinned(), 0, "every pin released"); + assert!(e.last_timing.page_ns > 0 || s.experts_missed > 0); + } + } + std::fs::remove_dir_all(&dir).ok(); + } + + #[test] + #[cfg(feature = "ribbon-omega")] + fn omega_pipeline_matches_resident_logits_with_one_and_two_buffers() { + let c = tiny_config(); + let dir = tmpdir("omega-pipeline"); + write_checkpoint(&MemorySource::for_config(&c), &dir); + for device in [false, true] { + let expected = run(&mut resident_engine(&c, device), 10); + for buffers in [1, 2] { + for slots in [c.top_k, c.layers * c.experts] { + let (mut engine, pager) = + paged_engine_mode(&c, &dir, slots, device, false, Some(buffers)); + assert_eq!( + run(&mut engine, 10), + expected, + "device {device}, buffers {buffers}, slots {slots}" + ); + assert_eq!(pager.pinned(), 0); + } + } + } + std::fs::remove_dir_all(dir).unwrap(); + } + + #[test] + fn a_corrupted_slot_load_changes_the_logits_and_too_few_slots_fail_the_step() { + let c = tiny_config(); + let dir = tmpdir("neg"); + write_checkpoint(&MemorySource::for_config(&c), &dir); + let want = run(&mut resident_engine(&c, true), 4); + let (mut bad, _) = paged_engine(&c, &dir, c.layers * c.experts, true, true); + assert_ne!( + run(&mut bad, 4), + want, + "negative control: one flipped weight byte per load" + ); + + let (mut small, paged) = paged_engine(&c, &dir, c.top_k - 1, true, false); + let err = small.step(5).unwrap_err(); + assert!(err.contains("pinned or loading"), "{err}"); + assert_eq!(paged.pinned(), 0, "a failed step leaves nothing pinned"); + std::fs::remove_dir_all(&dir).ok(); + } +} + +/// What [`open_omega`] needs: the checkpoint's expert manifest, the slot count and the read queue. +#[derive(Debug, Clone)] +pub struct RibbonOptions { + /// Saved manifest (built from the checkpoint and saved here when missing or for another model). + pub manifest: std::path::PathBuf, + pub slots: usize, + pub read: ReadConfig, + /// O_DIRECT reads (the SSD figure); false reads through the page cache. + pub direct: bool, + pub read_deadline: Duration, +} + +/// The chip slot pools for a checkpoint: gate|up `[2i][h]` and down `[h][i]`, `slots` each. +/// Every expert read is BLAKE3-checked against the manifest, so a stale manifest fails closed. +pub fn open_omega( + dir: &std::path::Path, + hidden: usize, + inter: usize, + o: &RibbonOptions, + progress: &mut dyn FnMut(&str), +) -> Result, String> { + let m = match Manifest::load(&o.manifest) { + Ok(m) if m.model_dir == dir => m, + _ => { + let t = Instant::now(); + let m = Manifest::build(dir).map_err(|e| format!("expert manifest: {e}"))?; + m.save(&o.manifest) + .map_err(|e| format!("save manifest {}: {e}", o.manifest.display()))?; + progress(&format!( + "ribbon manifest built in {:.1} s ({} experts)", + t.elapsed().as_secs_f64(), + m.experts.len() + )); + m + } + }; + progress(&format!( + "ribbon manifest {} experts, model digest {}", + m.experts.len(), + m.model_digest + )); + let m = Arc::new(m); + let dev = Arc::new( + aien_heartbeat::FileShards::open(&m.shard_paths(), o.direct) + .map_err(|e| format!("open shards: {e}"))?, + ); + let gate_up = Arc::new(OmegaSlotGemv::alloc(o.slots, 2 * inter, hidden)?); + let down = Arc::new(OmegaSlotGemv::alloc(o.slots, hidden, inter)?); + progress(&format!( + "ribbon slots {} x {} B = {} B device", + o.slots, + gate_up.slot_bytes() + down.slot_bytes(), + o.slots * (gate_up.slot_bytes() + down.slot_bytes()) + )); + PagedExperts::new( + m, + hidden, + inter, + dev, + o.read, + gate_up, + down, + o.read_deadline, + ) + .map(Arc::new) +} diff --git a/crates/aien-kv-store/src/seal.rs b/crates/aien-kv-store/src/seal.rs index a0becb1f..fd10b294 100644 --- a/crates/aien-kv-store/src/seal.rs +++ b/crates/aien-kv-store/src/seal.rs @@ -877,7 +877,7 @@ fn read_key_fingerprints(dir: &Path) -> Result>, SealError> || meta.uid() != euid() || len < KEY_LIST_HEADER as u64 || len > max - || (len - KEY_LIST_HEADER as u64) % 32 != 0 + || !(len - KEY_LIST_HEADER as u64).is_multiple_of(32) { return Err(SealError::UsageStore); } diff --git a/crates/aien-omega-fp8/build.rs b/crates/aien-omega-fp8/build.rs index af9f91d4..7fba16cc 100644 --- a/crates/aien-omega-fp8/build.rs +++ b/crates/aien-omega-fp8/build.rs @@ -22,6 +22,9 @@ //! `omega_gpu_fp8_gemv_grouped_f32` defined in that archive. //! * `AIEN_OMEGA_DIR=`: native when the checkout has `src/omega_gpu_fp8_api.h`. //! +//! `cfg(has_omega_fp8_slots)` (Expert Ribbon slot pools, omega#533) is set when the archive defines +//! `omega_gpu_fp8_slots_alloc` or the checkout has `src/omega_gpu_fp8_slots.h`. +//! //! `cfg(has_omega_fp8gemm)` (the prefill grouped GEMM) is set when the archive defines //! `omega_gpu_fp8gemm_f32` or the checkout has `src/omega_gpu_fp8gemm_api.h`. //! `cfg(has_omega_fp8_grouped_rule)` (L310 one-wave lever, `omega_gpu_fp8_grouped_ctas_auto`) is set when the @@ -38,6 +41,7 @@ fn main() { println!("cargo:rustc-check-cfg=cfg(has_omega_fp8_dev)"); println!("cargo:rustc-check-cfg=cfg(has_omega_fp8gemm)"); println!("cargo:rustc-check-cfg=cfg(has_omega_fp8_grouped_rule)"); + println!("cargo:rustc-check-cfg=cfg(has_omega_fp8_slots)"); for v in [ "AIEN_FORCE_CPU_STUB", "AIEN_OMEGA_GPU_LIB", @@ -63,6 +67,9 @@ fn main() { if archive_defines(Path::new(&lib), "omega_gpu_fp8_grouped_ctas_auto") { println!("cargo:rustc-cfg=has_omega_fp8_grouped_rule"); } + if archive_defines(Path::new(&lib), "omega_gpu_fp8_slots_alloc") { + println!("cargo:rustc-cfg=has_omega_fp8_slots"); + } } else { println!("cargo:warning=aien-omega-fp8: {lib} does not define the FP8 GEMV API; FP8 calls are stubbed"); } @@ -90,6 +97,9 @@ fn main() { { println!("cargo:rustc-cfg=has_omega_fp8_grouped_rule"); } + if Path::new(&dir).join("src/omega_gpu_fp8_slots.h").is_file() { + println!("cargo:rustc-cfg=has_omega_fp8_slots"); + } } else { println!("cargo:warning=aien-omega-fp8: {dir} has no src/omega_gpu_fp8_api.h (omega before OWN-30B cut 5); FP8 calls are stubbed"); } diff --git a/crates/aien-omega-fp8/src/lib.rs b/crates/aien-omega-fp8/src/lib.rs index 30583541..2302f3a8 100644 --- a/crates/aien-omega-fp8/src/lib.rs +++ b/crates/aien-omega-fp8/src/lib.rs @@ -809,3 +809,297 @@ mod tests { assert_eq!(std::mem::offset_of!(GemmInfo, kernel_cache_hit), 76); } } + +// --------------------------------------------------------------------------------------------- +// Expert Ribbon (aienix#4, omega#533): versioned replaceable FP8 expert slots. +// --------------------------------------------------------------------------------------------- + +#[cfg(has_omega_fp8_slots)] +mod slots_ffi { + use super::Fp8Info; + #[repr(C)] + pub struct OmegaGpuFp8Slots { + _private: [u8; 0], + } + #[repr(C)] + #[derive(Default, Debug, Clone, Copy)] + pub struct OmegaGpuFp8SlotsStats { + pub slots: u32, + pub n: u32, + pub k: u32, + pub device_bytes: u64, + pub loads: u64, + pub load_failures: u64, + pub busy_refusals: u64, + pub stale_refusals: u64, + pub evictions: u64, + pub pins: u64, + pub pinned_now: u32, + pub pinned_high: u32, + pub bytes_loaded: u64, + pub load_ns: u64, + } + extern "C" { + pub fn omega_gpu_fp8_slots_alloc( + slots: u32, + n: u32, + k: u32, + out: *mut *mut OmegaGpuFp8Slots, + ) -> i32; + pub fn omega_gpu_fp8_slots_free(p: *mut OmegaGpuFp8Slots) -> i32; + pub fn omega_gpu_fp8_slots_load( + p: *mut OmegaGpuFp8Slots, + slot: u32, + key: u64, + w: *const u8, + scale_inv_bf16: *const u16, + version: *mut u64, + ) -> i32; + pub fn omega_gpu_fp8_slots_gemv_grouped_f32( + p: *mut OmegaGpuFp8Slots, + groups: u32, + slots: *const u32, + versions: *const u64, + x: *const f32, + x_rows: u32, + y: *mut f32, + info: *mut Fp8Info, + ) -> i32; + pub fn omega_gpu_fp8_slots_stats(p: *mut OmegaGpuFp8Slots, out: *mut OmegaGpuFp8SlotsStats); + pub fn omega_gpu_fp8_slots_rc_name(rc: i32) -> *const std::os::raw::c_char; + } +} + +/// Counters of one slot pool (omega `OmegaGpuFp8SlotsStats`). +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] +pub struct SlotPoolStats { + pub slots: u32, + pub device_bytes: u64, + pub loads: u64, + pub load_failures: u64, + pub busy_refusals: u64, + pub stale_refusals: u64, + pub pins: u64, + pub pinned_now: u32, + pub pinned_high: u32, + pub bytes_loaded: u64, + pub load_ns: u64, +} + +/// A pool of `slots` versioned FP8 expert slots of one shape `[n][k]` (omega_gpu_fp8_slots.h): GPU-uncached, +/// refilled while the model runs. `load` hides the slot, copies and publishes a fresh version; it is refused +/// while a launch reads the slot. `grouped_f32` pins the given (slot, version) pairs for exactly its launch. +/// Thread-safe in omega (pool mutex; launches take the session lock), so `Sync`. +pub struct Fp8Slots { + #[cfg(has_omega_fp8_slots)] + ptr: *mut slots_ffi::OmegaGpuFp8Slots, + slots: usize, + n: usize, + k: usize, +} + +// SAFETY: the omega pool serialises its own state (pthread mutex) and launches take the session lock. +unsafe impl Send for Fp8Slots {} +unsafe impl Sync for Fp8Slots {} + +impl fmt::Debug for Fp8Slots { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "Fp8Slots {{ slots: {}, n: {}, k: {} }}", + self.slots, self.n, self.k + ) + } +} + +#[cfg(has_omega_fp8_slots)] +fn slots_err(rc: i32) -> OmegaGpuError { + // SAFETY: static NUL-terminated strings (last_error may be NULL). + let name = unsafe { + let n = slots_ffi::omega_gpu_fp8_slots_rc_name(rc); + let n = if n.is_null() { + String::from("?") + } else { + std::ffi::CStr::from_ptr(n).to_string_lossy().into_owned() + }; + let e = ffi::omega_gpu_fp8_last_error(); + if e.is_null() || rc == -6 || rc == -7 { + n + } else { + format!("{n}: {}", std::ffi::CStr::from_ptr(e).to_string_lossy()) + } + }; + OmegaGpuError::Rc { rc, name } +} + +/// Whether this binary carries the slot pool API. +pub fn slots_native() -> bool { + cfg!(has_omega_fp8_slots) +} + +impl Fp8Slots { + pub fn alloc(slots: usize, n: usize, k: usize) -> Result { + check_shape(slots, n, k)?; + #[cfg(has_omega_fp8_slots)] + { + let mut ptr = std::ptr::null_mut(); + // SAFETY: shape checked; omega writes the handle or leaves it NULL. + let rc = unsafe { + slots_ffi::omega_gpu_fp8_slots_alloc(slots as u32, n as u32, k as u32, &mut ptr) + }; + if rc != 0 || ptr.is_null() { + return Err(slots_err(rc)); + } + Ok(Self { ptr, slots, n, k }) + } + #[cfg(not(has_omega_fp8_slots))] + { + let _ = (slots, n, k); + Err(OmegaGpuError::Unavailable) + } + } + + pub fn slots(&self) -> usize { + self.slots + } + pub fn n(&self) -> usize { + self.n + } + pub fn k(&self) -> usize { + self.k + } + /// Device bytes per slot (weights + f32 scales). + pub fn slot_bytes(&self) -> usize { + self.n * self.k + (self.n / BLOCK) * (self.k / BLOCK) * 4 + } + + /// Load one expert projection into `slot`; returns the published version. + pub fn load( + &self, + slot: usize, + key: u64, + w: &[u8], + scale_inv_bf16: &[u16], + ) -> Result { + check_len("fp8 slot weight bytes", self.n * self.k, w.len())?; + check_len( + "fp8 slot scale words", + (self.n / BLOCK) * (self.k / BLOCK), + scale_inv_bf16.len(), + )?; + if slot >= self.slots { + return Err(bad(format!("slot {slot} of {}", self.slots))); + } + #[cfg(has_omega_fp8_slots)] + { + let mut v = 0u64; + // SAFETY: lengths checked; omega copies before returning. + let rc = unsafe { + slots_ffi::omega_gpu_fp8_slots_load( + self.ptr, + slot as u32, + key, + w.as_ptr(), + scale_inv_bf16.as_ptr(), + &mut v, + ) + }; + if rc != 0 { + return Err(slots_err(rc)); + } + Ok(v) + } + #[cfg(not(has_omega_fp8_slots))] + { + let _ = key; + Err(OmegaGpuError::Unavailable) + } + } + + /// One grouped launch over (slot, version) pairs, pinned for the launch (`x`: `k` values shared, or + /// `slots.len() * k`, one row per group). Returns the chip info. + pub fn grouped_f32( + &self, + slots: &[u32], + versions: &[u64], + x: &[f32], + y: &mut [f32], + ) -> Result { + let g = slots.len(); + check_len("fp8 slot versions", g, versions.len())?; + if g == 0 || g > MAX_GROUPS { + return Err(bad(format!("fp8 slot groups {g} (1..={MAX_GROUPS})"))); + } + let x_rows = if x.len() == self.k { + 1 + } else { + check_len("fp8 slot x", g * self.k, x.len())?; + g + }; + check_len("fp8 slot y", g * self.n, y.len())?; + #[cfg(has_omega_fp8_slots)] + { + let mut info = Fp8Info::default(); + // SAFETY: lengths checked above; omega pins, launches, waits for the marker, unpins. + let rc = unsafe { + slots_ffi::omega_gpu_fp8_slots_gemv_grouped_f32( + self.ptr, + g as u32, + slots.as_ptr(), + versions.as_ptr(), + x.as_ptr(), + x_rows as u32, + y.as_mut_ptr(), + &mut info, + ) + }; + if rc != 0 { + return Err(slots_err(rc)); + } + Ok(info) + } + #[cfg(not(has_omega_fp8_slots))] + { + let _ = x_rows; + Err(OmegaGpuError::Unavailable) + } + } + + pub fn stats(&self) -> SlotPoolStats { + #[cfg(has_omega_fp8_slots)] + { + let mut s = slots_ffi::OmegaGpuFp8SlotsStats::default(); + // SAFETY: valid handle, plain C struct out. + unsafe { slots_ffi::omega_gpu_fp8_slots_stats(self.ptr, &mut s) }; + SlotPoolStats { + slots: s.slots, + device_bytes: s.device_bytes, + loads: s.loads, + load_failures: s.load_failures, + busy_refusals: s.busy_refusals, + stale_refusals: s.stale_refusals, + pins: s.pins, + pinned_now: s.pinned_now, + pinned_high: s.pinned_high, + bytes_loaded: s.bytes_loaded, + load_ns: s.load_ns, + } + } + #[cfg(not(has_omega_fp8_slots))] + { + SlotPoolStats::default() + } + } +} + +impl Drop for Fp8Slots { + fn drop(&mut self) { + #[cfg(has_omega_fp8_slots)] + { + // SAFETY: owned handle. BUSY means a launch still pins a slot, which cannot happen here (launches + // are synchronous and borrow &self); the pool is then leaked rather than freed under a reader. + let rc = unsafe { slots_ffi::omega_gpu_fp8_slots_free(self.ptr) }; + debug_assert_eq!(rc, 0, "slot pool freed while pinned"); + } + } +} diff --git a/docs/qwen38/qualification-20261101/.crumb b/docs/qwen38/qualification-20261101/.crumb new file mode 100644 index 00000000..edd96baf --- /dev/null +++ b/docs/qwen38/qualification-20261101/.crumb @@ -0,0 +1,10 @@ +{ + "schema_version": "1.0.0", + "name": "qualification-20261101", + "purpose": "Captured requests, responses and receipts for the pinned native 27B model's November 1 qualification.", + "invariants": [ + "Only completed PASS runs enter the run index; timing qualification is separate from correctness.", + "Compressed request and response bodies preserve the original bytes and have uncompressed SHA256 digests.", + "Events redact machine-local paths; source event digests and exact source/build pins remain recorded." + ] +} diff --git a/docs/qwen38/qualification-20261101/FORMAT.md b/docs/qwen38/qualification-20261101/FORMAT.md new file mode 100644 index 00000000..53c49165 --- /dev/null +++ b/docs/qwen38/qualification-20261101/FORMAT.md @@ -0,0 +1,53 @@ +# Evidence format and replay + +This pack records an existing native 27B server build. It does not describe a +new server built from the accompanying Ribbon changes. + +`index.json` lists completed runs and separates correctness from timing +qualification. Each compressed request or response preserves its original +bytes. The index records its uncompressed SHA256. Event files replace local +home and repository paths with `$HOME` and `$REPO`; their original source +digests are retained. Other event fields are preserved. + +The `short` directory contains the reference-generation requests and responses. +The `long32`, `long64`, and `long128` directories, when present, contain: + +1. `long-cold`: a fresh conversation asking for a passphrase from the middle of + the archive. +2. `long-resumed`: the same conversation with its answer and a follow-up. +3. `reset-cold`: an unrelated short conversation, forcing the live-prefix + comparison to be cold for the next request. +4. `long-follow-cold`: the full follow-up conversation recomputed from scratch. + +The continuation and cold recomputation must emit identical token IDs. The +first prompt must report exactly 32,768, 65,536, or 128,000 prompt tokens. The +128,000-token fixture leaves room for the follow-up inside the server's 131,072 +token capacity. This is a retrieval and continuation test, not a broad test of +long-context reasoning. + +Files ending `.u32le.gz` contain reconstructed input token IDs: unsigned 32-bit +integers, little-endian, with no header or padding. The renderer and tokenizer +come from the exact serving Core revision, `46134247`, with `tokenizers 0.21.4` +and the checked model's tokenizer/template files. Their lengths are compared +with the server's reported prompt-token counts. They are reconstructed inputs, +not a dump from GPU memory. + +The legacy `identity.fixture_sha256` field in the original long-run events +names the short reference fixture. It is not the long-prompt identity. Use the +preserved long request, its digest, `actual_long_prompt_utf8_sha256`, and the +input-token file. This correction is recorded in the index rather than editing +the historical event. + +To replay a request, start the pinned native binary on an unused loopback port +with the checked model, `--max-context 131072 --max-tokens-cap 16384 --thinking +off`. Decompress the request and POST its bytes to `/v1/chat/completions` with +content type `application/json`. Submit the four long requests in the order +above. Preserve the model identity, binary hash, configuration, output IDs and +server log. A CPU stub cannot supply inference evidence. + +Short timing requires an exclusive chip and quiet-machine measurement window. +The long runs allow host compilation and are correctness evidence only. An +event's duration does not by itself establish an uncontended baseline. + +Measurement data is CC0-1.0. Documentation and any captured test-source files +are Apache-2.0. diff --git a/docs/qwen38/qualification-20261101/README.md b/docs/qwen38/qualification-20261101/README.md new file mode 100644 index 00000000..0754e05d --- /dev/null +++ b/docs/qwen38/qualification-20261101/README.md @@ -0,0 +1,103 @@ +# Qwen3.8-27B qualification, 2026-11-01 + +The existing native Omega server passed exact reference generation, streaming, +small coding/prose tasks, and retrieval with resumed conversations at 32K, +64K and 128K. This receipt establishes a baseline for Core #710. It does not +qualify a new optimized candidate or close all acceptance items in that issue. + +## Measured short baseline + +Five accepted requests generated the same fixed 256 reference token IDs. +One warmup was excluded. Trial `decode0` overlapped the end of an already +running host test and is excluded from timing; a sixth trial replaced it. +Accepted trials are `decode1` through `decode5` in +`short-20261101T144403Z`, quiet window `20261101T144401Z-72e543`. +The discarded sample and the reason are retained in the pack. + +| Measurement | Result | +|---|---:| +| Median steady decode | 7.9348 tokens/s | +| Median complete request | 32.7968 s | +| Complete request p95 | 33.0457 s | +| Median prefill, server reported | 507 ms | +| Median graph time per token, server reported | 125.4 ms | +| Streaming first visible content | 0.4900 s | +| Streaming complete request | 32.8659 s | + +P95 is the empirical quantile of only five samples. The fixed reference +sequence stops at the 256-token limit; it is not natural-EOS task completion. +The coding and prose checks below run separately to natural EOS. Loopback +stream timing measures the first nonempty content chunk received by the +client, not merely the first protocol event. All sampled short decode requests +reported zero server lock wait. These results do not characterize loaded +multi-client queueing. + +The server reported a 48.0411 s ready time, 26.92 GB of resident weights, +8.59 GB of allocated KV storage and 38.55 GB process RSS after loading. +These allocation/readiness observations are not a peak unified-memory audit. + +## Correctness and task checks + +| Check | Evidence | +|---|---| +| 24-token reference and negative control | Exact reference, repeat and changed-input control pass | +| Continuation and edited-prefix reuse | Resumed answers match cold recomputation | +| 256-token generation | All retained requests and the stream match reference IDs | +| Coding | `first_unique` passes seven cases, including empty input, negatives, duplicates and input order | +| Prose | 115 words; correct distinction between rotation and seasonal tilt; repeated output identical | +| 32,768-token prompt | Retrieved nonce; resumed/cold follow-up IDs identical | +| 65,536-token prompt | Retrieved nonce; resumed/cold follow-up IDs identical | +| 128,000-token prompt | Retrieved nonce; resumed/cold follow-up IDs identical | + +Coding and prose prompts and grading criteria were frozen before generation. +Each was repeated after an unrelated reset and produced identical token IDs. +The prose phrase "the tilt reverses" would be clearer as a change in the +hemisphere's orientation relative to the Sun. The review records that caveat. +The long fixture hides a nonce midway through an archive. It checks retrieval +and continuation, not broad long-context reasoning. Long runs allowed host +compilation and are correctness-only, not clean latency measurements. + +## Readiness and remaining acceptance work + +| Component or claim | State | +|---|---| +| Native FP8 baseline binary | Tested, existing build identified below | +| Native graph decode | Observed in server timing; no new graph optimization qualified | +| Live/snapshot prefix reuse | Tested against cold recomputation | +| Short decode/stream baseline | Five accepted nonstream samples and one stream | +| 32K/64K/128K continuation | Correctness checked; uncontended latency unqualified | +| Natural-EOS task quality | Two small frozen tasks pass; broad quality unqualified | +| MTP/cascade/speculative or W4 optimization | Unqualified by this run | +| Paired baseline/candidate optimization trial | Not run; no candidate promotion | +| Peak unified memory and complete traffic ceiling | Not measured by this receipt | +| Production deployment | Not performed | + +The next optimization experiment must use these frozen tasks and input tokens, +five alternating baseline/candidate pairs, a clean chip/quiet-machine window, +and separate allocation, queue, prefill, restore/commit and decode accounting. +The Ribbon experiment in the same change uses a different MoE checkpoint; +its speedup must not be presented as a 27B improvement. + +## Identity and evidence + +- Model: `qwen3.8-27b-fp8-017b9c7a`, all 81 files checked against the repository's manifest. +- Existing server Core revision: `46134247`. +- Existing server Omega revision: `0010f7d30bcaf0012e8051c5a05584a08d8320ec`. +- Server SHA256: `df9360112fdc815539f3e289fccfd8070845129ef4ccb466bb90c729ec71d0e5`. +- Engine `omega`, context 131072, output cap 16384, thinking off, greedy. +- Private test port 18196. Every owned server exited normally after its stage. + +[`index.json`](index.json) records source and response hashes and accepted +timing selection. [`FORMAT.md`](FORMAT.md) documents decompression/replay and +the correction to the legacy long-fixture metadata. Exact input IDs were +reconstructed using the serving revision's tokenizer and the checked tokenizer +files; [`tokenizer-provenance.json`](tokenizer-provenance.json) records source, +instrument and file digests. All reconstructed lengths match server usage. +Calculation queries and outputs are recorded in +[`calculations.json`](../../../om/ribbon/calculations.json). + +An initial load failed with a driver allocation error before any accepted run. +That attempt is not counted as a passing run. The successful runs and their +server logs are retained; initial-load failure is not concealed by the clean +request timing selection. Measurement data is CC0-1.0; source/documentation +is Apache-2.0. diff --git a/docs/qwen38/qualification-20261101/index.json b/docs/qwen38/qualification-20261101/index.json new file mode 100644 index 00000000..518798e2 --- /dev/null +++ b/docs/qwen38/qualification-20261101/index.json @@ -0,0 +1,579 @@ +{ + "license": "CC0-1.0", + "scope": "existing pinned native 27B binary, not this branch rebuilt as a 27B server", + "runs": [ + { + "stage": "short", + "run": "short-20261101T144403Z", + "verdict": "PASS", + "timing_qualified": true, + "source_events_sha256": "433f52562da377aea3990f3ec5abc2c5f48d951f1f5e20f59b7d860720bf72e4", + "events_redactions": [ + "home path -> $HOME", + "repository path -> $REPO" + ], + "request_and_response_files": { + "decode0.request.json.gz": { + "uncompressed_sha256": "14a9bcc11fe43d146b532770b60d67af6703bc161132d5ec8142ad988b2c1090", + "uncompressed_bytes": 252 + }, + "decode1.request.json.gz": { + "uncompressed_sha256": "14a9bcc11fe43d146b532770b60d67af6703bc161132d5ec8142ad988b2c1090", + "uncompressed_bytes": 252 + }, + "decode2.request.json.gz": { + "uncompressed_sha256": "14a9bcc11fe43d146b532770b60d67af6703bc161132d5ec8142ad988b2c1090", + "uncompressed_bytes": 252 + }, + "decode3.request.json.gz": { + "uncompressed_sha256": "14a9bcc11fe43d146b532770b60d67af6703bc161132d5ec8142ad988b2c1090", + "uncompressed_bytes": 252 + }, + "decode4.request.json.gz": { + "uncompressed_sha256": "14a9bcc11fe43d146b532770b60d67af6703bc161132d5ec8142ad988b2c1090", + "uncompressed_bytes": 252 + }, + "decode5.request.json.gz": { + "uncompressed_sha256": "14a9bcc11fe43d146b532770b60d67af6703bc161132d5ec8142ad988b2c1090", + "uncompressed_bytes": 252 + }, + "reset0.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "reset1.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "reset2.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "reset3.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "reset4.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "reset5.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "stream-reset.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "stream.request.json.gz": { + "uncompressed_sha256": "2e83bb347dfb5e8ed1c9ed15acc1ce3d63de1c37d20bcb01765026c79c46e672", + "uncompressed_bytes": 311 + }, + "warmup.request.json.gz": { + "uncompressed_sha256": "14a9bcc11fe43d146b532770b60d67af6703bc161132d5ec8142ad988b2c1090", + "uncompressed_bytes": 252 + }, + "decode0.response.json.gz": { + "uncompressed_sha256": "16c1542e61183ced6f98fc91efa7ae422c9ad27ad369a7cad7c3e1916cbadf3d", + "uncompressed_bytes": 3423 + }, + "decode1.response.json.gz": { + "uncompressed_sha256": "54013f1b924b50a58400291c4c11b8a39949917d6b0b007deecbf6dfa3bc5d58", + "uncompressed_bytes": 3423 + }, + "decode2.response.json.gz": { + "uncompressed_sha256": "a3c5ea0bcfb4ba48c138f9c11395bbc78845acfa00b4f3487b173a1fac91f90e", + "uncompressed_bytes": 3423 + }, + "decode3.response.json.gz": { + "uncompressed_sha256": "5a15df4627b271979f447af3cabf0f2805a4f3ada0c397a544f15296fda24d77", + "uncompressed_bytes": 3423 + }, + "decode4.response.json.gz": { + "uncompressed_sha256": "f975a866db899cb4ec7491ff2aec944e1fe057a6d0db9e5f656d0b08f4bac25b", + "uncompressed_bytes": 3423 + }, + "decode5.response.json.gz": { + "uncompressed_sha256": "55745db92b8cf4b3a59a24f626a95a3c880f1af855ced52654af1436a01a713e", + "uncompressed_bytes": 3423 + }, + "reset0.response.json.gz": { + "uncompressed_sha256": "2d243c387e379cb61849f16322f4ff819f72c1ea8cfdf14326a5c1597446da1e", + "uncompressed_bytes": 697 + }, + "reset1.response.json.gz": { + "uncompressed_sha256": "5f30d8a4366ecd168952af985a276450c8418a82f2a28ced22a2e06734c7b67e", + "uncompressed_bytes": 697 + }, + "reset2.response.json.gz": { + "uncompressed_sha256": "d22e149f3f80788601e46b784ad53c2ebc24c824df3e939ef03fc175cad280ff", + "uncompressed_bytes": 697 + }, + "reset3.response.json.gz": { + "uncompressed_sha256": "456b3b6b1408f916fb959c3892cb057495341a7f95744f988fc8b96cbcc861e8", + "uncompressed_bytes": 697 + }, + "reset4.response.json.gz": { + "uncompressed_sha256": "efa3c4a23bd7518ebcdab5eae1755339a505c5779ef0530fffae6df9099dfb5f", + "uncompressed_bytes": 697 + }, + "reset5.response.json.gz": { + "uncompressed_sha256": "cf300ed83776506ce116e7bdf0fc14a8fef905059b05474fb5e1d882d3d7518a", + "uncompressed_bytes": 697 + }, + "stream-reset.response.json.gz": { + "uncompressed_sha256": "c3fab1e6bab5e8b94a28ed4ebafa072b7494217efb70befd5c0990fb0e91f92a", + "uncompressed_bytes": 697 + }, + "warmup.response.json.gz": { + "uncompressed_sha256": "afecb1df7ad50351221464b8967d0e4794ab94eb3eb9fa67d975aeb7cfb5d31c", + "uncompressed_bytes": 3423 + } + }, + "executed_instrument_sha256": "48b26d6a2f678480851066e51244e93c536dcd1e13712a81f3081fb87b0355e7", + "reconstructed_input_ids": { + "decode0.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + }, + "decode1.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + }, + "decode2.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + }, + "decode3.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + }, + "decode4.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + }, + "decode5.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + }, + "quality-coding-repeat.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 71, + "uncompressed_sha256": "987ac94c5eb3437c83381effa6cfaa74e46d92a533f7488c091234782c6904a1" + }, + "quality-coding-reset.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 16, + "uncompressed_sha256": "57d5fc75af30d46ca10967b54492dc8e88b3804e1ce200ee236dd9e200baf6cb" + }, + "quality-coding.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 71, + "uncompressed_sha256": "987ac94c5eb3437c83381effa6cfaa74e46d92a533f7488c091234782c6904a1" + }, + "quality-prose-repeat.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 56, + "uncompressed_sha256": "a855942b34cc9d42492d871f691292c3438b4d3e0fb93f22f59436a7a052d5eb" + }, + "quality-prose-reset.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 16, + "uncompressed_sha256": "57d5fc75af30d46ca10967b54492dc8e88b3804e1ce200ee236dd9e200baf6cb" + }, + "quality-prose.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 56, + "uncompressed_sha256": "a855942b34cc9d42492d871f691292c3438b4d3e0fb93f22f59436a7a052d5eb" + }, + "reset0.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + }, + "reset1.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + }, + "reset2.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + }, + "reset3.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + }, + "reset4.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + }, + "reset5.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + }, + "stream-reset.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + }, + "stream.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + }, + "warmup.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 30, + "uncompressed_sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5" + } + }, + "timing_samples": [ + "decode1", + "decode2", + "decode3", + "decode4", + "decode5" + ], + "timing_excluded": [ + "decode0" + ], + "additional_evidence": { + "correctness-summary.txt.gz": { + "uncompressed_sha256": "00f80da8cf0dd0a4195a82e7d6057ed553735d517f06b2c82ed96b073afadd40", + "uncompressed_bytes": 2031 + }, + "quality-coding-repeat.request.json.gz": { + "uncompressed_sha256": "c7c2f881ac0b87b8d98dd8eaf1ce72f0bfde1cbe9d133006f51e68728bc33146", + "uncompressed_bytes": 475 + }, + "quality-coding-repeat.response.json.gz": { + "uncompressed_sha256": "074086b19ad195a51c5327af065d5d2296b47db2aa7c3b8d501f15742b402c2d", + "uncompressed_bytes": 1233 + }, + "quality-coding-reset.request.json.gz": { + "uncompressed_sha256": "e2481688eb560cf681c7437ae0cb18160b91281f3e4dde82d0802c81b340c788", + "uncompressed_bytes": 184 + }, + "quality-coding-reset.response.json.gz": { + "uncompressed_sha256": "619dbf9ca551cd286d11c1b432fecfb3fa79012aa425733da4e108812187da7c", + "uncompressed_bytes": 697 + }, + "quality-coding.request.json.gz": { + "uncompressed_sha256": "c7c2f881ac0b87b8d98dd8eaf1ce72f0bfde1cbe9d133006f51e68728bc33146", + "uncompressed_bytes": 475 + }, + "quality-coding.response.json.gz": { + "uncompressed_sha256": "c606683277b5b018523ce5c9a2bb2d72bbaa097740418ad90792aafe5974228c", + "uncompressed_bytes": 1233 + }, + "quality-fixtures.json.gz": { + "uncompressed_sha256": "adab93d24d6a5ef72161a1df09dae8a723a5e097795f7eac897bdcb7dc65d000", + "uncompressed_bytes": 1327 + }, + "quality-instrument.py.gz": { + "uncompressed_sha256": "ffd02adf7723be8e97320d0969b2227a222e8fc19dd197888fb5bd78aeb3d37d", + "uncompressed_bytes": 4654 + }, + "quality-prose-repeat.request.json.gz": { + "uncompressed_sha256": "7bdc42839fcb4d64b9a7a082effa6678821efe627d280a0496e7bbc475b99f9b", + "uncompressed_bytes": 377 + }, + "quality-prose-repeat.response.json.gz": { + "uncompressed_sha256": "03978b9dd5da7c580e623a389c53487fc23513b9446bc1938d5ac4ea8c4821a5", + "uncompressed_bytes": 2271 + }, + "quality-prose-reset.request.json.gz": { + "uncompressed_sha256": "e2481688eb560cf681c7437ae0cb18160b91281f3e4dde82d0802c81b340c788", + "uncompressed_bytes": 184 + }, + "quality-prose-reset.response.json.gz": { + "uncompressed_sha256": "e05d01a33ef64829bdec7ab50e8abfd9a61ffd8622948460989c590bdf5485a6", + "uncompressed_bytes": 697 + }, + "quality-prose-review.json.gz": { + "uncompressed_sha256": "e0463146b84d170a174234349e3da5ac61d16aae06dfdbe4c54c4e635e7f3742", + "uncompressed_bytes": 651 + }, + "quality-prose.request.json.gz": { + "uncompressed_sha256": "7bdc42839fcb4d64b9a7a082effa6678821efe627d280a0496e7bbc475b99f9b", + "uncompressed_bytes": 377 + }, + "quality-prose.response.json.gz": { + "uncompressed_sha256": "8b14d9ca7a932cea2bf4931f6a28bb34b7aa2524b59c157cdcceaa22e7f34e15", + "uncompressed_bytes": 2271 + }, + "quality-results.json.gz": { + "uncompressed_sha256": "9821ccbba0bc10476fbd1e0a11516e0f0d486a49fcd8c388bdea06749435113a", + "uncompressed_bytes": 1304 + }, + "runner.py.gz": { + "uncompressed_sha256": "48b26d6a2f678480851066e51244e93c536dcd1e13712a81f3081fb87b0355e7", + "uncompressed_bytes": 11056 + }, + "server.log.gz": { + "uncompressed_sha256": "4b3b56394c57ad688b884e5ca6b31e83a2508621e587bbc07519a94a4c7ad652", + "uncompressed_bytes": 19511 + }, + "stream.response.sse.gz": { + "uncompressed_sha256": "0af53cce3229f99bb57d357926370a6be91c1ac562dd7c11f2d82af2d48e9baf", + "uncompressed_bytes": 52973 + }, + "timing-exclusion.json.gz": { + "uncompressed_sha256": "885eee1869a0e20811474410041a5490a1569dfcde2e5bd2ad678151545387b7", + "uncompressed_bytes": 792 + } + } + }, + { + "stage": "long32", + "run": "long32-20261101T134707Z", + "verdict": "PASS", + "timing_qualified": false, + "source_events_sha256": "361d8c483ec2c8ed4d9103d9e9239b0f3095db407d3f8f7cacae919e7f365cf6", + "events_redactions": [ + "home path -> $HOME", + "repository path -> $REPO" + ], + "request_and_response_files": { + "long-cold.request.json.gz": { + "uncompressed_sha256": "2d04f4ac769ae1cc0cb9683dcf6cf07b9bc770bf07a47fddf2e7359148562635", + "uncompressed_bytes": 155655 + }, + "long-follow-cold.request.json.gz": { + "uncompressed_sha256": "0e0cd5ade964dc675968618d3268d3985f5fe323ebd947540275cd8f6e3ccc79", + "uncompressed_bytes": 155779 + }, + "long-resumed.request.json.gz": { + "uncompressed_sha256": "0e0cd5ade964dc675968618d3268d3985f5fe323ebd947540275cd8f6e3ccc79", + "uncompressed_bytes": 155779 + }, + "reset-cold.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "long-cold.response.json.gz": { + "uncompressed_sha256": "62d115df57743a7cefee2235e5d73dafb49fa721548c91f0ef0f8962af88b1be", + "uncompressed_bytes": 758 + }, + "long-follow-cold.response.json.gz": { + "uncompressed_sha256": "0287fd0ca205c47a3cb8e41cbec0a249c30313c6472addb6ced470dfd0016056", + "uncompressed_bytes": 758 + }, + "long-resumed.response.json.gz": { + "uncompressed_sha256": "a3e3d03ec031d0cd432dc66263e53b4b734491362dd602dc1adee054503481b6", + "uncompressed_bytes": 758 + }, + "reset-cold.response.json.gz": { + "uncompressed_sha256": "91810e0c2e2035056ce46179717c4d2158a91149f86d18a256eb30de2f5e8bcf", + "uncompressed_bytes": 697 + } + }, + "executed_instrument_sha256": "676bb868bdaddeeeaaa638e52c5b851cf0a6f052272cff3cd0c473b195390d99", + "reconstructed_input_ids": { + "long-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 32768, + "uncompressed_sha256": "0d559732aa0a4d1649bf25f087776b8a8ff5a21f80a571f832899950f52e1648" + }, + "long-follow-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 32797, + "uncompressed_sha256": "13637dccd190c539c1920a111c9b11d247d38457bfb722e86b0e96e1713f41c4" + }, + "long-resumed.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 32797, + "uncompressed_sha256": "13637dccd190c539c1920a111c9b11d247d38457bfb722e86b0e96e1713f41c4" + }, + "reset-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + } + }, + "additional_evidence": { + "runner.py.gz": { + "uncompressed_sha256": "676bb868bdaddeeeaaa638e52c5b851cf0a6f052272cff3cd0c473b195390d99", + "uncompressed_bytes": 8439 + }, + "server.log.gz": { + "uncompressed_sha256": "8586f41c42b7808193afc8fd23ba102b54ea9bcb79c52c14540d2aff34281f09", + "uncompressed_bytes": 3314 + } + }, + "actual_long_prompt_utf8_sha256": "81b72309c151023d12f26115b7a07644d7b6a1ca2a5cbb8a87b7d8ab07bde9fc", + "metadata_correction": "The legacy identity.fixture_sha256 field in these runs names the short lighthouse fixture. Use actual_long_prompt_utf8_sha256 and the preserved request body for the long input." + }, + { + "stage": "long64", + "run": "long64-20261101T135324Z", + "verdict": "PASS", + "timing_qualified": false, + "source_events_sha256": "4cfbb55282f6f543d4f7e656ac76b948f556f09c0f5f94984633fc1208ebc3c3", + "events_redactions": [ + "home path -> $HOME", + "repository path -> $REPO" + ], + "request_and_response_files": { + "long-cold.request.json.gz": { + "uncompressed_sha256": "b04fa4b841a929f325df016ae1e022fc901c66eb60ed70137a64838652b06620", + "uncompressed_bytes": 310882 + }, + "long-follow-cold.request.json.gz": { + "uncompressed_sha256": "d427ba75aa7fcc238575c16fc7d98b8049101ea9810968ed84edfdc90c99dbbb", + "uncompressed_bytes": 311006 + }, + "long-resumed.request.json.gz": { + "uncompressed_sha256": "d427ba75aa7fcc238575c16fc7d98b8049101ea9810968ed84edfdc90c99dbbb", + "uncompressed_bytes": 311006 + }, + "reset-cold.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "long-cold.response.json.gz": { + "uncompressed_sha256": "a3c8250c84ea1c0985b7ebee80a713bbf083ff91e095b4f544eb57e0754d6a06", + "uncompressed_bytes": 758 + }, + "long-follow-cold.response.json.gz": { + "uncompressed_sha256": "496aff3ff9497663c126395b3bdb275eca7b27928126e7227dc2f9bd197f5dbe", + "uncompressed_bytes": 758 + }, + "long-resumed.response.json.gz": { + "uncompressed_sha256": "75d990f561714e2def67348b03cfe236d4dfe6765993d4003a2e8ad5167a2f0d", + "uncompressed_bytes": 758 + }, + "reset-cold.response.json.gz": { + "uncompressed_sha256": "e9f53daa0280eff3044295a64909c092a1acc39584c7e0a619c7c1b513c6ba85", + "uncompressed_bytes": 697 + } + }, + "executed_instrument_sha256": "c01cdae01c1a72317dcbd916edac4f40eba39dea92ea6a5f04f8bbade5a9e679", + "reconstructed_input_ids": { + "long-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 65536, + "uncompressed_sha256": "2b23ea92ab6f56af80c144209a2272dd17608b6dfed83ac2aa22eb3cf927db37" + }, + "long-follow-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 65565, + "uncompressed_sha256": "8eef90fd60081138111b712ba2a7495d70c83cd0b9b8b3614860ec675e493db9" + }, + "long-resumed.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 65565, + "uncompressed_sha256": "8eef90fd60081138111b712ba2a7495d70c83cd0b9b8b3614860ec675e493db9" + }, + "reset-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + } + }, + "additional_evidence": { + "runner.py.gz": { + "uncompressed_sha256": "c01cdae01c1a72317dcbd916edac4f40eba39dea92ea6a5f04f8bbade5a9e679", + "uncompressed_bytes": 8951 + }, + "server.log.gz": { + "uncompressed_sha256": "cbcd848fedcacdf7a6189c94b77581b4c84c7705d2d0c23b5fda5498e02baab4", + "uncompressed_bytes": 3319 + } + }, + "actual_long_prompt_utf8_sha256": "ecf14e1a43fd687fb8dd1522b1fb34c7db0ec781098af45196ad31de32e13b41", + "metadata_correction": "The legacy identity.fixture_sha256 field in these runs names the short lighthouse fixture. Use actual_long_prompt_utf8_sha256 and the preserved request body for the long input." + }, + { + "stage": "long128", + "run": "long128-20261101T141204Z", + "verdict": "PASS", + "timing_qualified": false, + "source_events_sha256": "543e02883faf12fc0a43cac2ae2575cf20f58b79c7069e1bf400881c268e6b7c", + "events_redactions": [ + "home path -> $HOME", + "repository path -> $REPO" + ], + "request_and_response_files": { + "long-cold.request.json.gz": { + "uncompressed_sha256": "c6444e63b2252a2f2726db82c4617509d67d4df02ea80381b371ac7d2f9915cf", + "uncompressed_bytes": 607521 + }, + "long-follow-cold.request.json.gz": { + "uncompressed_sha256": "4ecfbe3ec985561e6a23c670efc3f776216b72035fd32aeca9787454f5a549f2", + "uncompressed_bytes": 607645 + }, + "long-resumed.request.json.gz": { + "uncompressed_sha256": "4ecfbe3ec985561e6a23c670efc3f776216b72035fd32aeca9787454f5a549f2", + "uncompressed_bytes": 607645 + }, + "reset-cold.request.json.gz": { + "uncompressed_sha256": "cfca1d0df17c2356d60d6d1b906d460c2e4f14ddc412a3742bb7da9922d972ad", + "uncompressed_bytes": 198 + }, + "long-cold.response.json.gz": { + "uncompressed_sha256": "ce07a45f4b08928faaf4da7a4ddd9682ddd23b99f09cac5a5dab034e502a30a5", + "uncompressed_bytes": 760 + }, + "long-follow-cold.response.json.gz": { + "uncompressed_sha256": "eea0f64049a2e1f67c11279165d6abe31704b6711f7df33922bef383346c2f3b", + "uncompressed_bytes": 760 + }, + "long-resumed.response.json.gz": { + "uncompressed_sha256": "94bebd8492ff55f72b4d501d8fd746b46145a34e654c819de4fbba387e941afa", + "uncompressed_bytes": 760 + }, + "reset-cold.response.json.gz": { + "uncompressed_sha256": "8aca6ea5a958fb5e2857f23af6297a3e2430258e7c2efe8762d8bff572b489d1", + "uncompressed_bytes": 697 + } + }, + "executed_instrument_sha256": "1c6f7292dccf9f0172fa5905c7b8febac4e22bf67abc0929c7f8ae33e32c8b8e", + "reconstructed_input_ids": { + "long-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 128000, + "uncompressed_sha256": "232f4b6243cc2df723390e78e370d2e6a9eb08b4217aea8947b699f6d8741240" + }, + "long-follow-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 128029, + "uncompressed_sha256": "15391c69086f06c36115fd13f7b38abcd640539b002b479481a9c890756c4435" + }, + "long-resumed.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 128029, + "uncompressed_sha256": "15391c69086f06c36115fd13f7b38abcd640539b002b479481a9c890756c4435" + }, + "reset-cold.request.u32le.gz": { + "format": "little-endian u32", + "tokens": 19, + "uncompressed_sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4" + } + }, + "additional_evidence": { + "runner.py.gz": { + "uncompressed_sha256": "1c6f7292dccf9f0172fa5905c7b8febac4e22bf67abc0929c7f8ae33e32c8b8e", + "uncompressed_bytes": 10951 + }, + "server.log.gz": { + "uncompressed_sha256": "f8704ef461c1d2b9f50ec2b49fb47d3cabccaf71dc19634075ecb0aacb6d377c", + "uncompressed_bytes": 3333 + } + }, + "actual_long_prompt_utf8_sha256": "f9e788c807dc36f75fd9621d1eb35e213bc260cee7be0c9dd493be64d70d1e0c", + "metadata_correction": "The legacy identity.fixture_sha256 field in these runs names the short lighthouse fixture. Use actual_long_prompt_utf8_sha256 and the preserved request body for the long input." + } + ] +} diff --git a/docs/qwen38/qualification-20261101/long128/events.jsonl b/docs/qwen38/qualification-20261101/long128/events.jsonl new file mode 100644 index 00000000..c45ed4dc --- /dev/null +++ b/docs/qwen38/qualification-20261101/long128/events.jsonl @@ -0,0 +1,9 @@ +{"event": "identity", "utc": "2026-11-01T14:12:04Z", "binary": "$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "sha256": "df9360112fdc815539f3e289fccfd8070845129ef4ccb466bb90c729ec71d0e5", "model": "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "source_core": "46134247", "source_omega": "0010f7d30bcaf0012e8051c5a05584a08d8320ec", "window": null, "timing_label": "shared-correctness-only", "tool_source": "1c6f7292dccf9f0172fa5905c7b8febac4e22bf67abc0929c7f8ae33e32c8b8e", "stage": "long128", "fixture_sha256": "f1130c77f0ca13fe86eb3187b26a203268eea357918acf6ae9568a3c28eb2868", "meminfo": "MemTotal: 127598532 kB\nMemFree: 53261160 kB\nMemAvailable: 109627180 kB\nBuffers: 6172452 kB\nCached: 50851728 kB\nSwapCached: 0 kB\nActive: 7159764 kB\nInactive: 53201568 kB\nActive(anon): 5113248 kB\nInactive(anon): 2653260 kB\nActive(file): 2046516 kB\nInactive(file): 50548308 kB\nUnevictable: 30880 kB\nMlocked: 22772 kB\nSwapTotal: 0 kB\nSwapFree: 0 kB\nZswap: 0 kB\nZswapped: 0 kB\nDirty: 13724 kB\nWriteback: 0 kB\nAnonPages: 3367972 kB\nMapped: 1269576 kB\nShmem: 4427696 kB\nKReclaimable: 9964820 kB\nSlab: 11472352 kB\nSReclaimable: 9964820 kB\nSUnreclaim: 1507532 kB\nKernelStack: 33056 kB\nShadowCallStack: 8192 kB\nPageTables: 54568 kB\nSecPageTables: 30516 kB\nNFS_Unstable: 0 kB\nBounce: 0 kB\nWritebackTmp: 0 kB\nCommitLimit: 63799264 kB\nCommitted_AS: 18230784 kB\nVmallocTotal: 135288315904 kB\nVmallocUsed: 124420 kB\nVmallocChunk: 0 kB\nPercpu: 28800 kB\nHardwareCorrupted: 0 kB\nAnonHugePages: 6144 kB\nShmemHugePages: 0 kB\nShmemPmdMapped: 0 kB\nFileHugePages: 575488 kB\nFilePmdMapped: 16384 kB\nCmaTotal: 0 kB\nCmaFree: 196044 kB\nBalloon: 0 kB\nHugePages_Total: 0\nHugePages_Free: 0\nHugePages_Rsvd: 0\nHugePages_Surp: 0\nHugepagesize: 2048 kB\nHugetlb: 0 kB\n", "loadavg": "2.18 4.39 4.91 4/2024 2788352\n"} +{"event": "launched", "utc": "2026-11-01T14:12:04Z", "pid": 2788353, "command": ["$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "--engine", "omega", "--model-dir", "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "--port", "18196", "--max-context", "131072", "--max-tokens-cap", "16384", "--thinking", "off"]} +{"event": "ready", "utc": "2026-11-01T14:12:45Z", "load_wall_s": 41.031645810988266, "models": {"object": "list", "data": [{"id": "qwen3.8-27b-fp8", "object": "model", "created": 1793542365, "owned_by": "aien/omega-qwen38"}]}} +{"event": "request", "utc": "2026-11-01T14:27:42Z", "name": "long-cold", "wall_s": 896.9750427950057, "usage": {"completion_tokens": 9, "prompt_tokens": 128000, "total_tokens": 128009}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: serving qwen3.8-27b-fp8 at http://127.0.0.1:18196/v1 (engine omega)", "aien-serve-http: qwen38: lock wait 0 ms, prompt 128000 tok, reuse Cold (0 tok), fed 128000 (0 stepped), prefill 894596 ms (gemm chip 295017 ms, gdn chip 24244 ms, attn chip 299876 ms, host 90131 ms, restore 0 ms, snapshot 50 ms), decode 9 tok in 2219 ms, graph chip 275.8 ms/token, wall 277.4 ms/token", "aien-serve-http: chatcmpl-18e3f1475d0d83460000: prompt 128000 tok, reply 9 tok, finish stop, prefill 894596 ms, decode 2219 ms (4.06 tok/s), sampling mode=greedy seed=1793542365429725206 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:27:45Z", "name": "long-resumed", "wall_s": 3.5190704119740985, "usage": {"completion_tokens": 9, "prompt_tokens": 128029, "total_tokens": 128038}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f1475d0d83460000: prompt 128000 tok, reply 9 tok, finish stop, prefill 894596 ms, decode 2219 ms (4.06 tok/s), sampling mode=greedy seed=1793542365429725206 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 128029 tok, reuse Live(128009) (128009 tok), fed 20 (0 stepped), prefill 1185 ms (gemm chip 316 ms, gdn chip 12 ms, attn chip 702 ms, host 107 ms, restore 0 ms, snapshot 12 ms), decode 9 tok in 2207 ms, graph chip 274.7 ms/token, wall 275.9 ms/token", "aien-serve-http: chatcmpl-18e3f218333a5dc80001: prompt 128029 tok, reply 9 tok, finish stop, prefill 1185 ms, decode 2207 ms (4.08 tok/s), sampling mode=greedy seed=1793543266671152408 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:27:46Z", "name": "reset-cold", "wall_s": 0.6059576299740002, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f218333a5dc80001: prompt 128029 tok, reply 9 tok, finish stop, prefill 1185 ms, decode 2207 ms (4.08 tok/s), sampling mode=greedy seed=1793543266671152408 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 477 ms (gemm chip 317 ms, gdn chip 12 ms, attn chip 1 ms, host 102 ms, restore 0 ms, snapshot 10 ms), decode 1 tok in 127 ms, graph chip 125.8 ms/token, wall 127.0 ms/token", "aien-serve-http: chatcmpl-18e3f218fd9f35a90002: prompt 19 tok, reply 1 tok, finish stop, prefill 477 ms, decode 127 ms (7.87 tok/s), sampling mode=greedy seed=1793543274361728633 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:42:34Z", "name": "long-follow-cold", "wall_s": 888.1273071979522, "usage": {"completion_tokens": 9, "prompt_tokens": 128029, "total_tokens": 128038}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f218fd9f35a90002: prompt 19 tok, reply 1 tok, finish stop, prefill 477 ms, decode 127 ms (7.87 tok/s), sampling mode=greedy seed=1793543274361728633 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 128029 tok, reuse Cold (0 tok), fed 128029 (0 stepped), prefill 885812 ms (gemm chip 293206 ms, gdn chip 24167 ms, attn chip 297300 ms, host 89031 ms, restore 0 ms, snapshot 9 ms), decode 9 tok in 2178 ms, graph chip 271.2 ms/token, wall 272.2 ms/token", "aien-serve-http: chatcmpl-18e3f21929f51ddf0003: prompt 128029 tok, reply 9 tok, finish stop, prefill 885812 ms, decode 2178 ms (4.13 tok/s), sampling mode=greedy seed=1793543270810586463 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "completed", "utc": "2026-11-01T14:42:34Z", "verdict": "PASS", "scope": "long128"} +{"event": "cleanup", "utc": "2026-11-01T14:42:36Z", "server_exit": 0} diff --git a/docs/qwen38/qualification-20261101/long128/long-cold.request.json.gz b/docs/qwen38/qualification-20261101/long128/long-cold.request.json.gz new file mode 100644 index 00000000..bd122245 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long128/long-cold.request.u32le.gz new file mode 100644 index 00000000..b47a55c7 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-cold.response.json.gz b/docs/qwen38/qualification-20261101/long128/long-cold.response.json.gz new file mode 100644 index 00000000..ec0c2aa9 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-follow-cold.request.json.gz b/docs/qwen38/qualification-20261101/long128/long-follow-cold.request.json.gz new file mode 100644 index 00000000..06818d24 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-follow-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-follow-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long128/long-follow-cold.request.u32le.gz new file mode 100644 index 00000000..223a0705 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-follow-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-follow-cold.response.json.gz b/docs/qwen38/qualification-20261101/long128/long-follow-cold.response.json.gz new file mode 100644 index 00000000..805f74d6 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-follow-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-resumed.request.json.gz b/docs/qwen38/qualification-20261101/long128/long-resumed.request.json.gz new file mode 100644 index 00000000..06818d24 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-resumed.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-resumed.request.u32le.gz b/docs/qwen38/qualification-20261101/long128/long-resumed.request.u32le.gz new file mode 100644 index 00000000..223a0705 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-resumed.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/long-resumed.response.json.gz b/docs/qwen38/qualification-20261101/long128/long-resumed.response.json.gz new file mode 100644 index 00000000..02531be2 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/long-resumed.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/reset-cold.request.json.gz b/docs/qwen38/qualification-20261101/long128/reset-cold.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/reset-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/reset-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long128/reset-cold.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/reset-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/reset-cold.response.json.gz b/docs/qwen38/qualification-20261101/long128/reset-cold.response.json.gz new file mode 100644 index 00000000..c06c698c Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/reset-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/runner.py.gz b/docs/qwen38/qualification-20261101/long128/runner.py.gz new file mode 100644 index 00000000..5b875bd0 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/runner.py.gz differ diff --git a/docs/qwen38/qualification-20261101/long128/server.log.gz b/docs/qwen38/qualification-20261101/long128/server.log.gz new file mode 100644 index 00000000..d30b486d Binary files /dev/null and b/docs/qwen38/qualification-20261101/long128/server.log.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/events.jsonl b/docs/qwen38/qualification-20261101/long32/events.jsonl new file mode 100644 index 00000000..c3cd9a30 --- /dev/null +++ b/docs/qwen38/qualification-20261101/long32/events.jsonl @@ -0,0 +1,9 @@ +{"event": "identity", "utc": "2026-11-01T13:47:07Z", "binary": "$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "sha256": "df9360112fdc815539f3e289fccfd8070845129ef4ccb466bb90c729ec71d0e5", "model": "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "source_core": "46134247", "source_omega": "0010f7d30bcaf0012e8051c5a05584a08d8320ec", "window": "20261101T134705Z-9066f5", "tool_source": "676bb868bdaddeeeaaa638e52c5b851cf0a6f052272cff3cd0c473b195390d99", "stage": "long32", "fixture_sha256": "f1130c77f0ca13fe86eb3187b26a203268eea357918acf6ae9568a3c28eb2868", "meminfo": "MemTotal: 127598532 kB\nMemFree: 48055956 kB\nMemAvailable: 110344528 kB\nBuffers: 5575632 kB\nCached: 56123892 kB\nSwapCached: 0 kB\nActive: 6691180 kB\nInactive: 58246292 kB\nActive(anon): 5337404 kB\nInactive(anon): 2330048 kB\nActive(file): 1353776 kB\nInactive(file): 55916244 kB\nUnevictable: 30880 kB\nMlocked: 22772 kB\nSwapTotal: 0 kB\nSwapFree: 0 kB\nZswap: 0 kB\nZswapped: 0 kB\nDirty: 34400 kB\nWriteback: 0 kB\nAnonPages: 3269556 kB\nMapped: 1109032 kB\nShmem: 4427696 kB\nKReclaimable: 11212176 kB\nSlab: 12796908 kB\nSReclaimable: 11212176 kB\nSUnreclaim: 1584732 kB\nKernelStack: 32096 kB\nShadowCallStack: 8312 kB\nPageTables: 50812 kB\nSecPageTables: 29220 kB\nNFS_Unstable: 0 kB\nBounce: 0 kB\nWritebackTmp: 0 kB\nCommitLimit: 63799264 kB\nCommitted_AS: 18167036 kB\nVmallocTotal: 135288315904 kB\nVmallocUsed: 123208 kB\nVmallocChunk: 0 kB\nPercpu: 29840 kB\nHardwareCorrupted: 0 kB\nAnonHugePages: 6144 kB\nShmemHugePages: 0 kB\nShmemPmdMapped: 0 kB\nFileHugePages: 102400 kB\nFilePmdMapped: 0 kB\nCmaTotal: 0 kB\nCmaFree: 225928 kB\nBalloon: 0 kB\nHugePages_Total: 0\nHugePages_Free: 0\nHugePages_Rsvd: 0\nHugePages_Surp: 0\nHugepagesize: 2048 kB\nHugetlb: 0 kB\n", "loadavg": "1.95 1.95 1.74 2/1972 2044827\n"} +{"event": "launched", "utc": "2026-11-01T13:47:07Z", "pid": 2044828, "command": ["$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "--engine", "omega", "--model-dir", "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "--port", "18196", "--max-context", "131072", "--max-tokens-cap", "16384", "--thinking", "off"]} +{"event": "ready", "utc": "2026-11-01T13:47:33Z", "load_wall_s": 26.025804308999795, "models": {"object": "list", "data": [{"id": "qwen3.8-27b-fp8", "object": "model", "created": 1793540853, "owned_by": "aien/omega-qwen38"}]}} +{"event": "request", "utc": "2026-11-01T13:50:23Z", "name": "long-cold", "wall_s": 169.65291392599465, "usage": {"completion_tokens": 9, "prompt_tokens": 32768, "total_tokens": 32777}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: serving qwen3.8-27b-fp8 at http://127.0.0.1:18196/v1 (engine omega)", "aien-serve-http: qwen38: lock wait 0 ms, prompt 32768 tok, reuse Cold (0 tok), fed 32768 (0 stepped), prefill 168205 ms (gemm chip 74408 ms, gdn chip 6035 ms, attn chip 21252 ms, host 21777 ms, restore 0 ms, snapshot 41 ms), decode 9 tok in 1414 ms, graph chip 175.4 ms/token, wall 176.8 ms/token", "aien-serve-http: chatcmpl-18e3efe769a9b3690000: prompt 32768 tok, reply 9 tok, finish stop, prefill 168205 ms, decode 1414 ms (6.36 tok/s), sampling mode=greedy seed=1793540853812799849 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T13:50:25Z", "name": "long-resumed", "wall_s": 2.0982229209621437, "usage": {"completion_tokens": 9, "prompt_tokens": 32797, "total_tokens": 32806}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3efe769a9b3690000: prompt 32768 tok, reply 9 tok, finish stop, prefill 168205 ms, decode 1414 ms (6.36 tok/s), sampling mode=greedy seed=1793540853812799849 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 32797 tok, reuse Live(32777) (32777 tok), fed 20 (0 stepped), prefill 636 ms (gemm chip 315 ms, gdn chip 12 ms, attn chip 181 ms, host 83 ms, restore 0 ms, snapshot 11 ms), decode 9 tok in 1417 ms, graph chip 175.7 ms/token, wall 177.1 ms/token", "aien-serve-http: chatcmpl-18e3f00eea813ebb0001: prompt 32797 tok, reply 9 tok, finish stop, prefill 636 ms, decode 1417 ms (6.35 tok/s), sampling mode=greedy seed=1793541027773100507 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T13:50:26Z", "name": "reset-cold", "wall_s": 0.5906186820357107, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f00eea813ebb0001: prompt 32797 tok, reply 9 tok, finish stop, prefill 636 ms, decode 1417 ms (6.35 tok/s), sampling mode=greedy seed=1793541027773100507 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 460 ms (gemm chip 318 ms, gdn chip 12 ms, attn chip 1 ms, host 84 ms, restore 0 ms, snapshot 11 ms), decode 1 tok in 128 ms, graph chip 126.7 ms/token, wall 128.0 ms/token", "aien-serve-http: chatcmpl-18e3f00f6500f0860002: prompt 19 tok, reply 1 tok, finish stop, prefill 460 ms, decode 128 ms (7.81 tok/s), sampling mode=greedy seed=1793541016943389142 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T13:53:19Z", "name": "long-follow-cold", "wall_s": 172.95540462899953, "usage": {"completion_tokens": 9, "prompt_tokens": 32797, "total_tokens": 32806}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f00f6500f0860002: prompt 19 tok, reply 1 tok, finish stop, prefill 460 ms, decode 128 ms (7.81 tok/s), sampling mode=greedy seed=1793541016943389142 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 32797 tok, reuse Cold (0 tok), fed 32797 (0 stepped), prefill 171506 ms (gemm chip 75190 ms, gdn chip 6061 ms, attn chip 21366 ms, host 21989 ms, restore 0 ms, snapshot 10 ms), decode 9 tok in 1399 ms, graph chip 173.6 ms/token, wall 174.9 ms/token", "aien-serve-http: chatcmpl-18e3f00f8b1c0ff90003: prompt 32797 tok, reply 9 tok, finish stop, prefill 171506 ms, decode 1399 ms (6.43 tok/s), sampling mode=greedy seed=1793541013287730537 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "completed", "utc": "2026-11-01T13:53:19Z", "verdict": "PASS", "scope": "long32"} +{"event": "cleanup", "utc": "2026-11-01T13:53:20Z", "server_exit": 0} diff --git a/docs/qwen38/qualification-20261101/long32/long-cold.request.json.gz b/docs/qwen38/qualification-20261101/long32/long-cold.request.json.gz new file mode 100644 index 00000000..78bd9948 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long32/long-cold.request.u32le.gz new file mode 100644 index 00000000..c17d99ee Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-cold.response.json.gz b/docs/qwen38/qualification-20261101/long32/long-cold.response.json.gz new file mode 100644 index 00000000..00f07887 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-follow-cold.request.json.gz b/docs/qwen38/qualification-20261101/long32/long-follow-cold.request.json.gz new file mode 100644 index 00000000..a583c1a5 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-follow-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-follow-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long32/long-follow-cold.request.u32le.gz new file mode 100644 index 00000000..e303b916 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-follow-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-follow-cold.response.json.gz b/docs/qwen38/qualification-20261101/long32/long-follow-cold.response.json.gz new file mode 100644 index 00000000..abc3bb01 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-follow-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-resumed.request.json.gz b/docs/qwen38/qualification-20261101/long32/long-resumed.request.json.gz new file mode 100644 index 00000000..a583c1a5 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-resumed.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-resumed.request.u32le.gz b/docs/qwen38/qualification-20261101/long32/long-resumed.request.u32le.gz new file mode 100644 index 00000000..e303b916 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-resumed.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/long-resumed.response.json.gz b/docs/qwen38/qualification-20261101/long32/long-resumed.response.json.gz new file mode 100644 index 00000000..867efd34 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/long-resumed.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/reset-cold.request.json.gz b/docs/qwen38/qualification-20261101/long32/reset-cold.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/reset-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/reset-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long32/reset-cold.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/reset-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/reset-cold.response.json.gz b/docs/qwen38/qualification-20261101/long32/reset-cold.response.json.gz new file mode 100644 index 00000000..b8a76850 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/reset-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/runner.py.gz b/docs/qwen38/qualification-20261101/long32/runner.py.gz new file mode 100644 index 00000000..e7bb1549 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/runner.py.gz differ diff --git a/docs/qwen38/qualification-20261101/long32/server.log.gz b/docs/qwen38/qualification-20261101/long32/server.log.gz new file mode 100644 index 00000000..050a9f31 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long32/server.log.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/events.jsonl b/docs/qwen38/qualification-20261101/long64/events.jsonl new file mode 100644 index 00000000..40927244 --- /dev/null +++ b/docs/qwen38/qualification-20261101/long64/events.jsonl @@ -0,0 +1,9 @@ +{"event": "identity", "utc": "2026-11-01T13:53:24Z", "binary": "$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "sha256": "df9360112fdc815539f3e289fccfd8070845129ef4ccb466bb90c729ec71d0e5", "model": "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "source_core": "46134247", "source_omega": "0010f7d30bcaf0012e8051c5a05584a08d8320ec", "window": null, "timing_label": "shared-correctness-only", "tool_source": "c01cdae01c1a72317dcbd916edac4f40eba39dea92ea6a5f04f8bbade5a9e679", "stage": "long64", "fixture_sha256": "f1130c77f0ca13fe86eb3187b26a203268eea357918acf6ae9568a3c28eb2868", "meminfo": "MemTotal: 127598532 kB\nMemFree: 49058056 kB\nMemAvailable: 109575300 kB\nBuffers: 5882348 kB\nCached: 52671624 kB\nSwapCached: 0 kB\nActive: 7205596 kB\nInactive: 54458532 kB\nActive(anon): 5253276 kB\nInactive(anon): 2286192 kB\nActive(file): 1952320 kB\nInactive(file): 52172340 kB\nUnevictable: 30880 kB\nMlocked: 22772 kB\nSwapTotal: 0 kB\nSwapFree: 0 kB\nZswap: 0 kB\nZswapped: 0 kB\nDirty: 55188 kB\nWriteback: 0 kB\nAnonPages: 3141444 kB\nMapped: 1088912 kB\nShmem: 4427704 kB\nKReclaimable: 12586208 kB\nSlab: 14286008 kB\nSReclaimable: 12586208 kB\nSUnreclaim: 1699800 kB\nKernelStack: 32016 kB\nShadowCallStack: 8032 kB\nPageTables: 50384 kB\nSecPageTables: 29620 kB\nNFS_Unstable: 0 kB\nBounce: 0 kB\nWritebackTmp: 0 kB\nCommitLimit: 63799264 kB\nCommitted_AS: 18368460 kB\nVmallocTotal: 135288315904 kB\nVmallocUsed: 123152 kB\nVmallocChunk: 0 kB\nPercpu: 30080 kB\nHardwareCorrupted: 0 kB\nAnonHugePages: 6144 kB\nShmemHugePages: 0 kB\nShmemPmdMapped: 0 kB\nFileHugePages: 180224 kB\nFilePmdMapped: 0 kB\nCmaTotal: 0 kB\nCmaFree: 1547824 kB\nBalloon: 0 kB\nHugePages_Total: 0\nHugePages_Free: 0\nHugePages_Rsvd: 0\nHugePages_Surp: 0\nHugepagesize: 2048 kB\nHugetlb: 0 kB\n", "loadavg": "5.05 5.65 3.63 5/1965 2285768\n"} +{"event": "launched", "utc": "2026-11-01T13:53:24Z", "pid": 2285770, "command": ["$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "--engine", "omega", "--model-dir", "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "--port", "18196", "--max-context", "131072", "--max-tokens-cap", "16384", "--thinking", "off"]} +{"event": "ready", "utc": "2026-11-01T13:53:53Z", "load_wall_s": 29.02536390197929, "models": {"object": "list", "data": [{"id": "qwen3.8-27b-fp8", "object": "model", "created": 1793541233, "owned_by": "aien/omega-qwen38"}]}} +{"event": "request", "utc": "2026-11-01T14:00:15Z", "name": "long-cold", "wall_s": 382.3180065290071, "usage": {"completion_tokens": 9, "prompt_tokens": 65536, "total_tokens": 65545}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: serving qwen3.8-27b-fp8 at http://127.0.0.1:18196/v1 (engine omega)", "aien-serve-http: qwen38: lock wait 0 ms, prompt 65536 tok, reuse Cold (0 tok), fed 65536 (0 stepped), prefill 380560 ms (gemm chip 149662 ms, gdn chip 12046 ms, attn chip 79821 ms, host 46006 ms, restore 0 ms, snapshot 43 ms), decode 9 tok in 1692 ms, graph chip 209.8 ms/token, wall 211.5 ms/token", "aien-serve-http: chatcmpl-18e3f03fcbfb822c0000: prompt 65536 tok, reply 9 tok, finish stop, prefill 380560 ms, decode 1692 ms (5.32 tok/s), sampling mode=greedy seed=1793541233419449980 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:00:18Z", "name": "long-resumed", "wall_s": 2.6048842879827134, "usage": {"completion_tokens": 9, "prompt_tokens": 65565, "total_tokens": 65574}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f03fcbfb822c0000: prompt 65536 tok, reply 9 tok, finish stop, prefill 380560 ms, decode 1692 ms (5.32 tok/s), sampling mode=greedy seed=1793541233419449980 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 65565 tok, reuse Live(65545) (65545 tok), fed 20 (0 stepped), prefill 823 ms (gemm chip 314 ms, gdn chip 12 ms, attn chip 360 ms, host 89 ms, restore 0 ms, snapshot 11 ms), decode 9 tok in 1693 ms, graph chip 210.1 ms/token, wall 211.6 ms/token", "aien-serve-http: chatcmpl-18e3f098d15788000001: prompt 65565 tok, reply 9 tok, finish stop, prefill 823 ms, decode 1693 ms (5.32 tok/s), sampling mode=greedy seed=1793541620056422224 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:00:18Z", "name": "reset-cold", "wall_s": 0.6283381099929102, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f098d15788000001: prompt 65565 tok, reply 9 tok, finish stop, prefill 823 ms, decode 1693 ms (5.32 tok/s), sampling mode=greedy seed=1793541620056422224 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 499 ms (gemm chip 313 ms, gdn chip 12 ms, attn chip 1 ms, host 128 ms, restore 0 ms, snapshot 10 ms), decode 1 tok in 127 ms, graph chip 126.0 ms/token, wall 127.0 ms/token", "aien-serve-http: chatcmpl-18e3f099676e9ba10002: prompt 19 tok, reply 1 tok, finish stop, prefill 499 ms, decode 127 ms (7.87 tok/s), sampling mode=greedy seed=1793541626869487521 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:06:44Z", "name": "long-follow-cold", "wall_s": 385.46651873202063, "usage": {"completion_tokens": 9, "prompt_tokens": 65565, "total_tokens": 65574}, "token_ids_sha256": "a2c7ee6342949c376d1b44915afe8e89f4a0a74e372881bdedb71fdeab151a98", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f099676e9ba10002: prompt 19 tok, reply 1 tok, finish stop, prefill 499 ms, decode 127 ms (7.87 tok/s), sampling mode=greedy seed=1793541626869487521 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 65565 tok, reuse Cold (0 tok), fed 65565 (0 stepped), prefill 383697 ms (gemm chip 151113 ms, gdn chip 12088 ms, attn chip 80572 ms, host 45813 ms, restore 0 ms, snapshot 12 ms), decode 9 tok in 1684 ms, graph chip 209.1 ms/token, wall 210.5 ms/token", "aien-serve-http: chatcmpl-18e3f09991e072200003: prompt 65565 tok, reply 9 tok, finish stop, prefill 383697 ms, decode 1684 ms (5.34 tok/s), sampling mode=greedy seed=1793541623286620096 temp=0 top_p=0.95 top_k=20 greedy=10 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "completed", "utc": "2026-11-01T14:06:44Z", "verdict": "PASS", "scope": "long64"} +{"event": "cleanup", "utc": "2026-11-01T14:06:45Z", "server_exit": 0} diff --git a/docs/qwen38/qualification-20261101/long64/long-cold.request.json.gz b/docs/qwen38/qualification-20261101/long64/long-cold.request.json.gz new file mode 100644 index 00000000..8a7ac54d Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long64/long-cold.request.u32le.gz new file mode 100644 index 00000000..7b9c6fce Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-cold.response.json.gz b/docs/qwen38/qualification-20261101/long64/long-cold.response.json.gz new file mode 100644 index 00000000..d53c4507 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-follow-cold.request.json.gz b/docs/qwen38/qualification-20261101/long64/long-follow-cold.request.json.gz new file mode 100644 index 00000000..09be9df7 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-follow-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-follow-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long64/long-follow-cold.request.u32le.gz new file mode 100644 index 00000000..0d509612 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-follow-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-follow-cold.response.json.gz b/docs/qwen38/qualification-20261101/long64/long-follow-cold.response.json.gz new file mode 100644 index 00000000..5c2e9296 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-follow-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-resumed.request.json.gz b/docs/qwen38/qualification-20261101/long64/long-resumed.request.json.gz new file mode 100644 index 00000000..09be9df7 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-resumed.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-resumed.request.u32le.gz b/docs/qwen38/qualification-20261101/long64/long-resumed.request.u32le.gz new file mode 100644 index 00000000..0d509612 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-resumed.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/long-resumed.response.json.gz b/docs/qwen38/qualification-20261101/long64/long-resumed.response.json.gz new file mode 100644 index 00000000..03809aa1 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/long-resumed.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/reset-cold.request.json.gz b/docs/qwen38/qualification-20261101/long64/reset-cold.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/reset-cold.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/reset-cold.request.u32le.gz b/docs/qwen38/qualification-20261101/long64/reset-cold.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/reset-cold.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/reset-cold.response.json.gz b/docs/qwen38/qualification-20261101/long64/reset-cold.response.json.gz new file mode 100644 index 00000000..b8d7483c Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/reset-cold.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/runner.py.gz b/docs/qwen38/qualification-20261101/long64/runner.py.gz new file mode 100644 index 00000000..2f9fe2ef Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/runner.py.gz differ diff --git a/docs/qwen38/qualification-20261101/long64/server.log.gz b/docs/qwen38/qualification-20261101/long64/server.log.gz new file mode 100644 index 00000000..7c03a922 Binary files /dev/null and b/docs/qwen38/qualification-20261101/long64/server.log.gz differ diff --git a/docs/qwen38/qualification-20261101/short/correctness-summary.txt.gz b/docs/qwen38/qualification-20261101/short/correctness-summary.txt.gz new file mode 100644 index 00000000..42a5b7a3 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/correctness-summary.txt.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode0.request.json.gz b/docs/qwen38/qualification-20261101/short/decode0.request.json.gz new file mode 100644 index 00000000..14ec9986 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode0.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode0.request.u32le.gz b/docs/qwen38/qualification-20261101/short/decode0.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode0.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode0.response.json.gz b/docs/qwen38/qualification-20261101/short/decode0.response.json.gz new file mode 100644 index 00000000..bf03a3cf Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode0.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode1.request.json.gz b/docs/qwen38/qualification-20261101/short/decode1.request.json.gz new file mode 100644 index 00000000..14ec9986 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode1.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode1.request.u32le.gz b/docs/qwen38/qualification-20261101/short/decode1.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode1.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode1.response.json.gz b/docs/qwen38/qualification-20261101/short/decode1.response.json.gz new file mode 100644 index 00000000..b4eae387 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode1.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode2.request.json.gz b/docs/qwen38/qualification-20261101/short/decode2.request.json.gz new file mode 100644 index 00000000..14ec9986 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode2.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode2.request.u32le.gz b/docs/qwen38/qualification-20261101/short/decode2.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode2.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode2.response.json.gz b/docs/qwen38/qualification-20261101/short/decode2.response.json.gz new file mode 100644 index 00000000..ce220b21 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode2.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode3.request.json.gz b/docs/qwen38/qualification-20261101/short/decode3.request.json.gz new file mode 100644 index 00000000..14ec9986 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode3.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode3.request.u32le.gz b/docs/qwen38/qualification-20261101/short/decode3.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode3.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode3.response.json.gz b/docs/qwen38/qualification-20261101/short/decode3.response.json.gz new file mode 100644 index 00000000..66ede3b2 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode3.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode4.request.json.gz b/docs/qwen38/qualification-20261101/short/decode4.request.json.gz new file mode 100644 index 00000000..14ec9986 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode4.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode4.request.u32le.gz b/docs/qwen38/qualification-20261101/short/decode4.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode4.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode4.response.json.gz b/docs/qwen38/qualification-20261101/short/decode4.response.json.gz new file mode 100644 index 00000000..2a96a0cc Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode4.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode5.request.json.gz b/docs/qwen38/qualification-20261101/short/decode5.request.json.gz new file mode 100644 index 00000000..14ec9986 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode5.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode5.request.u32le.gz b/docs/qwen38/qualification-20261101/short/decode5.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode5.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/decode5.response.json.gz b/docs/qwen38/qualification-20261101/short/decode5.response.json.gz new file mode 100644 index 00000000..c1cd7983 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/decode5.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/events.jsonl b/docs/qwen38/qualification-20261101/short/events.jsonl new file mode 100644 index 00000000..28f0dc1f --- /dev/null +++ b/docs/qwen38/qualification-20261101/short/events.jsonl @@ -0,0 +1,21 @@ +{"event": "identity", "utc": "2026-11-01T14:44:03Z", "binary": "$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "sha256": "df9360112fdc815539f3e289fccfd8070845129ef4ccb466bb90c729ec71d0e5", "model": "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "source_core": "46134247", "source_omega": "0010f7d30bcaf0012e8051c5a05584a08d8320ec", "window": "20261101T144401Z-72e543", "timing_label": "window", "tool_source": "48b26d6a2f678480851066e51244e93c536dcd1e13712a81f3081fb87b0355e7", "stage": "short", "fixture_sha256": "f1130c77f0ca13fe86eb3187b26a203268eea357918acf6ae9568a3c28eb2868", "meminfo": "MemTotal: 127598532 kB\nMemFree: 57378412 kB\nMemAvailable: 110295988 kB\nBuffers: 4992080 kB\nCached: 49133312 kB\nSwapCached: 0 kB\nActive: 6653716 kB\nInactive: 50729676 kB\nActive(anon): 4849064 kB\nInactive(anon): 2690564 kB\nActive(file): 1804652 kB\nInactive(file): 48039112 kB\nUnevictable: 30880 kB\nMlocked: 22772 kB\nSwapTotal: 0 kB\nSwapFree: 0 kB\nZswap: 0 kB\nZswapped: 0 kB\nDirty: 18280 kB\nWriteback: 0 kB\nAnonPages: 3288212 kB\nMapped: 904200 kB\nShmem: 4279980 kB\nKReclaimable: 9267436 kB\nSlab: 10686200 kB\nSReclaimable: 9267436 kB\nSUnreclaim: 1418764 kB\nKernelStack: 34512 kB\nShadowCallStack: 9304 kB\nPageTables: 58684 kB\nSecPageTables: 32184 kB\nNFS_Unstable: 0 kB\nBounce: 0 kB\nWritebackTmp: 0 kB\nCommitLimit: 63799264 kB\nCommitted_AS: 18565044 kB\nVmallocTotal: 135288315904 kB\nVmallocUsed: 126604 kB\nVmallocChunk: 0 kB\nPercpu: 28720 kB\nHardwareCorrupted: 0 kB\nAnonHugePages: 0 kB\nShmemHugePages: 0 kB\nShmemPmdMapped: 0 kB\nFileHugePages: 880640 kB\nFilePmdMapped: 0 kB\nCmaTotal: 0 kB\nCmaFree: 1362668 kB\nBalloon: 0 kB\nHugePages_Total: 0\nHugePages_Free: 0\nHugePages_Rsvd: 0\nHugePages_Surp: 0\nHugepagesize: 2048 kB\nHugetlb: 0 kB\n", "loadavg": "3.71 5.56 6.29 2/2116 3611307\n"} +{"event": "launched", "utc": "2026-11-01T14:44:03Z", "pid": 3611308, "command": ["$HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http", "--engine", "omega", "--model-dir", "$HOME/models/qwen3.8-27b-fp8-017b9c7a", "--port", "18196", "--max-context", "131072", "--max-tokens-cap", "16384", "--thinking", "off"]} +{"event": "ready", "utc": "2026-11-01T14:44:51Z", "load_wall_s": 48.04105805599829, "models": {"object": "list", "data": [{"id": "qwen3.8-27b-fp8", "object": "model", "created": 1793544291, "owned_by": "aien/omega-qwen38"}]}} +{"event": "correctness_gate", "utc": "2026-11-01T14:45:21Z", "rc": 0, "summary": "server http://127.0.0.1:18196 pid 3611308\nserver binary sha256 df9360112fdc815539f3e289fccfd8070845129ef4ccb466bb90c729ec71d0e5 ($HOME/.local/state/aien-q38/bin-fast-46134247/aien-serve-http)\nserver build unknown (binary has no --version)\nmodel dir $HOME/models/qwen3.8-27b-fp8-017b9c7a\ngolden $REPO/crates/aien-inference-abi/fixtures/qwen38/gen-chat-max-24.json sha256 b5ec54942008264aa6e0c4b046a93985a23ad78ac5d1f937524b9d72ad9c0666\ngolden ids want [71093,66,198,390,1866,1494,264,11,514,292,8,313,198,262,460,318,64,835,292,8,907,264,535,292]\ngolden ids got [71093,66,198,390,1866,1494,264,11,514,292,8,313,198,262,460,318,64,835,292,8,907,264,535,292]\nPASS golden: 24 greedy ids equal the host reference\nPASS golden: prompt is the reference's 24 tokens\nPASS golden repeat: same ids\nPASS control (smaller): ids differ from the golden (must)\nturn2 resumed [71093,66,198,390,1866,18,1494,264,11,514,292,11,514,272,8,313,198,262,514,295,283,318,64,835]\nturn2 cold [71093,66,198,390,1866,18,1494,264,11,514,292,11,514,272,8,313,198,262,514,295,283,318,64,835]\ngolden: reuse Cold\nturn2b_resumed: reuse Snapshot(17)\nturn2_resumed: reuse Live(47)\nturn3_resumed: reuse Live(93)\ncontrol: reuse Cold\nturn2_cold: reuse Cold\nturn2b_cold: reuse Cold\nturn3_cold: reuse Cold\nPASS turn 2b (edited reply) reused the snapshot\nPASS turn 2 resumed request reused a state\nturn2b resumed [71093,66,198,390,1866,3456,48332,1494,264,11,514,292,11,514,272,8,313,198,262,514,1866,283,264,26]\nturn2b cold [71093,66,198,390,1866,3456,48332,1494,264,11,514,292,11,514,272,8,313,198,262,514,1866,283,264,26]\nPASS turn 2b resumed (snapshot) == cold\nPASS turn 3 resumed request reused a state\nPASS cold requests ran cold\nPASS turn 2 resumed == cold\nturn3 resumed [2523,2224]\nturn3 cold [2523,2224]\nPASS turn 3 resumed == cold\nPASS turn 2 differs from turn 1 (no stale reply)\ngolden text: ```c\nint max(int a, int b) {\n return (a > b) ? a : b\nGATE PASS\ngolden ids against the shipped reference: MATCH\n"} +{"event": "request", "utc": "2026-11-01T14:45:54Z", "name": "warmup", "wall_s": 32.55539868597407, "usage": {"completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}, "token_ids_sha256": "eed890a9a80207dc06049703ca507bba95a2ea0cd550996913543d87b560c131", "finish_reason": "length", "server_lines": ["aien-serve-http: chatcmpl-18e3f30e7e52ce080009: prompt 110 tok, reply 2 tok, finish stop, prefill 792 ms, decode 253 ms (7.91 tok/s), sampling mode=greedy seed=1793544290133263768 temp=0 top_p=0.95 top_k=20 greedy=3 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 30 tok, reuse Cold (0 tok), fed 30 (0 stepped), prefill 475 ms (gemm chip 313 ms, gdn chip 13 ms, attn chip 1 ms, host 90 ms, restore 0 ms, snapshot 9 ms), decode 256 tok in 32078 ms, graph chip 124.7 ms/token, wall 125.8 ms/token", "aien-serve-http: chatcmpl-18e3f30eccc65973000a: prompt 30 tok, reply 256 tok, finish length, prefill 475 ms, decode 32078 ms (7.98 tok/s), sampling mode=greedy seed=1793544278564558083 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:45:54Z", "name": "reset0", "wall_s": 0.5681916550383903, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f30eccc65973000a: prompt 30 tok, reply 256 tok, finish length, prefill 475 ms, decode 32078 ms (7.98 tok/s), sampling mode=greedy seed=1793544278564558083 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 440 ms (gemm chip 310 ms, gdn chip 12 ms, attn chip 1 ms, host 74 ms, restore 0 ms, snapshot 9 ms), decode 1 tok in 126 ms, graph chip 124.6 ms/token, wall 126.0 ms/token", "aien-serve-http: chatcmpl-18e3f3166142f5b8000b: prompt 19 tok, reply 1 tok, finish stop, prefill 440 ms, decode 126 ms (7.94 tok/s), sampling mode=greedy seed=1793544384134967560 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:46:27Z", "name": "decode0", "wall_s": 32.618910615041386, "usage": {"completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}, "token_ids_sha256": "eed890a9a80207dc06049703ca507bba95a2ea0cd550996913543d87b560c131", "finish_reason": "length", "server_lines": ["aien-serve-http: chatcmpl-18e3f3166142f5b8000b: prompt 19 tok, reply 1 tok, finish stop, prefill 440 ms, decode 126 ms (7.94 tok/s), sampling mode=greedy seed=1793544384134967560 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 30 tok, reuse Cold (0 tok), fed 30 (0 stepped), prefill 458 ms (gemm chip 312 ms, gdn chip 13 ms, attn chip 2 ms, host 74 ms, restore 0 ms, snapshot 10 ms), decode 256 tok in 32159 ms, graph chip 125.0 ms/token, wall 126.1 ms/token", "aien-serve-http: chatcmpl-18e3f316832a3907000c: prompt 30 tok, reply 256 tok, finish length, prefill 458 ms, decode 32159 ms (7.96 tok/s), sampling mode=greedy seed=1793544371818869687 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:46:27Z", "name": "reset1", "wall_s": 0.5991690280498005, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f316832a3907000c: prompt 30 tok, reply 256 tok, finish length, prefill 458 ms, decode 32159 ms (7.96 tok/s), sampling mode=greedy seed=1793544371818869687 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 471 ms (gemm chip 311 ms, gdn chip 12 ms, attn chip 1 ms, host 103 ms, restore 0 ms, snapshot 9 ms), decode 1 tok in 126 ms, graph chip 125.3 ms/token, wall 126.0 ms/token", "aien-serve-http: chatcmpl-18e3f31e1b719767000d: prompt 19 tok, reply 1 tok, finish stop, prefill 471 ms, decode 126 ms (7.94 tok/s), sampling mode=greedy seed=1793544340013944967 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:47:00Z", "name": "decode1", "wall_s": 32.63698655599728, "usage": {"completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}, "token_ids_sha256": "eed890a9a80207dc06049703ca507bba95a2ea0cd550996913543d87b560c131", "finish_reason": "length", "server_lines": ["aien-serve-http: chatcmpl-18e3f31e1b719767000d: prompt 19 tok, reply 1 tok, finish stop, prefill 471 ms, decode 126 ms (7.94 tok/s), sampling mode=greedy seed=1793544340013944967 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 30 tok, reuse Cold (0 tok), fed 30 (0 stepped), prefill 507 ms (gemm chip 312 ms, gdn chip 13 ms, attn chip 2 ms, host 124 ms, restore 0 ms, snapshot 9 ms), decode 256 tok in 32128 ms, graph chip 124.8 ms/token, wall 126.0 ms/token", "aien-serve-http: chatcmpl-18e3f31e3f30b0d1000e: prompt 30 tok, reply 256 tok, finish length, prefill 507 ms, decode 32128 ms (7.97 tok/s), sampling mode=greedy seed=1793544327728769713 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:47:01Z", "name": "reset2", "wall_s": 0.6154058090178296, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f31e3f30b0d1000e: prompt 30 tok, reply 256 tok, finish length, prefill 507 ms, decode 32128 ms (7.97 tok/s), sampling mode=greedy seed=1793544327728769713 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 484 ms (gemm chip 307 ms, gdn chip 11 ms, attn chip 1 ms, host 121 ms, restore 0 ms, snapshot 10 ms), decode 1 tok in 129 ms, graph chip 128.1 ms/token, wall 129.0 ms/token", "aien-serve-http: chatcmpl-18e3f325d88acc65000f: prompt 19 tok, reply 1 tok, finish stop, prefill 484 ms, decode 129 ms (7.75 tok/s), sampling mode=greedy seed=1793544441970738485 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:47:33Z", "name": "decode2", "wall_s": 32.726758955046535, "usage": {"completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}, "token_ids_sha256": "eed890a9a80207dc06049703ca507bba95a2ea0cd550996913543d87b560c131", "finish_reason": "length", "server_lines": ["aien-serve-http: chatcmpl-18e3f325d88acc65000f: prompt 19 tok, reply 1 tok, finish stop, prefill 484 ms, decode 129 ms (7.75 tok/s), sampling mode=greedy seed=1793544441970738485 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 30 tok, reuse Cold (0 tok), fed 30 (0 stepped), prefill 531 ms (gemm chip 315 ms, gdn chip 14 ms, attn chip 2 ms, host 143 ms, restore 0 ms, snapshot 10 ms), decode 256 tok in 32193 ms, graph chip 125.0 ms/token, wall 126.2 ms/token", "aien-serve-http: chatcmpl-18e3f325fd42cffe0010: prompt 30 tok, reply 256 tok, finish length, prefill 531 ms, decode 32193 ms (7.95 tok/s), sampling mode=greedy seed=1793544489831418590 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:47:34Z", "name": "reset3", "wall_s": 0.6456191620090976, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f325fd42cffe0010: prompt 30 tok, reply 256 tok, finish length, prefill 531 ms, decode 32193 ms (7.95 tok/s), sampling mode=greedy seed=1793544489831418590 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 517 ms (gemm chip 308 ms, gdn chip 11 ms, attn chip 1 ms, host 151 ms, restore 0 ms, snapshot 10 ms), decode 1 tok in 126 ms, graph chip 125.0 ms/token, wall 126.0 ms/token", "aien-serve-http: chatcmpl-18e3f32d9bf6ef800011: prompt 19 tok, reply 1 tok, finish stop, prefill 517 ms, decode 126 ms (7.94 tok/s), sampling mode=greedy seed=1793544518263826848 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:48:07Z", "name": "decode3", "wall_s": 32.79684998904122, "usage": {"completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}, "token_ids_sha256": "eed890a9a80207dc06049703ca507bba95a2ea0cd550996913543d87b560c131", "finish_reason": "length", "server_lines": ["aien-serve-http: chatcmpl-18e3f32d9bf6ef800011: prompt 19 tok, reply 1 tok, finish stop, prefill 517 ms, decode 126 ms (7.94 tok/s), sampling mode=greedy seed=1793544518263826848 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 30 tok, reuse Cold (0 tok), fed 30 (0 stepped), prefill 531 ms (gemm chip 317 ms, gdn chip 14 ms, attn chip 2 ms, host 143 ms, restore 0 ms, snapshot 9 ms), decode 256 tok in 32263 ms, graph chip 125.4 ms/token, wall 126.5 ms/token", "aien-serve-http: chatcmpl-18e3f32dc27abb610012: prompt 30 tok, reply 256 tok, finish length, prefill 531 ms, decode 32263 ms (7.93 tok/s), sampling mode=greedy seed=1793544531794900785 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:48:07Z", "name": "reset4", "wall_s": 0.5700831380090676, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f32dc27abb610012: prompt 30 tok, reply 256 tok, finish length, prefill 531 ms, decode 32263 ms (7.93 tok/s), sampling mode=greedy seed=1793544531794900785 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 438 ms (gemm chip 310 ms, gdn chip 11 ms, attn chip 1 ms, host 71 ms, restore 0 ms, snapshot 10 ms), decode 1 tok in 130 ms, graph chip 129.3 ms/token, wall 130.0 ms/token", "aien-serve-http: chatcmpl-18e3f335655d456e0013: prompt 19 tok, reply 1 tok, finish stop, prefill 438 ms, decode 130 ms (7.69 tok/s), sampling mode=greedy seed=1793544422858506734 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:48:40Z", "name": "decode4", "wall_s": 32.904840200033505, "usage": {"completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}, "token_ids_sha256": "eed890a9a80207dc06049703ca507bba95a2ea0cd550996913543d87b560c131", "finish_reason": "length", "server_lines": ["aien-serve-http: chatcmpl-18e3f335655d456e0013: prompt 19 tok, reply 1 tok, finish stop, prefill 438 ms, decode 130 ms (7.69 tok/s), sampling mode=greedy seed=1793544422858506734 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 30 tok, reuse Cold (0 tok), fed 30 (0 stepped), prefill 480 ms (gemm chip 317 ms, gdn chip 14 ms, attn chip 2 ms, host 90 ms, restore 0 ms, snapshot 10 ms), decode 256 tok in 32423 ms, graph chip 126.0 ms/token, wall 127.1 ms/token", "aien-serve-http: chatcmpl-18e3f3358761ccf80014: prompt 30 tok, reply 256 tok, finish length, prefill 480 ms, decode 32423 ms (7.90 tok/s), sampling mode=greedy seed=1793544401954391848 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "request", "utc": "2026-11-01T14:48:41Z", "name": "stream-reset", "wall_s": 0.5896153060020879, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f3358761ccf80014: prompt 30 tok, reply 256 tok, finish length, prefill 480 ms, decode 32423 ms (7.90 tok/s), sampling mode=greedy seed=1793544401954391848 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 459 ms (gemm chip 310 ms, gdn chip 11 ms, attn chip 1 ms, host 94 ms, restore 0 ms, snapshot 9 ms), decode 1 tok in 128 ms, graph chip 126.5 ms/token, wall 128.0 ms/token", "aien-serve-http: chatcmpl-18e3f33d30b367a80015: prompt 19 tok, reply 1 tok, finish stop, prefill 459 ms, decode 128 ms (7.81 tok/s), sampling mode=greedy seed=1793544430564893160 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"]} +{"event": "stream", "utc": "2026-11-01T14:49:14Z", "first_visible_s": 0.4900324070476927, "completed_s": 32.865948373044375, "usage": {"aien_sampling": {"greedy_tokens": 256, "kept": [], "kept_max": 0, "kept_mean": 0.0, "kept_median": 0, "kept_min": 0, "kept_single": 0, "mode": "greedy", "p_repeat": 1.0, "reply_logprob": 0.0, "sampled_tokens": 0, "seed": 1793544444039955000, "temperature": 0.0, "top_k": 20, "top_k_applied": false, "top_p": 0.949999988079071, "top_prob_mean": 1.0, "top_prob_min": 1.0}, "aien_token_ids": [2, 2732, 3986, 303, 279, 11908, 25, 357, 10776, 314, 436, 21204, 19154, 271, 2381, 92325, 11, 279, 9117, 682, 978, 2107, 21265, 725, 11848, 25882, 321, 1141, 1379, 39888, 31126, 13, 1946, 20239, 279, 4118, 10685, 757, 13255, 7718, 11, 53653, 69090, 1091, 11, 321, 30787, 66725, 11, 66509, 599, 38589, 383, 799, 314, 279, 1379, 25438, 13976, 303, 3611, 3712, 25, 279, 324, 55965, 13, 13065, 777, 1056, 4145, 38409, 314, 9506, 11, 324, 21204, 19154, 3875, 264, 18677, 4368, 314, 28069, 18204, 11, 41052, 43136, 11, 321, 3611, 53113, 13, 10643, 3712, 369, 264, 58170, 310, 279, 50032, 12229, 310, 48827, 279, 9496, 11, 39577, 494, 26699, 3807, 59823, 310, 25924, 11, 26606, 381, 72869, 421, 8214, 29001, 440, 19861, 15579, 13, 271, 13962, 561, 35725, 67139, 25, 6438, 321, 31860, 271, 760, 7059, 314, 264, 55394, 49577, 369, 430, 2235, 430, 500, 2492, 3144, 4924, 13, 5546, 1518, 279, 7832, 314, 11886, 38409, 11, 13437, 3474, 38384, 38589, 383, 5629, 57902, 466, 12955, 25250, 12647, 383, 1496, 4751, 310, 8028, 5902, 66148, 1052, 13, 4213, 11, 279, 1118, 804, 324, 55965, 11, 430, 264, 14884, 11, 43439, 5759, 11, 369, 13177, 28639, 310, 279, 13437, 58635, 13, 271, 760, 1379, 10919, 314, 1439, 3988, 13976, 557, 279, 2972, 3248, 240424, 314, 54248, 93868, 5617, 303, 279, 220, 18, 6295, 9018, 75887, 383, 279, 12552, 314, 84552, 428, 303, 14437, 13, 9364, 290, 539, 387, 951, 273, 2329, 353, 326, 24587, 321, 7888, 1172, 387, 951, 273, 2329, 7696, 11, 279, 84552, 428], "completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}} +{"event": "request", "utc": "2026-11-01T14:50:12Z", "name": "reset5", "wall_s": 0.6099553059902973, "usage": {"completion_tokens": 1, "prompt_tokens": 19, "total_tokens": 20}, "token_ids_sha256": "fdaf75c43612dfe7c9e51a5d02472d729702822abce4fde6d648c8fbab14dce9", "finish_reason": "stop", "server_lines": ["aien-serve-http: chatcmpl-18e3f34db4c39f37001c: prompt 56 tok, reply 146 tok, finish stop, prefill 554 ms, decode 18714 ms (7.80 tok/s), sampling mode=greedy seed=1793544608874207639 temp=0 top_p=0.95 top_k=20 greedy=147 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 19 tok, reuse Cold (0 tok), fed 19 (0 stepped), prefill 448 ms (gemm chip 318 ms, gdn chip 12 ms, attn chip 1 ms, host 72 ms, restore 0 ms, snapshot 10 ms), decode 1 tok in 128 ms, graph chip 126.5 ms/token, wall 128.0 ms/token", "aien-serve-http: chatcmpl-18e3f35278196ab7001d: prompt 19 tok, reply 1 tok, finish stop, prefill 448 ms, decode 128 ms (7.81 tok/s), sampling mode=greedy seed=1793544599266485447 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"], "instrument": "replacement-short"} +{"event": "request", "utc": "2026-11-01T14:50:45Z", "name": "decode5", "wall_s": 33.04565382900182, "usage": {"completion_tokens": 256, "prompt_tokens": 30, "total_tokens": 286}, "token_ids_sha256": "eed890a9a80207dc06049703ca507bba95a2ea0cd550996913543d87b560c131", "finish_reason": "length", "server_lines": ["aien-serve-http: chatcmpl-18e3f35278196ab7001d: prompt 19 tok, reply 1 tok, finish stop, prefill 448 ms, decode 128 ms (7.81 tok/s), sampling mode=greedy seed=1793544599266485447 temp=0 top_p=0.95 top_k=20 greedy=2 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0", "aien-serve-http: qwen38: lock wait 0 ms, prompt 30 tok, reuse Cold (0 tok), fed 30 (0 stepped), prefill 496 ms (gemm chip 322 ms, gdn chip 14 ms, attn chip 2 ms, host 99 ms, restore 0 ms, snapshot 11 ms), decode 256 tok in 32548 ms, graph chip 126.4 ms/token, wall 127.6 ms/token", "aien-serve-http: chatcmpl-18e3f3529a96d31b001e: prompt 30 tok, reply 256 tok, finish length, prefill 496 ms, decode 32548 ms (7.87 tok/s), sampling mode=greedy seed=1793544586960227691 temp=0 top_p=0.95 top_k=20 greedy=256 sampled=0 kept(min/med/mean/max)=0/0/0.00/0 kept1=0/0 top_prob(min/mean)=1.0000/1.0000 p_repeat=1.000e0"], "instrument": "replacement-short"} +{"event": "completed", "utc": "2026-11-01T14:50:45Z", "verdict": "PASS", "scope": "short"} +{"event": "cleanup", "utc": "2026-11-01T14:50:47Z", "server_exit": 0} diff --git a/docs/qwen38/qualification-20261101/short/quality-coding-repeat.request.json.gz b/docs/qwen38/qualification-20261101/short/quality-coding-repeat.request.json.gz new file mode 100644 index 00000000..2653b86b Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding-repeat.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding-repeat.request.u32le.gz b/docs/qwen38/qualification-20261101/short/quality-coding-repeat.request.u32le.gz new file mode 100644 index 00000000..d2c2cf9d Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding-repeat.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding-repeat.response.json.gz b/docs/qwen38/qualification-20261101/short/quality-coding-repeat.response.json.gz new file mode 100644 index 00000000..d19ccf52 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding-repeat.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding-reset.request.json.gz b/docs/qwen38/qualification-20261101/short/quality-coding-reset.request.json.gz new file mode 100644 index 00000000..20b4c031 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding-reset.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding-reset.request.u32le.gz b/docs/qwen38/qualification-20261101/short/quality-coding-reset.request.u32le.gz new file mode 100644 index 00000000..ea26c728 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding-reset.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding-reset.response.json.gz b/docs/qwen38/qualification-20261101/short/quality-coding-reset.response.json.gz new file mode 100644 index 00000000..0175085c Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding-reset.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding.request.json.gz b/docs/qwen38/qualification-20261101/short/quality-coding.request.json.gz new file mode 100644 index 00000000..2653b86b Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding.request.u32le.gz b/docs/qwen38/qualification-20261101/short/quality-coding.request.u32le.gz new file mode 100644 index 00000000..d2c2cf9d Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-coding.response.json.gz b/docs/qwen38/qualification-20261101/short/quality-coding.response.json.gz new file mode 100644 index 00000000..6a8810e2 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-coding.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-fixtures.json.gz b/docs/qwen38/qualification-20261101/short/quality-fixtures.json.gz new file mode 100644 index 00000000..1dc96fdd Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-fixtures.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-instrument.py.gz b/docs/qwen38/qualification-20261101/short/quality-instrument.py.gz new file mode 100644 index 00000000..cae2e1e0 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-instrument.py.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose-repeat.request.json.gz b/docs/qwen38/qualification-20261101/short/quality-prose-repeat.request.json.gz new file mode 100644 index 00000000..2118c3ad Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose-repeat.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose-repeat.request.u32le.gz b/docs/qwen38/qualification-20261101/short/quality-prose-repeat.request.u32le.gz new file mode 100644 index 00000000..a46fc468 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose-repeat.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose-repeat.response.json.gz b/docs/qwen38/qualification-20261101/short/quality-prose-repeat.response.json.gz new file mode 100644 index 00000000..bfd6050d Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose-repeat.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose-reset.request.json.gz b/docs/qwen38/qualification-20261101/short/quality-prose-reset.request.json.gz new file mode 100644 index 00000000..20b4c031 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose-reset.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose-reset.request.u32le.gz b/docs/qwen38/qualification-20261101/short/quality-prose-reset.request.u32le.gz new file mode 100644 index 00000000..ea26c728 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose-reset.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose-reset.response.json.gz b/docs/qwen38/qualification-20261101/short/quality-prose-reset.response.json.gz new file mode 100644 index 00000000..2b779bbf Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose-reset.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose-review.json.gz b/docs/qwen38/qualification-20261101/short/quality-prose-review.json.gz new file mode 100644 index 00000000..3cd4a910 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose-review.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose.request.json.gz b/docs/qwen38/qualification-20261101/short/quality-prose.request.json.gz new file mode 100644 index 00000000..2118c3ad Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose.request.u32le.gz b/docs/qwen38/qualification-20261101/short/quality-prose.request.u32le.gz new file mode 100644 index 00000000..a46fc468 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-prose.response.json.gz b/docs/qwen38/qualification-20261101/short/quality-prose.response.json.gz new file mode 100644 index 00000000..26c3f9ce Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-prose.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/quality-results.json.gz b/docs/qwen38/qualification-20261101/short/quality-results.json.gz new file mode 100644 index 00000000..987bace1 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/quality-results.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset0.request.json.gz b/docs/qwen38/qualification-20261101/short/reset0.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset0.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset0.request.u32le.gz b/docs/qwen38/qualification-20261101/short/reset0.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset0.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset0.response.json.gz b/docs/qwen38/qualification-20261101/short/reset0.response.json.gz new file mode 100644 index 00000000..04da9db3 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset0.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset1.request.json.gz b/docs/qwen38/qualification-20261101/short/reset1.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset1.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset1.request.u32le.gz b/docs/qwen38/qualification-20261101/short/reset1.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset1.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset1.response.json.gz b/docs/qwen38/qualification-20261101/short/reset1.response.json.gz new file mode 100644 index 00000000..f4ea6d9b Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset1.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset2.request.json.gz b/docs/qwen38/qualification-20261101/short/reset2.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset2.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset2.request.u32le.gz b/docs/qwen38/qualification-20261101/short/reset2.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset2.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset2.response.json.gz b/docs/qwen38/qualification-20261101/short/reset2.response.json.gz new file mode 100644 index 00000000..da192994 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset2.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset3.request.json.gz b/docs/qwen38/qualification-20261101/short/reset3.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset3.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset3.request.u32le.gz b/docs/qwen38/qualification-20261101/short/reset3.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset3.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset3.response.json.gz b/docs/qwen38/qualification-20261101/short/reset3.response.json.gz new file mode 100644 index 00000000..96519ccb Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset3.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset4.request.json.gz b/docs/qwen38/qualification-20261101/short/reset4.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset4.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset4.request.u32le.gz b/docs/qwen38/qualification-20261101/short/reset4.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset4.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset4.response.json.gz b/docs/qwen38/qualification-20261101/short/reset4.response.json.gz new file mode 100644 index 00000000..a382dabb Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset4.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset5.request.json.gz b/docs/qwen38/qualification-20261101/short/reset5.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset5.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset5.request.u32le.gz b/docs/qwen38/qualification-20261101/short/reset5.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset5.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/reset5.response.json.gz b/docs/qwen38/qualification-20261101/short/reset5.response.json.gz new file mode 100644 index 00000000..276f64ec Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/reset5.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/runner.py.gz b/docs/qwen38/qualification-20261101/short/runner.py.gz new file mode 100644 index 00000000..9d0ad88e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/runner.py.gz differ diff --git a/docs/qwen38/qualification-20261101/short/server.log.gz b/docs/qwen38/qualification-20261101/short/server.log.gz new file mode 100644 index 00000000..1b13b581 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/server.log.gz differ diff --git a/docs/qwen38/qualification-20261101/short/stream-reset.request.json.gz b/docs/qwen38/qualification-20261101/short/stream-reset.request.json.gz new file mode 100644 index 00000000..434b275f Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/stream-reset.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/stream-reset.request.u32le.gz b/docs/qwen38/qualification-20261101/short/stream-reset.request.u32le.gz new file mode 100644 index 00000000..4cb97c02 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/stream-reset.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/stream-reset.response.json.gz b/docs/qwen38/qualification-20261101/short/stream-reset.response.json.gz new file mode 100644 index 00000000..76eb54a7 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/stream-reset.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/stream.request.json.gz b/docs/qwen38/qualification-20261101/short/stream.request.json.gz new file mode 100644 index 00000000..2fbd12b6 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/stream.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/stream.request.u32le.gz b/docs/qwen38/qualification-20261101/short/stream.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/stream.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/stream.response.sse.gz b/docs/qwen38/qualification-20261101/short/stream.response.sse.gz new file mode 100644 index 00000000..9e34b2ac Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/stream.response.sse.gz differ diff --git a/docs/qwen38/qualification-20261101/short/timing-exclusion.json.gz b/docs/qwen38/qualification-20261101/short/timing-exclusion.json.gz new file mode 100644 index 00000000..0531283c Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/timing-exclusion.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/warmup.request.json.gz b/docs/qwen38/qualification-20261101/short/warmup.request.json.gz new file mode 100644 index 00000000..14ec9986 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/warmup.request.json.gz differ diff --git a/docs/qwen38/qualification-20261101/short/warmup.request.u32le.gz b/docs/qwen38/qualification-20261101/short/warmup.request.u32le.gz new file mode 100644 index 00000000..63e5243e Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/warmup.request.u32le.gz differ diff --git a/docs/qwen38/qualification-20261101/short/warmup.response.json.gz b/docs/qwen38/qualification-20261101/short/warmup.response.json.gz new file mode 100644 index 00000000..e7943626 Binary files /dev/null and b/docs/qwen38/qualification-20261101/short/warmup.response.json.gz differ diff --git a/docs/qwen38/qualification-20261101/tokenizer-provenance.json b/docs/qwen38/qualification-20261101/tokenizer-provenance.json new file mode 100644 index 00000000..286cc40e --- /dev/null +++ b/docs/qwen38/qualification-20261101/tokenizer-provenance.json @@ -0,0 +1,240 @@ +{ + "method": "Reconstruction using the exact serving Core revision tokenizer source, same checked tokenizer/template files and tokenizers 0.21.4; not a live GPU memory dump.", + "source_core": "46134247", + "source_sha256": "6677852903356eb51c0695c93394fec4f726d7aa014738ca4dc93af01cc7c5bd", + "instrument_sha256": "e60e99c64632b0e53f6eed93e7098adf7dfaae556b4a3e5356db1b185d1a0df5", + "binary_sha256": "bfe70b3367ded733037ca42d3e5ba23810662e72bfeae220727c175878af4690", + "inputs": [ + { + "run": "short-20261101T144403Z", + "file": "decode0.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "decode1.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "decode2.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "decode3.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "decode4.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "decode5.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "quality-coding-repeat.request.u32le", + "tokens": 71, + "sha256": "987ac94c5eb3437c83381effa6cfaa74e46d92a533f7488c091234782c6904a1", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "quality-coding-reset.request.u32le", + "tokens": 16, + "sha256": "57d5fc75af30d46ca10967b54492dc8e88b3804e1ce200ee236dd9e200baf6cb", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "quality-coding.request.u32le", + "tokens": 71, + "sha256": "987ac94c5eb3437c83381effa6cfaa74e46d92a533f7488c091234782c6904a1", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "quality-prose-repeat.request.u32le", + "tokens": 56, + "sha256": "a855942b34cc9d42492d871f691292c3438b4d3e0fb93f22f59436a7a052d5eb", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "quality-prose-reset.request.u32le", + "tokens": 16, + "sha256": "57d5fc75af30d46ca10967b54492dc8e88b3804e1ce200ee236dd9e200baf6cb", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "quality-prose.request.u32le", + "tokens": 56, + "sha256": "a855942b34cc9d42492d871f691292c3438b4d3e0fb93f22f59436a7a052d5eb", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "reset0.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "reset1.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "reset2.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "reset3.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "reset4.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "reset5.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "stream-reset.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "stream.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "short-20261101T144403Z", + "file": "warmup.request.u32le", + "tokens": 30, + "sha256": "6454e84adc8f7914afacd79e0e2f9dd587aba942f130d0ae87f259fa1ba045f5", + "matches_server_usage": true + }, + { + "run": "long32-20261101T134707Z", + "file": "long-cold.request.u32le", + "tokens": 32768, + "sha256": "0d559732aa0a4d1649bf25f087776b8a8ff5a21f80a571f832899950f52e1648", + "matches_server_usage": true + }, + { + "run": "long32-20261101T134707Z", + "file": "long-follow-cold.request.u32le", + "tokens": 32797, + "sha256": "13637dccd190c539c1920a111c9b11d247d38457bfb722e86b0e96e1713f41c4", + "matches_server_usage": true + }, + { + "run": "long32-20261101T134707Z", + "file": "long-resumed.request.u32le", + "tokens": 32797, + "sha256": "13637dccd190c539c1920a111c9b11d247d38457bfb722e86b0e96e1713f41c4", + "matches_server_usage": true + }, + { + "run": "long32-20261101T134707Z", + "file": "reset-cold.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "long64-20261101T135324Z", + "file": "long-cold.request.u32le", + "tokens": 65536, + "sha256": "2b23ea92ab6f56af80c144209a2272dd17608b6dfed83ac2aa22eb3cf927db37", + "matches_server_usage": true + }, + { + "run": "long64-20261101T135324Z", + "file": "long-follow-cold.request.u32le", + "tokens": 65565, + "sha256": "8eef90fd60081138111b712ba2a7495d70c83cd0b9b8b3614860ec675e493db9", + "matches_server_usage": true + }, + { + "run": "long64-20261101T135324Z", + "file": "long-resumed.request.u32le", + "tokens": 65565, + "sha256": "8eef90fd60081138111b712ba2a7495d70c83cd0b9b8b3614860ec675e493db9", + "matches_server_usage": true + }, + { + "run": "long64-20261101T135324Z", + "file": "reset-cold.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + }, + { + "run": "long128-20261101T141204Z", + "file": "long-cold.request.u32le", + "tokens": 128000, + "sha256": "232f4b6243cc2df723390e78e370d2e6a9eb08b4217aea8947b699f6d8741240", + "matches_server_usage": true + }, + { + "run": "long128-20261101T141204Z", + "file": "long-follow-cold.request.u32le", + "tokens": 128029, + "sha256": "15391c69086f06c36115fd13f7b38abcd640539b002b479481a9c890756c4435", + "matches_server_usage": true + }, + { + "run": "long128-20261101T141204Z", + "file": "long-resumed.request.u32le", + "tokens": 128029, + "sha256": "15391c69086f06c36115fd13f7b38abcd640539b002b479481a9c890756c4435", + "matches_server_usage": true + }, + { + "run": "long128-20261101T141204Z", + "file": "reset-cold.request.u32le", + "tokens": 19, + "sha256": "58c118cd04c7c4b6640b3cd86328dbf621127cf5750eb986bf131adf39ecf3f4", + "matches_server_usage": true + } + ] +} diff --git a/om/README.md b/om/README.md index 502120fb..79e74ce0 100644 --- a/om/README.md +++ b/om/README.md @@ -7,6 +7,7 @@ aien-architecture-mv#300). | Path | What it is | Status | |---|---|---| +| `ribbon/pipeline.om` | Bounded known-demand read/verify/copy/publication controller. Tickets bind generations; cancellation preserves in-flight buffer ownership. Optional `ribbon-omega` caller attachment in the expert pager uses Omega Bridge's generated native declarations. | Host oracle, compiled mutants and native attachment checks in `ribbon/run.sh` and `ribbon/check_native.py`; see `ribbon/README.md` for build and device-evidence boundaries. | | `effects/world.om` | The restart world check of the effect ledger: reads the target file, hashes it, decides DONE / NOT_DONE / UNRESOLVED like `effects::state_from`, and writes the reconcile record text and its sha256 like `effects::reconcile_text`. | Byte-identical to the Rust on 24 fixtures (`effects/run.sh`). Not wired into the daemon. | | `tur-ledger/tur-ledger.om` | Aienet-0 test-credit ledger CLI: v2 genesis pins issuer, independent verifier and account/node policy. Canonical mutations require issuer signatures; settlement also requires verifier authorization over signed-job, result and attestation digests and the reserved quote. Single-writer hash chain, fsync, recovery, integer conservation and exactly-once settle remain. See `tur-ledger/README.md`. | Host admission/durability tests and guard mutants in `tur-ledger/check.sh`; no wallet, Core RPC or public economic qualification. Historical unsigned v1 receipts remain historical. | | `flint/manifest.om` | Bounded manifest reader for the pinned Flint BF16 checkpoint (RecursiveSI/flint `2a247be0`, Core #802 P0): admits config, index and every safetensors header, refuses anything outside the pinned layout with a distinct exit code, prints the tensor inventory TSV. See `flint/README.md`. | Host: `flint/check.sh` 89/89 with the downloaded checkpoint and the operator arm (38 refusal fixtures, 25 guard mutants; 70 without the operator arm). | diff --git a/om/ribbon/.crumb b/om/ribbon/.crumb new file mode 100644 index 00000000..4c2c270b --- /dev/null +++ b/om/ribbon/.crumb @@ -0,0 +1,10 @@ +{ + "schema_version": "1.0.0", + "name": "ribbon", + "purpose": "Bounded known-demand expert pipeline policy in Omega, with independent host ownership tests. Caller transport and GPU integration are separate.", + "invariants": [ + "An expert is published only after verified read and completed device copy. Check: om/ribbon/run.sh", + "Cancellation, timeout and shutdown retain in-flight buffer ownership until completion acknowledges it. Check: om/ribbon/run.sh", + "Stale generations, pinned eviction and staging-budget overruns are refused. Check: om/ribbon/run.sh" + ] +} diff --git a/om/ribbon/QUALIFICATION.md b/om/ribbon/QUALIFICATION.md new file mode 100644 index 00000000..6c4744de --- /dev/null +++ b/om/ribbon/QUALIFICATION.md @@ -0,0 +1,136 @@ +# Ribbon pipeline experiment, 2026-11-01 + +The compiled Omega controller and model attachment passed the ownership, +failure and exact-output checks below. Two active buffers improved median +paired decode throughput by **1.6864x** over the +synchronous one-buffer control. The existing grouped path remains the default. +Its single reference run was faster, but had kernel allocation messages during +its interval and is not a clean performance qualification. This is a development experiment, +not a pinned native release qualification or a deployment. + +## Full model + +Qwen3-30B-A3B-Instruct-2507 FP8, one fixed prompt, 16 generated tokens, greedy, +768 expert slots, eight read workers and eight reserved staging buffers. The +controller admits one or two active buffers from that pool. Each trial starts +a new process and empty expert cache. Checkpoint reads use `O_DIRECT`. +One grouped reference and the first run of each control mode are warmups, +excluded from the five alternating measured pairs. + +| Measurement | One active buffer | Two active buffers | +|---|---:|---:| +| Median decode tokens/s | 1.0194 | 1.7038 | +| Median first token, ms | 2616.82 | 1381.89 | +| First token p95, ms | 2742.27 | 1454.00 | +| Median complete generation, ms | 18339.62 | 10769.22 | +| Complete generation p95, ms | 18409.61 | 11738.43 | + +Peak process RSS across the measured pair runs was 6.821634 GB. +This is process resident memory, not a complete accounting of device or unified +memory. Both modes reserve the same staging pool. The p95 values are empirical +quantiles of five trials, not a well-sampled tail estimate. First-token timing +starts at the engine call and ends at its first token callback; it excludes +model loading and HTTP queueing. Complete generation includes prefill. + +All 13 runs matched the same 16 reference token IDs. Every run had 3,683 cache +hits, 2,461 misses, 2,461 submitted reads, 11,613,872,448 payload bytes loaded, +and 11,634,057,216 device-read bytes. The grouped reference generated at +2.6247 tokens/s. It is one reference observation, not a five-trial +grouped-path qualification. + +The final run is `model-20261101T145524Z`, under chip and quiet-machine window +`20261101T145524Z-f68c98`. Task-owned background builds were paused and existing +tests allowed to finish before the window. All ten measured trials are accepted. +Execution order, native identity, source digests, per-token arrival times, +raw I/O counters and before/after GPU telemetry are preserved in +[`qualification-samples.json`](qualification-samples.json). + +The host kernel logged three allocation messages at 14:56:14 UTC, during the +excluded grouped warmup. Their cause is not established. No matching messages +occurred during the accepted pair interval, 14:56:59.050 to 14:59:51.052 UTC. +See [`driver-observations.json`](driver-observations.json). The grouped result +is therefore an unqualified observation even though its output was correct. + +This replaces the earlier full-model experiment. Review found that its +one-buffer control allowed cached expert computation to overlap a miss read. +The final control consumes cached experts before submitting misses and waits +for the current consumer before refilling. A deterministic regression checks +both mixed hit/miss orders. Earlier runs remain in the local handoff archive +but are excluded from this result. + +Read, verification and slot-load counters measure host intervals and may +overlap each other. `slot_load_ns` includes the load call and publication +bookkeeping, including lookahead submission in two-buffer mode. +`miss_wall_ns` is elapsed call time less consumer time, not the sum of read +latencies. Do not add these counters to infer wall time. The projection trace +below supplies measured interval unions for overlap. + +The grouped path batches more work per launch. The new attachment consumes +each ready expert separately. Grouping ready experts is a future experiment; +this result does not establish an improvement over the current default. + +## Controller and failure checks + +Review follow-up: a copy completing after its deadline was acknowledged by the +controller but incorrectly published by the adapter before its pin was refused. +The adapter now obtains the ready-state pin before publication. A delayed-copy +regression failed on the measured revision and passes with the fix, including +retry and zero leaked pins. The benchmark above remains evidence for its +original binary, not a new speed measurement of this follow-up. Its original +adapter is preserved in `measured-pipeline.rs.txt`, verified against the original +source digest; the follow-up digest is recorded separately in the sample pack. + +- The seeded `.om` executable matches an independent object-based oracle on + 14,745 commands. Six compiled mutants are rejected. +- The generated native binding matches the same commands and rejects wrong + extents and aliased state/output arrays. +- A discrete-event check using the native controller shows overlap when + independent read/compute resources permit it, and no speedup when reads cost + zero or the resources serialize. These ticks are synthetic. +- All 17 pager host tests pass, including corrupt reads, failed copies, + cancellation, stalled reads, pending-owner deadlines, consumer errors/panics, + mixed cache hits/misses, and synchronous versus lookahead ordering. +- All three paged-model host tests pass, including exact resident/paged logits + for one and two buffers, routing and slot pressure. + +The standalone real-I/O/GPU projection test completed all 32 healthy experts +with bit-identical resident-reference results and rejected the injected corrupt +expert before publication. Across five pairs, median elapsed time was 57.048806 +ms versus 30.316160 ms, and median paired speedup was 1.8812x. This tests expert +projections, not a complete model. The raw monotonic-clock intervals are in +[`chip-trace.jsonl`](chip-trace.jsonl). [`chip-unions.jsonl`](chip-unions.jsonl) +uses interval unions so simultaneous reads do not double-count wall overlap. + +## Identity and replay + +- Core base: `4b17ca34380d41d6155c0eab92313d362b716f00`. +- Measurement binary SHA256: `bd5640590c3ef4d860d48c0899289f3625b2fc0f2431e7023cac563a80e67a6f`. +- Omega: `ba5559d9b1030d5d966cc7db2464e466edea59a1`. +- Physics: `048e5f5e881b092733baaf65d0ace46abda7f908`. +- GPU archive SHA256: `89bf1c996fb2c96631e12c0691f6b99be8c89dd6d4006052f8021d274297a977`. +- NVIDIA GB10, driver 580.173.02; Rust 1.98.1, GCC 13.3.0. +- Omega Bridge: `ba8a75a6f9538b130383e1eb8ff459f82c589f92`. +- Seed compiler: `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`. + Rebuilt from Core's pinned Omega source; see + [`compiler-bootstrap.json`](compiler-bootstrap.json). + +Use [`run.sh`](run.sh) for the seeded policy check and +[`build-native.sh`](build-native.sh) for the native binding checks. Build +`own30b_check` with `--features ribbon-omega` and the environment printed by +that script. Run [`model_check.py`](model_check.py) under an exclusive chip and +quiet-machine window, supplying the binary, checkpoint, golden fixture, output +directory, GPU archive, Omega revision and bridge library. The frozen golden +is `docs/inference/evidence/own30b-f-20261013T1745Z/golden.json`. + +Core's default Omega pin predates the slot API. The measured binary uses the +explicit prebuilt archive identified above. Its runtime identity marks it +unqualified for a pinned native release. Default pins and production routing +were not changed. This experiment does not establish DeepSeek serving or broad +task quality. The separate [27B receipt](../../docs/qwen38/qualification-20261101/README.md) +identifies a different model and an existing server binary. + +Run `bash tests/gates/run.sh ribbon-control` to rebuild the policy compiler +from its pinned seed, exercise the oracle/mutants and verify receipt integrity. +It does not rerun the GPU experiment. Calculation queries and outputs are in +[`calculations.json`](calculations.json). Measurement data is CC0-1.0; +source and documentation are Apache-2.0. diff --git a/om/ribbon/README.md b/om/ribbon/README.md new file mode 100644 index 00000000..25f5f812 --- /dev/null +++ b/om/ribbon/README.md @@ -0,0 +1,83 @@ +# Known-demand ribbon controller + +`pipeline.om` implements the bounded read, verify, copy and publication control +for Core #631 in Omega. It is a function unit: the caller owns one 4096-element +`ulong` state array, serializes calls, and retains the associated staging buffers. +There are at most 64 outstanding expert records and one or two active staging +buffers. The existing reader may reserve a larger bounded pool; this controller +limits how many of those buffers are in use, not how many were preallocated. +The byte budget is independent of the record count. Expert keys are supplied by +the real router or another source of already-known demand. There is no prediction +or replacement of an expert. + +Each scheduled action names a ticket containing the record slot and a generation. +An old ticket cannot complete, pin or evict a newer occupant of the same record. +Generations survive reinitialization. A live instance cannot be reset while any +record remains. Cancellation, timeout and shutdown prohibit publication while +retaining any buffer still owned by a reader or copier until it acknowledges +completion. Pins prevent eviction until the consumer has retired its work. + +The controller does not perform file reads, hash verification, GPU copies or +fences. Its caller must report read success only after complete bytes, digest +and layout verification; copy success only after device visibility is established. +A read in progress may coexist with the other buffer's verification/copy or with +GPU consumption of a published expert. These are scheduling permissions, not +evidence that the serving loop currently overlaps them. + +`aien-heartbeat/src/pager/pipeline.rs` attaches the existing verified read adapter +and slot backend to these actions. It uses the Rust declarations generated by +Omega Bridge. The optional `ribbon-omega` feature enables this attachment. +`AIEN_RIBBON_OMEGA_BUFFERS=1` or `2` selects it in the paged model FFN. Unset +keeps the original grouped implementation. A selection without the feature is +refused. The new path computes ready experts individually and writes each result +at its original router position, preserving the final combination order. +One buffer is the synchronous control: the next read starts only after the +current consumer returns, and cached experts are consumed before any miss read +is submitted. Two buffers permit the next read during consumption. +Cache hits perform no read in either mode. The host test checks these ordering +properties directly, including both cache-hit positions in a mixed hit/miss +request, without inferring them from elapsed time. + +The request and result wire fields and operation codes are documented at the top +of the source. `test_driver.om` is a binary test transport, not a serving process. +`check.py` independently models ownership using Python objects. `mutants.py` +removes publication, generation, pin and budget checks and requires the same +tests to catch each broken implementation. Python is only test infrastructure. + +Run the host gate: + +```sh +OMEGA_OMC=/path/to/pinned/omc bash om/ribbon/run.sh +``` + +The gate pins the existing Core compiler digest. Build and verify the native +attachment with `build-native.sh`, supplying `OMEGA_BRIDGE_SOURCE` at its pinned +revision and `OMEGA_NATIVE_OMC` at the bridge's pinned compiler. The script prints +the three build/run environment settings. Compile the caller with +`--features ribbon-omega`. No compiler, bridge or runtime is downloaded or installed. + +`chip_probe.c` is an external measuring instrument, not production code. It +connects the compiled policy to direct file reads, OpenSSL SHA256 (test oracle +only), and the existing native FP8 slot API. It compares every result with a +fully resident tensor and includes a corrupted-read control. This measures +projections; it does not establish a complete-model improvement. Full-model +single-buffer/two-buffer acceptance and deployment remain separately recorded. +The probe records separate read, verification, copy and compute intervals using +one monotonic clock. Its `read_ns` legacy total includes verification. Its +`read_compute_pair_overlap_ns` is a sum over pairs of intervals, which can count +simultaneous reads twice; use the interval union for wall-time overlap. + +`model_check.py BINARY CHECKPOINT GOLDEN OUTPUT --gpu-library ARCHIVE +--omega-revision REVISION --bridge-library LIBRARY` runs the full-model +comparison. The binary must be `own30b_check` built with `ribbon-omega`. The +instrument retains a grouped run, excluded warmups for one and two buffers, and +five alternating pairs. It requires the same token IDs and checks the archive +digest embedded in the binary. Per-token arrival times, completed-generation +time, read/verification/copy totals and process peak resident memory are retained. +These Python programs are external testing instruments, not runtime dependencies. + +The experiment's GPU archive is built from Omega +`ba5559d9b1030d5d966cc7db2464e466edea59a1` and its pinned Physics source. Core's +current default Omega pin predates the required slot exports. An explicit +`AIEN_OMEGA_GPU_LIB` build is a development override and does not qualify as a +release build. This feature does not silently upgrade that pin or a live server. diff --git a/om/ribbon/build-native.sh b/om/ribbon/build-native.sh new file mode 100644 index 00000000..9185275f --- /dev/null +++ b/om/ribbon/build-native.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: Apache-2.0 +set -euo pipefail +root=$(cd "$(dirname "$0")/../.." && pwd) +bridge=${OMEGA_BRIDGE_SOURCE:?set OMEGA_BRIDGE_SOURCE to the pinned Omega Bridge checkout} +compiler=${OMEGA_NATIVE_OMC:?set OMEGA_NATIVE_OMC to the pinned native-call compiler} +out=${1:-$root/target/ribbon-native} +pin=ba8a75a6f9538b130383e1eb8ff459f82c589f92 +test "$(git -C "$bridge" rev-parse HEAD)" = "$pin" || { echo 'FAIL bridge source identity'; exit 1; } +test -z "$(git -C "$bridge" status --porcelain -- src/native.om tools/native)" || { echo 'FAIL modified bridge source'; exit 1; } +OMEGA_NATIVE_OMC="$compiler" "$bridge/tools/native" "$out" "$root/om/ribbon/pipeline.om" +python3 "$root/om/ribbon/check_native.py" "$out" +python3 "$root/om/ribbon/check_overlap.py" "$out" +{ + printf 'bridge %s\n' "$pin" + sha256sum "$compiler" "$bridge/src/native.om" "$bridge/tools/native" \ + "$root/om/ribbon/pipeline.om" "$out/libomega_native.so" "$out/omega_native.rs" + cc --version | head -1 +} > "$out/provenance.txt" +printf 'AIEN_RIBBON_BINDINGS=%s/omega_native.rs\nLIBRARY_PATH=%s\nLD_LIBRARY_PATH=%s\n' "$out" "$out" "$out" diff --git a/om/ribbon/calculations.json b/om/ribbon/calculations.json new file mode 100644 index 00000000..746738a4 --- /dev/null +++ b/om/ribbon/calculations.json @@ -0,0 +1,78 @@ +{ + "license": "CC0-1.0", + "tool": "Wolfram Language Evaluator", + "chip": { + "code": "serial={56611039,56881075,57048806,57962053,59728706}; dual={30093692,30901322,30345153,30117053,30316160}; <|\"serialMedianMs\"->N[Median[serial]/10^6],\"dualMedianMs\"->N[Median[dual]/10^6],\"pairedRatios\"->N[serial/dual],\"medianPairedRatio\"->N[Median[serial/dual]],\"serialP95Ms\"->N[Quantile[serial,.95]/10^6],\"dualP95Ms\"->N[Quantile[dual,.95]/10^6]|>", + "result": { + "content": [ + { + "type": "text", + "text": "Out[1]= <|\"serialMedianMs\" -> 57.048806, \"dualMedianMs\" -> 30.31616, \"pairedRatios\" -> {1.881159646347148, 1.8407327362887582, 1.8799973096197604, 1.9245592521950936, 1.9701936524942474}, \"medianPairedRatio\" -> 1.881159646347148, \"serialP95Ms\" -> 59.728706, \"dualP95Ms\" -> 30.901322|>" + } + ] + } + }, + "full_model": { + "code": "oneT={1.0102923533497505,1.0255752836356644,1.028475927235328,1.019367991845056,1.017358682520506};twoT={1.703758918113087,1.5552099533437014,1.6284987277353689,1.7775802688590157,1.7472971497215246};oneFirst={2576.5005140000003,2465.03777,2742.270238,2683.269648,2616.816967};twoFirst={1381.886919,1454.000659,1449.724479,1343.829669,1292.513477};oneWall={18409.612748,18062.269011,18295.569823,18375.809422,18339.622443};twoWall={10769.218172,11738.431693999999,11271.422246,10341.077158,10446.672611};rss={6821605376,6821634048,6821634048,6821601280,6821597184,6821597184,6821629952,6821629952,6821629952,6821593088};ExportString[<|\"tokensPerSecondMedians\"->N[Median/@{oneT,twoT}],\"medianPairedThroughputRatio\"->N[Median[twoT/oneT]],\"pairedThroughputRatios\"->N[twoT/oneT],\"firstTokenMedianMs\"->N[Median/@{oneFirst,twoFirst}],\"firstTokenP95Ms\"->N[Quantile[#,0.95]&/@{oneFirst,twoFirst}],\"generationMedianMs\"->N[Median/@{oneWall,twoWall}],\"generationP95Ms\"->N[Quantile[#,0.95]&/@{oneWall,twoWall}],\"peakRssGB\"->N[Max[rss]/10^9]|>,\"RawJSON\"]", + "result": { + "content": [ + { + "type": "text", + "text": "Out[1]= \"{\\n\\t\\\"tokensPerSecondMedians\\\":[\\n\\t\\t1.019367991845056,\\n\\t\\t1.703758918113087\\n\\t],\\n\\t\\\"medianPairedThroughputRatio\\\":1.6864018741348101,\\n\\t\\\"pairedThroughputRatios\\\":[\\n\\t\\t1.6864018741348101,\\n\\t\\t1.5164269051321928,\\n\\t\\t1.5834096692111959,\\n\\t\\t1.7438062437506945,\\n\\t\\t1.717483892104401\\n\\t],\\n\\t\\\"firstTokenMedianMs\\\":[\\n\\t\\t2.616816967e3,\\n\\t\\t1.381886919e3\\n\\t],\\n\\t\\\"firstTokenP95Ms\\\":[\\n\\t\\t2.742270238e3,\\n\\t\\t1.454000659e3\\n\\t],\\n\\t\\\"generationMedianMs\\\":[\\n\\t\\t1.8339622443e4,\\n\\t\\t1.0769218172e4\\n\\t],\\n\\t\\\"generationP95Ms\\\":[\\n\\t\\t1.8409612748e4,\\n\\t\\t1.1738431693999999e4\\n\\t],\\n\\t\\\"peakRssGB\\\":6.821634048\\n}\"" + } + ] + }, + "values": { + "tokensPerSecondMedians": [ + 1.019367991845056, + 1.703758918113087 + ], + "medianPairedThroughputRatio": 1.6864018741348101, + "pairedThroughputRatios": [ + 1.6864018741348101, + 1.5164269051321928, + 1.5834096692111959, + 1.7438062437506945, + 1.717483892104401 + ], + "firstTokenMedianMs": [ + 2616.816967, + 1381.886919 + ], + "firstTokenP95Ms": [ + 2742.270238, + 1454.000659 + ], + "generationMedianMs": [ + 18339.622443, + 10769.218172 + ], + "generationP95Ms": [ + 18409.612748, + 11738.431693999999 + ], + "peakRssGB": 6.821634048 + } + }, + "model_27b": { + "code": "wall={32.63698655599728,32.726758955046535,32.79684998904122,32.904840200033505,33.04565382900182};decode={32128,32193,32263,32423,32548};prefill={507,531,531,480,496};graph={124.8,125.0,125.4,126.0,126.4};ExportString[<|\"requestMedianS\"->N[Median[wall]],\"requestP95S\"->N[Quantile[wall,.95]],\"decodeMedianTokensPerS\"->N[Median[256000/decode]],\"decodeP95MsPerToken\"->N[Quantile[decode/256,.95]],\"prefillMedianMs\"->N[Median[prefill]],\"graphMedianMsPerToken\"->N[Median[graph]],\"streamFirstVisibleS\"->0.4900324070476927,\"streamCompletedS\"->32.865948373044375|>,\"RawJSON\"]", + "result": { + "content": [ + { + "type": "text", + "text": "Out[1]= \"{\\n\\t\\\"requestMedianS\\\":3.279684998904122e1,\\n\\t\\\"requestP95S\\\":3.304565382900182e1,\\n\\t\\\"decodeMedianTokensPerS\\\":7.934785977745405,\\n\\t\\\"decodeP95MsPerToken\\\":1.27140625e2,\\n\\t\\\"prefillMedianMs\\\":5.07e2,\\n\\t\\\"graphMedianMsPerToken\\\":1.254e2,\\n\\t\\\"streamFirstVisibleS\\\":0.4900324070476927,\\n\\t\\\"streamCompletedS\\\":3.2865948373044375e1\\n}\"" + } + ] + }, + "values": { + "requestMedianS": 32.79684998904122, + "requestP95S": 33.04565382900182, + "decodeMedianTokensPerS": 7.934785977745405, + "decodeP95MsPerToken": 127.140625, + "prefillMedianMs": 507, + "graphMedianMsPerToken": 125.4, + "streamFirstVisibleS": 0.4900324070476927, + "streamCompletedS": 32.865948373044375 + } + } +} diff --git a/om/ribbon/check.py b/om/ribbon/check.py new file mode 100644 index 00000000..b955228f --- /dev/null +++ b/om/ribbon/check.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Independent test oracle for the Omega controller; never a serving dependency.""" +from dataclasses import dataclass +from pathlib import Path +import argparse +import random +import struct +import subprocess + +@dataclass +class Job: + key: int + generation: int + size: int + deadline: int + phase: int = 1 + pins: int = 0 + owner: int = 0 + +class Oracle: + def __init__(self): + self.capacity = 0 + self.generation = 0 + self.jobs = {} + self.budget = 0 + self.buffers = 0 + self.stopped = False + + def charges(self): + active = [j for j in self.jobs.values() if j.owner] + return sum(j.size for j in active), len(active) + + def reply(self, slot): + j = self.jobs[slot] + return [j.generation * 64 + slot, j.key, j.size, j.deadline, + j.phase, j.pins, *self.charges()] + + def step(self, q): + op, arg, size, deadline, ok, _, now, _ = q + empty = [0] * 8 + if op == 1: + if not 1 <= arg <= 64 or size == 0 or not 1 <= deadline <= 2: + return [2, *empty] + if self.jobs: + return [5, *empty] + self.capacity, self.budget, self.buffers = arg, size, deadline + self.stopped = False + return [0, *empty] + if not self.capacity: + return [2, *empty] + for j in self.jobs.values(): + if j.phase != 8 and now >= j.deadline: + if j.phase == 3: + j.owner = 0 + j.phase = 8 + code, slot = 0, None + if op == 2: + if self.stopped: + code = 6 + elif not 0 < size <= self.budget: + code = 2 + elif deadline <= now: + code = 7 + else: + slot = next((i for i,j in self.jobs.items() if j.key == arg), None) + if slot is not None: + j = self.jobs[slot] + if j.size != size: code = 2 + elif j.phase == 8: code = 5 + elif len(self.jobs) == self.capacity: + code = 4 + else: + slot = next(i for i in range(self.capacity) if i not in self.jobs) + self.generation += 1 + self.jobs[slot] = Job(arg, self.generation, size, deadline) + elif op in (3,5): + used, count = self.charges() + if self.stopped: + code = 6 + elif op == 3 and count >= self.buffers: + code = 1 + else: + candidates = [(j.generation,i) for i,j in self.jobs.items() if j.phase == (1 if op == 3 else 3)] + if not candidates: + code = 1 + else: + slot = min(candidates)[1] + j = self.jobs[slot] + if op == 3 and j.size + used > self.budget: + code = 1 + else: + j.phase, j.owner = (2,1) if op == 3 else (4,2) + elif op in (4,6,7,8,9,10,13): + slot = arg % 64 + j = self.jobs.get(slot) + if j is None or j.generation != arg // 64: + code = 3 + elif op in (4,6): + want, owner = (2,1) if op == 4 else (4,2) + if j.phase == 8: + if j.owner != owner: code = 5 + else: j.owner = 0 + elif j.phase != want: + code = 5 + elif ok != 1: + j.phase, j.owner = 8,0 + else: + j.phase, j.owner = (3,2) if op == 4 else (5,0) + elif op == 7: + if j.phase != 5: code = 5 + else: j.pins += 1 + elif op == 8: + if not j.pins: code = 5 + else: j.pins -= 1 + elif op == 9: + if j.pins or j.owner or j.phase not in (5,8): code = 5 + else: + j.phase = 0 + result = self.reply(slot) + del self.jobs[slot] + return [0, *result] + elif op == 10: + if j.phase == 3: j.owner = 0 + j.phase = 8 + elif op == 11: + self.stopped = True + for j in self.jobs.values(): + if j.phase == 3: j.owner = 0 + j.phase = 8 + elif op != 12: + code = 2 + used, count = self.charges() + assert used <= self.budget and count <= self.buffers + assert all(not j.pins or j.phase in (5,8) for j in self.jobs.values()) + return [code, *(self.reply(slot) if code == 0 and slot is not None else empty)] + +def cases(): + # These exercise real ownership sequences, not generated copies of the implementation. + sequences = [ + # Both reads can be outstanding. Copies require verified input. Pins prevent reuse. + [(1,4,256,2),(2,11,128,100),(2,22,128,100),(3,),(3,),(3,), + (5,),(7,64),(4,129,0,0,1),(5,),(6,129,0,0,1),(7,129), + (9,129),(4,64,0,0,1),(5,),(6,64,0,0,1),(8,129),(9,129), + (2,33,128,100),(13,129),(4,129,0,0,1),(13,194)], + # Cancellation and expiry keep a live worker's buffer until acknowledgement. + [(1,4,128,1),(2,11,128,10),(2,22,128,100),(3,),(10,64),(3,), + (9,64),(4,64,0,0,1),(9,64),(3,),(4,129,0,0,1),(5,), + (12,0,0,0,0,0,101),(9,129),(6,129,0,0,1),(9,129)], + # A digest failure can never be copied or pinned. Shutdown drains live readers. + [(1,3,128,2),(2,11,64,10),(2,22,64,10),(3,),(4,64), + (5,),(7,64),(9,64),(3,),(11,),(2,33,64,10),(9,129), + (4,129,0,0,1),(9,129),(1,3,128,2),(2,11,64,10),(13,64)], + # No reset of outstanding ownership and no duplicate with a different size. + [(1,0,128,2),(1,65,128,2),(1,4,128,3),(1,4,128,2), + (2,11,64,10),(1,4,128,2),(2,11,63,10),(2,11,64,10), + (2,22,0,10),(2,22,129,10),(2,22,64,0),(99,64)], + ] + for seq in sequences: + yield [list(q) + [0] * (8-len(q)) for q in seq] + for seed in range(12): + r = random.Random(seed) + oracle = Oracle() + init = [1,8,256,2,0,0,0,0] + oracle.step(init) + sequence = [init] + now = 0 + old_tickets = [0,64,129] + for _ in range(1200): + now += r.randrange(2) + op = r.choices([2,3,4,5,6,7,8,9,10,11,12,13], [15,10,12,8,12,7,7,15,4,1,2,4])[0] + if op == 2: + q = [2,r.randrange(12),r.choice([0,32,64,128,257]),now+r.randrange(0,100),0,0,now,0] + else: + live = [j.generation*64+i for i,j in oracle.jobs.items()] + ticket = r.choice(live + old_tickets) + q = [op,ticket,0,0,r.randrange(2),0,now,0] + response = oracle.step(q) + sequence.append(q) + if response[0] == 0 and op == 2: + old_tickets = (old_tickets + [response[1]])[-16:] + if oracle.stopped and not any(j.owner or j.pins for j in oracle.jobs.values()): + for i,j in list(oracle.jobs.items()): + q = [9,j.generation*64+i,0,0,0,0,now,0] + oracle.step(q) + sequence.append(q) + q = [1,8,256,2,0,0,now,0] + oracle.step(q) + sequence.append(q) + yield sequence + +def check(binary): + count = 0 + for n, sequence in enumerate(cases()): + expected = [] + oracle = Oracle() + for q in sequence: + expected.append(oracle.step(q)) + payload = b''.join(struct.pack('<8Q', *q) for q in sequence) + run = subprocess.run([str(binary)], input=payload, capture_output=True, timeout=20) + if run.returncode: + raise AssertionError(f'case {n}: process exit {run.returncode} {run.stderr!r}') + assert len(run.stdout) == len(sequence)*72, (n, 'truncated output') + for i,(q,want) in enumerate(zip(sequence,expected)): + got = list(struct.unpack_from('<9Q',run.stdout,i*72)) + assert got == want, f'case {n} step {i} command {q}: got {got}, expected {want}' + count += 1 + return count + +if __name__ == '__main__': + p = argparse.ArgumentParser() + p.add_argument('binary', type=Path) + args = p.parse_args() + print(f'PASS {check(args.binary)} commands against independent ownership oracle') diff --git a/om/ribbon/check_evidence.py b/om/ribbon/check_evidence.py new file mode 100644 index 00000000..93db3477 --- /dev/null +++ b/om/ribbon/check_evidence.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Receipt integrity checks. Does not rerun or pretend to qualify hardware.""" +import gzip +import hashlib +import json +from datetime import datetime, timezone +from pathlib import Path +from zoneinfo import ZoneInfo + +from summarize_trace import summarize + +root = Path(__file__).resolve().parents[2] +here = Path(__file__).resolve().parent +sha = lambda data: hashlib.sha256(data).hexdigest() +qualification = json.loads((here/'qualification-samples.json').read_text()) +assert not qualification.get('control_correction'), 'obsolete control receipt' +for name, expected in qualification['source_files_sha256'].items(): + followup = qualification.get('post_measurement_changes', {}).get(name) + measured = root/followup['measured_source_snapshot'] if followup else root/name + assert sha(measured.read_bytes()) == expected, ('measured source drift', name) + if followup: + assert sha((root/name).read_bytes()) == followup['current_sha256'], ('reviewed source drift', name) +accepted = [s for s in qualification['samples'] if s['timing_accepted']] +assert len(accepted) == 10 +assert sum(s['mode'] == '1' for s in accepted) == 5 +assert sum(s['mode'] == '2' for s in accepted) == 5 +tokens = accepted[0]['prompt']['chip'] +assert len(tokens) == 16 +work = None +for sample in qualification['samples']: + p = sample['prompt'] + assert sample['pass'] and sample['same_tokens'] and p['first_diff'] is None + assert p['chip'] == tokens + io = {k:p['ribbon'][k] for k in ('hit','miss','bytes_loaded','device_read_bytes','reads_submitted')} + if work is None: work = io + assert io == work, 'different expert workload' + +driver = json.loads((here/'driver-observations.json').read_text()) +messages = [datetime.fromisoformat(e['utc']) for e in driver['events']] +def gpu_utc(text): + stamp = text.split(',')[0] + return datetime.strptime(stamp, '%Y/%m/%d %H:%M:%S.%f').replace(tzinfo=ZoneInfo('America/Chicago')).astimezone(timezone.utc) +for sample in accepted: + start, end = gpu_utc(sample['gpu_before']), gpu_utc(sample['gpu_after']) + assert not any(start <= t <= end for t in messages), 'driver message during accepted trial' +short_start, short_end = map(datetime.fromisoformat, driver['short_window_utc']) +assert not any(short_start <= t <= short_end for t in messages) + +traces = [json.loads(line) for line in (here/'chip-trace.jsonl').read_text().splitlines()] +unions = [json.loads(line) for line in (here/'chip-unions.jsonl').read_text().splitlines()] +assert len(traces) == len(unions) == 12 +for trace, union in zip(traces, unions): + assert not trace['failed'] + assert summarize(trace) == union + assert trace['completed'] + trace['rejected'] == 32 + if trace['mutant']: + assert trace['rejected'] == 1 + else: + assert trace['rejected'] == 0 + if trace['buffers'] == 1: + assert union['read_verify_compute_overlap_ns'] == 0 + +pack = root/'docs/qwen38/qualification-20261101' +index = json.loads((pack/'index.json').read_text()) +assert {r['stage'] for r in index['runs']} == {'short','long32','long64','long128'} +expected_count = {'long32':32768,'long64':65536,'long128':128000} +for run in index['runs']: + assert run['verdict'] == 'PASS' + directory = pack/run['stage'] + for category in ('request_and_response_files','additional_evidence','reconstructed_input_ids'): + for name, metadata in run[category].items(): + raw = gzip.decompress((directory/name).read_bytes()) + assert sha(raw) == metadata['uncompressed_sha256'], name + if 'uncompressed_bytes' in metadata: + assert len(raw) == metadata['uncompressed_bytes'] + if category == 'reconstructed_input_ids': + assert len(raw) == 4*metadata['tokens'] + events = [json.loads(line) for line in (directory/'events.jsonl').read_text().splitlines()] + assert any(e.get('event') == 'completed' and e.get('verdict') == 'PASS' for e in events) + assert any(e.get('event') == 'cleanup' and e.get('server_exit') == 0 for e in events) + assert run['reconstructed_input_ids'], 'missing exact input reconstruction' + for event in events: + if event.get('event') == 'request': + response = json.loads(gzip.decompress((directory/(event['name']+'.response.json.gz')).read_bytes())) + ids = response['usage']['aien_token_ids'] + assert sha(json.dumps(ids).encode()) == event['token_ids_sha256'] + if run['stage'] in expected_count: + first = next(e for e in events if e.get('name') == 'long-cold') + assert first['usage']['prompt_tokens'] == expected_count[run['stage']] + assert run['reconstructed_input_ids']['long-cold.request.u32le.gz']['tokens'] == expected_count[run['stage']] + resumed = next(e for e in events if e.get('name') == 'long-resumed') + cold = next(e for e in events if e.get('name') == 'long-follow-cold') + assert resumed['token_ids_sha256'] == cold['token_ids_sha256'] + else: + assert run['timing_qualified'] + selected = run['timing_samples'] + assert len(selected) == len(set(selected)) == 5 + assert not set(selected).intersection(run['timing_excluded']) + assert sum(e.get('name') in selected for e in events) == 5 + golden = json.loads((root/'crates/aien-inference-abi/fixtures/qwen38/decode-lighthouses-256.json').read_text())['ids'] + for name in selected: + reply = json.loads(gzip.decompress((directory/(name+'.response.json.gz')).read_bytes())) + assert reply['usage']['aien_token_ids'] == golden + stream = next(e for e in events if e.get('event') == 'stream') + assert 0 < stream['first_visible_s'] <= stream['completed_s'] + assert stream['usage']['aien_token_ids'] == golden + quality = json.loads(gzip.decompress((directory/'quality-results.json.gz').read_bytes())) + assert quality['coding']['grade']['pass'] and quality['coding']['repeat_tokens_identical'] + assert quality['prose']['repeat_tokens_identical'] and quality['prose']['word_count'] <= 120 + review = json.loads(gzip.decompress((directory/'quality-prose-review.json.gz').read_bytes())) + assert review['pass'] and all(review['criteria'].values()) +print('PASS controller/model receipt integrity, source digests, exact tokens and input-file digests') diff --git a/om/ribbon/check_native.py b/om/ribbon/check_native.py new file mode 100644 index 00000000..5deb87bd --- /dev/null +++ b/om/ribbon/check_native.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Verify the generated Omega Bridge call boundary against the same oracle.""" +import ctypes +import importlib.util +from pathlib import Path +import sys + +from check import Oracle, cases + +binding = Path(sys.argv[1]) / 'omega_native.py' +spec = importlib.util.spec_from_file_location('ribbon_native', binding) +native = importlib.util.module_from_spec(spec) +spec.loader.exec_module(native) +count = 0 +for seq in cases(): + state = (ctypes.c_uint64 * 4096)() + oracle = Oracle() + for q in seq: + request = (ctypes.c_uint64 * 8)(*q) + answer = (ctypes.c_uint64 * 8)() + result = ctypes.c_uint64() + status = native.omega_pipeline(ctypes.byref(result), state, 4096, request, 8, answer, 8) + assert status == 0, status + got = [result.value, *answer] + assert got == oracle.step(q), (q, got) + count += 1 + +# The native boundary must reject accidental aliasing and a wrong state extent. +state = (ctypes.c_uint64 * 4096)() +q = (ctypes.c_uint64 * 8)(1,4,256,2,0,0,0,0) +out = (ctypes.c_uint64 * 8)() +result = ctypes.c_uint64(99) +assert native.omega_pipeline(ctypes.byref(result),state,4095,q,8,out,8) == 32 +assert result.value == 99 +assert native.omega_pipeline(ctypes.byref(result),state,4096,q,8,state,8) == 32 +assert result.value == 99 +print(f'PASS native attachment: {count} oracle commands plus wrong-extent/alias refusals') diff --git a/om/ribbon/check_overlap.py b/om/ribbon/check_overlap.py new file mode 100644 index 00000000..1cc52296 --- /dev/null +++ b/om/ribbon/check_overlap.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Discrete-event test instrument for the actual compiled Omega controller. + +Ticks are synthetic. These results assert scheduling, never hardware speed. +""" +import ctypes as c +import importlib.util +from pathlib import Path +import sys + +spec = importlib.util.spec_from_file_location('native', Path(sys.argv[1]) / 'omega_native.py') +native = importlib.util.module_from_spec(spec) +spec.loader.exec_module(native) + + +def simulate(buffers, read_ticks, compute_ticks, shared_engine=False): + state = (c.c_uint64 * 4096)() + now = 0 + shared_free = 0 + reads = [] + compute = None + completed = 0 + + def call(op, key=0, size=0, deadline=0, ok=0): + q = (c.c_uint64 * 8)(op, key, size, deadline, ok, 0, now, 0) + out = (c.c_uint64 * 8)() + result = c.c_uint64() + assert native.omega_pipeline(c.byref(result), state, 4096, q, 8, out, 8) == 0 + return result.value, list(out) + + assert call(1, 4, buffers, buffers)[0] == 0 + for key in range(4): + assert call(2, key, 1, 10000)[0] == 0 + for _ in range(100): + if compute is not None and compute[0] <= now: + assert call(8, compute[1])[0] == 0 + assert call(9, compute[1])[0] == 0 + compute = None + completed += 1 + for end, ticket in list(reads): + if end <= now: + assert call(4, ticket, ok=1)[0] == 0 + reads.remove((end, ticket)) + if compute is None: + code, out = call(5) + assert code in (0, 1) + if code == 0: + assert call(6, out[0], ok=1)[0] == 0 + assert call(7, out[0])[0] == 0 + begin = max(now, shared_free) if shared_engine else now + compute = (begin + compute_ticks, out[0]) + if shared_engine: + shared_free = compute[0] + if buffers == 2 or compute is None: + while True: + code, out = call(3) + assert code in (0, 1) + if code == 1: + break + begin = max(now, shared_free) if shared_engine else now + reads.append((begin + read_ticks, out[0])) + if shared_engine: + shared_free = reads[-1][0] + if completed == 4: + return now + events = [end for end, _ in reads] + if compute is not None: + events.append(compute[0]) + assert events, 'controller stopped making progress' + now = min(events) + raise AssertionError('unbounded scheduling loop') + + +parallel = [simulate(b, 10, 10) for b in (1, 2)] +cached = [simulate(b, 0, 10) for b in (1, 2)] +serialized = [simulate(b, 10, 10, True) for b in (1, 2)] +assert parallel[1] < parallel[0], parallel +assert cached[1] == cached[0], cached +assert serialized[1] == serialized[0], serialized +print('PASS synthetic schedule ticks (one/two):', + {'independent_engines': parallel, 'zero_read_cost': cached, 'shared_engine': serialized}) diff --git a/om/ribbon/chip-trace.jsonl b/om/ribbon/chip-trace.jsonl new file mode 100644 index 00000000..8443c5fb --- /dev/null +++ b/om/ribbon/chip-trace.jsonl @@ -0,0 +1,12 @@ +{"trial":0,"buffers":1,"mutant":0,"completed":32,"rejected":0,"wall_ns":69082635,"read_ns":45273255,"copy_ns":15857266,"compute_ns":3513517,"read_compute_pair_overlap_ns":0,"failed":0,"origin_monotonic_ns":309616839165726,"spans":[{"expert":0,"read":[309616839246287,309616849179026],"verify":[309616849179026,309616849859357],"copy":[309616849915230,309616850410310],"compute":[309616850410918,309616850521000]},{"expert":1,"read":[309616850647546,309616851072161],"verify":[309616851072161,309616851721964],"copy":[309616851760716,309616852253124],"compute":[309616852253492,309616852360966]},{"expert":2,"read":[309616852385558,309616852661723],"verify":[309616852661723,309616853303493],"copy":[309616853444744,309616853935152],"compute":[309616853935472,309616854004817]},{"expert":3,"read":[309616854139907,309616854678300],"verify":[309616854678300,309616855435528],"copy":[309616855543146,309616856046530],"compute":[309616856046882,309616856153508]},{"expert":4,"read":[309616856275734,309616856687837],"verify":[309616856687837,309616857451689],"copy":[309616857540523,309616858032147],"compute":[309616858032547,309616858140693]},{"expert":5,"read":[309616858167237,309616858577612],"verify":[309616858577612,309616859236855],"copy":[309616859382089,309616859877601],"compute":[309616859878065,309616859990355]},{"expert":6,"read":[309616860124565,309616860567212],"verify":[309616860567212,309616861221127],"copy":[309616861238103,309616861723343],"compute":[309616861723695,309616861832577]},{"expert":7,"read":[309616861865762,309616862264408],"verify":[309616862264408,309616862905747],"copy":[309616862928707,309616863421771],"compute":[309616863422379,309616863531373]},{"expert":8,"read":[309616863561789,309616863966276],"verify":[309616863966276,309616864621039],"copy":[309616864773921,309616865266473],"compute":[309616865267033,309616865352059]},{"expert":9,"read":[309616865384475,309616865969221],"verify":[309616865969221,309616866724385],"copy":[309616866753442,309616867255402],"compute":[309616867255786,309616867364716]},{"expert":10,"read":[309616867390796,309616867767954],"verify":[309616867767954,309616868409197],"copy":[309616868447469,309616868940501],"compute":[309616868940821,309616869106120]},{"expert":11,"read":[309616869138777,309616869583088],"verify":[309616869583088,309616870341196],"copy":[309616870458750,309616870957910],"compute":[309616870958391,309616871067736]},{"expert":12,"read":[309616871104969,309616871363149],"verify":[309616871363149,309616872075945],"copy":[309616872156426,309616872645378],"compute":[309616872645826,309616872754660]},{"expert":13,"read":[309616872785364,309616873167723],"verify":[309616873167723,309616873806869],"copy":[309616873844006,309616874339134],"compute":[309616874339614,309616874447536]},{"expert":14,"read":[309616874474208,309616874960712],"verify":[309616874960712,309616875605955],"copy":[309616875689108,309616876191324],"compute":[309616876191660,309616876298670]},{"expert":15,"read":[309616876424496,309616876895352],"verify":[309616876895352,309616877656820],"copy":[309616877688677,309616878199101],"compute":[309616878199629,309616878307967]},{"expert":16,"read":[309616878341199,309616878664597],"verify":[309616878664597,309616879314367],"copy":[309616879409713,309616879901017],"compute":[309616879901369,309616880005162]},{"expert":17,"read":[309616880130589,309616880655861],"verify":[309616880655861,309616881301232],"copy":[309616881403665,309616881903194],"compute":[309616881903642,309616882005403]},{"expert":18,"read":[309616882039580,309616882569620],"verify":[309616882569620,309616883327153],"copy":[309616883395346,309616883885642],"compute":[309616883886106,309616883995148]},{"expert":19,"read":[309616884120462,309616884688759],"verify":[309616884688759,309616885446052],"copy":[309616885538709,309616886032285],"compute":[309616886032781,309616886141215]},{"expert":20,"read":[309616886177120,309616886569078],"verify":[309616886569078,309616887221137],"copy":[309616887235121,309616887726009],"compute":[309616887726377,309616887833883]},{"expert":21,"read":[309616887865819,309616888524902],"verify":[309616888524902,309616889290307],"copy":[309616889380756,309616889880268],"compute":[309616889880684,309616889988814]},{"expert":22,"read":[309616890028671,309616890474278],"verify":[309616890474278,309616891293123],"copy":[309616891382837,309616891875917],"compute":[309616891876269,309616891985487]},{"expert":23,"read":[309616892023375,309616892375173],"verify":[309616892375173,309616893134738],"copy":[309616893227811,309616893719019],"compute":[309616893719355,309616893827821]},{"expert":24,"read":[309616893861085,309616894192019],"verify":[309616894192019,309616894936863],"copy":[309616895067825,309616895566041],"compute":[309616895566329,309616895675083]},{"expert":25,"read":[309616895799501,309616896162227],"verify":[309616896162227,309616896806702],"copy":[309616896913263,309616897420312],"compute":[309616897420696,309616897527529]},{"expert":26,"read":[309616897553194,309616897862671],"verify":[309616897862671,309616898500425],"copy":[309616898610235,309616899105811],"compute":[309616899106147,309616899212837]},{"expert":27,"read":[309616899234613,309616899668700],"verify":[309616899668700,309616900311511],"copy":[309616900444249,309616900940561],"compute":[309616900940929,309616901107412]},{"expert":28,"read":[309616901142261,309616901590572],"verify":[309616901590572,309616902359864],"copy":[309616902459626,309616902958338],"compute":[309616902958818,309616903066916]},{"expert":29,"read":[309616903100469,309616903473787],"verify":[309616903473787,309616904234295],"copy":[309616904307320,309616904799888],"compute":[309616904800288,309616904909202]},{"expert":30,"read":[309616904939731,309616905269960],"verify":[309616905269960,309616905909091],"copy":[309616905999172,309616906486508],"compute":[309616906486940,309616906595566]},{"expert":31,"read":[309616906622382,309616906964868],"verify":[309616906964868,309616907606750],"copy":[309616907634735,309616908136695],"compute":[309616908137127,309616908247353]}]} +{"trial":1,"buffers":1,"mutant":0,"completed":32,"rejected":0,"wall_ns":56611039,"read_ns":34099935,"copy_ns":15852992,"compute_ns":3407452,"read_compute_pair_overlap_ns":0,"failed":0,"origin_monotonic_ns":309616908449148,"spans":[{"expert":0,"read":[309616908493437,309616909063382],"verify":[309616909063382,309616909700273],"copy":[309616909714353,309616910205897],"compute":[309616910206345,309616910313723]},{"expert":1,"read":[309616910346187,309616910664368],"verify":[309616910664368,309616911359452],"copy":[309616911398764,309616911888100],"compute":[309616911888484,309616911995782]},{"expert":2,"read":[309616912035287,309616912361820],"verify":[309616912361820,309616912997143],"copy":[309616913096520,309616913595264],"compute":[309616913595632,309616913702402]},{"expert":3,"read":[309616913732067,309616914164826],"verify":[309616914164826,309616914806436],"copy":[309616914914086,309616915412046],"compute":[309616915412446,309616915519824]},{"expert":4,"read":[309616915555312,309616915866614],"verify":[309616915866614,309616916622754],"copy":[309616916757620,309616917253948],"compute":[309616917254364,309616917361854]},{"expert":5,"read":[309616917392639,309616917776773],"verify":[309616917776773,309616918565826],"copy":[309616918596098,309616919092154],"compute":[309616919092570,309616919199932]},{"expert":6,"read":[309616919233261,309616919565586],"verify":[309616919565586,309616920216525],"copy":[309616920289710,309616920786086],"compute":[309616920786486,309616920897832]},{"expert":7,"read":[309616920934632,309616921264846],"verify":[309616921264846,309616921909689],"copy":[309616921992154,309616922484210],"compute":[309616922484674,309616922592788]},{"expert":8,"read":[309616922619076,309616922963658],"verify":[309616922963658,309616923603716],"copy":[309616923678581,309616924171565],"compute":[309616924171917,309616924279119]},{"expert":9,"read":[309616924308208,309616924872345],"verify":[309616924872345,309616925536884],"copy":[309616925670438,309616926171886],"compute":[309616926172318,309616926286704]},{"expert":10,"read":[309616926332401,309616926773048],"verify":[309616926773048,309616927531765],"copy":[309616927684887,309616928195119],"compute":[309616928195631,309616928306577]},{"expert":11,"read":[309616928333074,309616928767641],"verify":[309616928767641,309616929408947],"copy":[309616929519269,309616930017085],"compute":[309616930017533,309616930125583]},{"expert":12,"read":[309616930169616,309616930571910],"verify":[309616930571910,309616931220961],"copy":[309616931367923,309616931860331],"compute":[309616931860859,309616931969421]},{"expert":13,"read":[309616931993230,309616932367332],"verify":[309616932367332,309616933011694],"copy":[309616933055055,309616933545431],"compute":[309616933545847,309616933653161]},{"expert":14,"read":[309616933678489,309616934066575],"verify":[309616934066575,309616934703194],"copy":[309616934741419,309616935241187],"compute":[309616935241667,309616935351573]},{"expert":15,"read":[309616935382517,309616935761579],"verify":[309616935761579,309616936399558],"copy":[309616936442262,309616936934286],"compute":[309616936934750,309616937005968]},{"expert":16,"read":[309616937037040,309616937464871],"verify":[309616937464871,309616938108882],"copy":[309616938240388,309616938739196],"compute":[309616938739644,309616938847710]},{"expert":17,"read":[309616938868814,309616939267541],"verify":[309616939267541,309616939904271],"copy":[309616939915919,309616940409111],"compute":[309616940409527,309616940517673]},{"expert":18,"read":[309616940541833,309616940864367],"verify":[309616940864367,309616941508537],"copy":[309616941598315,309616942089971],"compute":[309616942090579,309616942205669]},{"expert":19,"read":[309616942241941,309616942805390],"verify":[309616942805390,309616943561691],"copy":[309616943580491,309616944081811],"compute":[309616944082227,309616944202085]},{"expert":20,"read":[309616944231286,309616944684813],"verify":[309616944684813,309616945389833],"copy":[309616945441530,309616945936562],"compute":[309616945937138,309616946003827]},{"expert":21,"read":[309616946022019,309616946364633],"verify":[309616946364633,309616947004659],"copy":[309616947082517,309616947576381],"compute":[309616947576925,309616947686622]},{"expert":22,"read":[309616947710623,309616948061749],"verify":[309616948061749,309616948697071],"copy":[309616948761376,309616949258552],"compute":[309616949259048,309616949366362]},{"expert":23,"read":[309616949489868,309616949981684],"verify":[309616949981684,309616950736688],"copy":[309616950754353,309616951248041],"compute":[309616951248537,309616951357003]},{"expert":24,"read":[309616951389403,309616951773873],"verify":[309616951773873,309616952550702],"copy":[309616952592639,309616953084487],"compute":[309616953084983,309616953191592]},{"expert":25,"read":[309616953209257,309616953461325],"verify":[309616953461325,309616954097623],"copy":[309616954118376,309616954617280],"compute":[309616954617648,309616954725266]},{"expert":26,"read":[309616954750866,309616955179529],"verify":[309616955179529,309616955924821],"copy":[309616956064792,309616956556848],"compute":[309616956557248,309616956665217]},{"expert":27,"read":[309616956685810,309616957061240],"verify":[309616957061240,309616957699746],"copy":[309616957745731,309616958240523],"compute":[309616958240907,309616958347501]},{"expert":28,"read":[309616958375229,309616958773060],"verify":[309616958773060,309616959524160],"copy":[309616959581585,309616960076329],"compute":[309616960076713,309616960183995]},{"expert":29,"read":[309616960204587,309616960462000],"verify":[309616960462000,309616961100746],"copy":[309616961112906,309616961606098],"compute":[309616961606450,309616961712692]},{"expert":30,"read":[309616961729492,309616962061466],"verify":[309616962061466,309616962696836],"copy":[309616962761461,309616963256429],"compute":[309616963256797,309616963362783]},{"expert":31,"read":[309616963381327,309616963764758],"verify":[309616963764758,309616964407680],"copy":[309616964451265,309616964943561],"compute":[309616964944009,309616965059115]}]} +{"trial":2,"buffers":2,"mutant":0,"completed":32,"rejected":0,"wall_ns":30093692,"read_ns":35088640,"copy_ns":15931938,"compute_ns":3451642,"read_compute_pair_overlap_ns":2754334,"failed":0,"origin_monotonic_ns":309616965232590,"spans":[{"expert":0,"read":[309616965275918,309616965969770],"verify":[309616965969770,309616966633557],"copy":[309616966670677,309616967169709],"compute":[309616967170157,309616967278623]},{"expert":1,"read":[309616965312991,309616965867752],"verify":[309616965867752,309616966517843],"copy":[309616967297775,309616967788503],"compute":[309616967788999,309616967905609]},{"expert":2,"read":[309616967302832,309616967768039],"verify":[309616967768039,309616968426834],"copy":[309616968527428,309616969025868],"compute":[309616969026428,309616969135293]},{"expert":3,"read":[309616967922186,309616968261503],"verify":[309616968261503,309616968900682],"copy":[309616969157774,309616969655142],"compute":[309616969655542,309616969762936]},{"expert":4,"read":[309616969179038,309616969679750],"verify":[309616969679750,309616970443027],"copy":[309616970543333,309616971052733],"compute":[309616971053037,309616971159647]},{"expert":5,"read":[309616969794824,309616970166734],"verify":[309616970166734,309616970807929],"copy":[309616971179311,309616971674743],"compute":[309616971675191,309616971782105]},{"expert":6,"read":[309616971183999,309616971577189],"verify":[309616971577189,309616972225184],"copy":[309616972255265,309616972744473],"compute":[309616972744809,309616972851482]},{"expert":7,"read":[309616971805625,309616972162255],"verify":[309616972162255,309616972800698],"copy":[309616972871531,309616973367667],"compute":[309616973368083,309616973476149]},{"expert":8,"read":[309616972879147,309616973264913],"verify":[309616973264913,309616973906780],"copy":[309616973953532,309616974444468],"compute":[309616974444852,309616974552838]},{"expert":9,"read":[309616973510597,309616974077614],"verify":[309616974077614,309616974824203],"copy":[309616974877739,309616975376084],"compute":[309616975376436,309616975482197]},{"expert":10,"read":[309616974576151,309616974967501],"verify":[309616974967501,309616975607639],"copy":[309616975653720,309616976150144],"compute":[309616976150464,309616976256610]},{"expert":11,"read":[309616975510150,309616975864524],"verify":[309616975864524,309616976517782],"copy":[309616976579559,309616977073935],"compute":[309616977074303,309616977180753]},{"expert":12,"read":[309616976282099,309616976673721],"verify":[309616976673721,309616977425653],"copy":[309616977504967,309616978003439],"compute":[309616978003727,309616978110128]},{"expert":13,"read":[309616977212466,309616977597272],"verify":[309616977597272,309616978372389],"copy":[309616978430086,309616978925646],"compute":[309616978926046,309616979033632]},{"expert":14,"read":[309616978129153,309616978466374],"verify":[309616978466374,309616979112721],"copy":[309616979202114,309616979697386],"compute":[309616979697674,309616979803820]},{"expert":15,"read":[309616979058448,309616979470567],"verify":[309616979470567,309616980119489],"copy":[309616980129889,309616980628938],"compute":[309616980629274,309616980736203]},{"expert":16,"read":[309616979840285,309616980376758],"verify":[309616980376758,309616981021424],"copy":[309616981059457,309616981552329],"compute":[309616981552633,309616981659194]},{"expert":17,"read":[309616980769580,309616981174675],"verify":[309616981174675,309616981922159],"copy":[309616981981312,309616982481560],"compute":[309616982481912,309616982589498]},{"expert":18,"read":[309616981682411,309616982071665],"verify":[309616982071665,309616982815741],"copy":[309616982916127,309616983415623],"compute":[309616983415991,309616983524313]},{"expert":19,"read":[309616982618266,309616982964672],"verify":[309616982964672,309616983612410],"copy":[309616983695564,309616984192740],"compute":[309616984193092,309616984300998]},{"expert":20,"read":[309616983544121,309616983967184],"verify":[309616983967184,309616984614011],"copy":[309616984624843,309616985126323],"compute":[309616985126675,309616985233301]},{"expert":21,"read":[309616984325590,309616984666300],"verify":[309616984666300,309616985307382],"copy":[309616985405192,309616985898192],"compute":[309616985898528,309616986006866]},{"expert":22,"read":[309616985261189,309616985665244],"verify":[309616985665244,309616986313031],"copy":[309616986333639,309616986833295],"compute":[309616986833599,309616986940017]},{"expert":23,"read":[309616986034642,309616986369112],"verify":[309616986369112,309616987120212],"copy":[309616987262614,309616987761726],"compute":[309616987762078,309616987870576]},{"expert":24,"read":[309616986968017,309616987264150],"verify":[309616987264150,309616987908929],"copy":[309616988042915,309616988535851],"compute":[309616988536203,309616988642589]},{"expert":25,"read":[309616987897889,309616988272727],"verify":[309616988272727,309616989027315],"copy":[309616989117429,309616989615085],"compute":[309616989615437,309616989722703]},{"expert":26,"read":[309616988663453,309616989067236],"verify":[309616989067236,309616989704382],"copy":[309616989738863,309616990239031],"compute":[309616990239367,309616990346825]},{"expert":27,"read":[309616989743775,309616990169270],"verify":[309616990169270,309616990912178],"copy":[309616990972995,309616991470283],"compute":[309616991470619,309616991578861]},{"expert":28,"read":[309616990378169,309616990783936],"verify":[309616990783936,309616991442875],"copy":[309616991598381,309616992101909],"compute":[309616992102229,309616992211239]},{"expert":29,"read":[309616991610557,309616991973331],"verify":[309616991973331,309616992727920],"copy":[309616992839170,309616993346026],"compute":[309616993346442,309616993453612]},{"expert":30,"read":[309616992251240,309616992595166],"verify":[309616992595166,309616993372890],"copy":[309616993475212,309616993976404],"compute":[309616993976756,309616994084310]},{"expert":31,"read":[309616993487644,309616993874546],"verify":[309616993874546,309616994635823],"copy":[309616994704112,309616995209208],"compute":[309616995209816,309616995325114]}]} +{"trial":3,"buffers":1,"mutant":0,"completed":32,"rejected":0,"wall_ns":56881075,"read_ns":34055468,"copy_ns":15925977,"compute_ns":3431908,"read_compute_pair_overlap_ns":0,"failed":0,"origin_monotonic_ns":309616995641631,"spans":[{"expert":0,"read":[309616995689920,309616996265402],"verify":[309616996265402,309616996906884],"copy":[309616997004582,309616997499774],"compute":[309616997500158,309616997608576]},{"expert":1,"read":[309616997632112,309616997962069],"verify":[309616997962069,309616998599568],"copy":[309616998692289,309616999185817],"compute":[309616999186313,309616999294971]},{"expert":2,"read":[309616999325724,309616999670353],"verify":[309616999670353,309617000419662],"copy":[309617000534815,309617001027431],"compute":[309617001027928,309617001136105]},{"expert":3,"read":[309617001157322,309617001461887],"verify":[309617001461887,309617002100553],"copy":[309617002217755,309617002710531],"compute":[309617002710979,309617002818933]},{"expert":4,"read":[309617002839061,309617003264572],"verify":[309617003264572,309617003901783],"copy":[309617004002792,309617004496192],"compute":[309617004496560,309617004604946]},{"expert":5,"read":[309617004634227,309617005074234],"verify":[309617005074234,309617005719956],"copy":[309617005841622,309617006337006],"compute":[309617006337406,309617006445504]},{"expert":6,"read":[309617006479985,309617006876167],"verify":[309617006876167,309617007631364],"copy":[309617007680708,309617008179053],"compute":[309617008179437,309617008287406]},{"expert":7,"read":[309617008321407,309617008667397],"verify":[309617008667397,309617009316255],"copy":[309617009375072,309617009877752],"compute":[309617009878152,309617009987002]},{"expert":8,"read":[309617010014763,309617010365312],"verify":[309617010365312,309617011008939],"copy":[309617011075436,309617011575108],"compute":[309617011575540,309617011682790]},{"expert":9,"read":[309617011707142,309617012165742],"verify":[309617012165742,309617012802616],"copy":[309617012913962,309617013408962],"compute":[309617013409538,309617013517780]},{"expert":10,"read":[309617013548821,309617013971307],"verify":[309617013971307,309617014629734],"copy":[309617014753496,309617015251744],"compute":[309617015252112,309617015360434]},{"expert":11,"read":[309617015386275,309617015767577],"verify":[309617015767577,309617016405187],"copy":[309617016446180,309617016940172],"compute":[309617016940492,309617017007149]},{"expert":12,"read":[309617017040878,309617017391203],"verify":[309617017391203,309617018057470],"copy":[309617018202465,309617018695577],"compute":[309617018695961,309617018807659]},{"expert":13,"read":[309617018853771,309617019275586],"verify":[309617019275586,309617020027791],"copy":[309617020064079,309617020554887],"compute":[309617020555303,309617020663449]},{"expert":14,"read":[309617020701258,309617021169505],"verify":[309617021169505,309617021811260],"copy":[309617021902957,309617022401109],"compute":[309617022401557,309617022510503]},{"expert":15,"read":[309617022532472,309617022967519],"verify":[309617022967519,309617023612377],"copy":[309617023745611,309617024240596],"compute":[309617024241012,309617024349413]},{"expert":16,"read":[309617024372918,309617024765420],"verify":[309617024765420,309617025414583],"copy":[309617025431319,309617025921199],"compute":[309617025921631,309617026030737]},{"expert":17,"read":[309617026060065,309617026464904],"verify":[309617026464904,309617027110979],"copy":[309617027121923,309617027617147],"compute":[309617027617547,309617027726173]},{"expert":18,"read":[309617027754029,309617028268901],"verify":[309617028268901,309617029018114],"copy":[309617029114675,309617029625484],"compute":[309617029625884,309617029734589]},{"expert":19,"read":[309617029762110,309617030168005],"verify":[309617030168005,309617030810911],"copy":[309617030826687,309617031334744],"compute":[309617031335128,309617031443641]},{"expert":20,"read":[309617031483866,309617032085796],"verify":[309617032085796,309617032728991],"copy":[309617032840416,309617033354713],"compute":[309617033355241,309617033465259]},{"expert":21,"read":[309617033499067,309617033866641],"verify":[309617033866641,309617034510892],"copy":[309617034555260,309617035060261],"compute":[309617035060661,309617035167286]},{"expert":22,"read":[309617035191175,309617035562893],"verify":[309617035562893,309617036204839],"copy":[309617036249304,309617036747952],"compute":[309617036748272,309617036853970]},{"expert":23,"read":[309617036877298,309617037162423],"verify":[309617037162423,309617037803122],"copy":[309617037916435,309617038411419],"compute":[309617038411771,309617038519325]},{"expert":24,"read":[309617038547758,309617038865299],"verify":[309617038865299,309617039510973],"copy":[309617039561342,309617040064039],"compute":[309617040064567,309617040175192]},{"expert":25,"read":[309617040221385,309617040563199],"verify":[309617040563199,309617041204697],"copy":[309617041293275,309617041794659],"compute":[309617041795075,309617041907893]},{"expert":26,"read":[309617042033095,309617042475934],"verify":[309617042475934,309617043238699],"copy":[309617043299996,309617043789556],"compute":[309617043789908,309617043898165]},{"expert":27,"read":[309617043944342,309617044481359],"verify":[309617044481359,309617045121353],"copy":[309617045155802,309617045649522],"compute":[309617045649954,309617045760036]},{"expert":28,"read":[309617045790020,309617046062521],"verify":[309617046062521,309617046703235],"copy":[309617046707827,309617047215276],"compute":[309617047215948,309617047324061]},{"expert":29,"read":[309617047367902,309617047700516],"verify":[309617047700516,309617048474272],"copy":[309617048563154,309617049065482],"compute":[309617049065898,309617049173740]},{"expert":30,"read":[309617049207884,309617049569538],"verify":[309617049569538,309617050214205],"copy":[309617050260605,309617050753974],"compute":[309617050754342,309617050862167]},{"expert":31,"read":[309617050892712,309617051260942],"verify":[309617051260942,309617051904968],"copy":[309617051923369,309617052414049],"compute":[309617052414513,309617052521842]}]} +{"trial":4,"buffers":2,"mutant":0,"completed":32,"rejected":0,"wall_ns":30901322,"read_ns":36727318,"copy_ns":15919398,"compute_ns":3524712,"read_compute_pair_overlap_ns":2152801,"failed":0,"origin_monotonic_ns":309617052765078,"spans":[{"expert":0,"read":[309617052817751,309617053534899],"verify":[309617053534899,309617054313872],"copy":[309617054340192,309617054846136],"compute":[309617054846568,309617054956106]},{"expert":1,"read":[309617052818279,309617053669397],"verify":[309617053669397,309617054426578],"copy":[309617054978043,309617055481955],"compute":[309617055482435,309617055590773]},{"expert":2,"read":[309617054992155,309617055486211],"verify":[309617055486211,309617056248991],"copy":[309617056371809,309617056869786],"compute":[309617056870250,309617056978907]},{"expert":3,"read":[309617055622309,309617056021516],"verify":[309617056021516,309617056777992],"copy":[309617057004332,309617057511892],"compute":[309617057512452,309617057622070]},{"expert":4,"read":[309617057012812,309617057405186],"verify":[309617057405186,309617058163135],"copy":[309617058259728,309617058768505],"compute":[309617058768889,309617058877947]},{"expert":5,"read":[309617057650262,309617058169071],"verify":[309617058169071,309617058811593],"copy":[309617058899819,309617059393219],"compute":[309617059393571,309617059501845]},{"expert":6,"read":[309617058905883,309617059266945],"verify":[309617059266945,309617059908027],"copy":[309617059975244,309617060475765],"compute":[309617060476117,309617060584166]},{"expert":7,"read":[309617059619831,309617060072974],"verify":[309617060072974,309617060817962],"copy":[309617060909756,309617061410020],"compute":[309617061410372,309617061529862]},{"expert":8,"read":[309617060612311,309617060964397],"verify":[309617060964397,309617061609479],"copy":[309617061706585,309617062210481],"compute":[309617062210945,309617062321091]},{"expert":9,"read":[309617061561238,309617062082159],"verify":[309617062082159,309617062828075],"copy":[309617062949181,309617063444869],"compute":[309617063445301,309617063553575]},{"expert":10,"read":[309617062346339,309617062669721],"verify":[309617062669721,309617063377364],"copy":[309617063572999,309617064078336],"compute":[309617064078720,309617064186769]},{"expert":11,"read":[309617063577207,309617063967726],"verify":[309617063967726,309617064609752],"copy":[309617064660265,309617065161777],"compute":[309617065162113,309617065275411]},{"expert":12,"read":[309617064213634,309617064565560],"verify":[309617064565560,309617065211026],"copy":[309617065294676,309617065789292],"compute":[309617065789692,309617065900765]},{"expert":13,"read":[309617065303956,309617065675338],"verify":[309617065675338,309617066432294],"copy":[309617066526968,309617067025584],"compute":[309617067025920,309617067135378]},{"expert":14,"read":[309617065927358,309617066367605],"verify":[309617066367605,309617067008576],"copy":[309617067157010,309617067652810],"compute":[309617067653162,309617067761388]},{"expert":15,"read":[309617067160946,309617067568137],"verify":[309617067568137,309617068210595],"copy":[309617068235460,309617068731596],"compute":[309617068731932,309617068840494]},{"expert":16,"read":[309617067785036,309617068287540],"verify":[309617068287540,309617069041697],"copy":[309617069154915,309617069646251],"compute":[309617069646587,309617069753741]},{"expert":17,"read":[309617068869838,309617069266437],"verify":[309617069266437,309617069909295],"copy":[309617069924863,309617070414327],"compute":[309617070414663,309617070534361]},{"expert":18,"read":[309617069780589,309617070371863],"verify":[309617070371863,309617071127843],"copy":[309617071155699,309617071648876],"compute":[309617071649388,309617071761117]},{"expert":19,"read":[309617070577738,309617071027377],"verify":[309617071027377,309617071670332],"copy":[309617071782702,309617072288966],"compute":[309617072289494,309617072397576]},{"expert":20,"read":[309617071787374,309617072267670],"verify":[309617072267670,309617072907456],"copy":[309617073005026,309617073503258],"compute":[309617073503626,309617073611692]},{"expert":21,"read":[309617072419208,309617072765854],"verify":[309617072765854,309617073406504],"copy":[309617073630780,309617074120276],"compute":[309617074120708,309617074235574]},{"expert":22,"read":[309617073639276,309617074130388],"verify":[309617074130388,309617074877440],"copy":[309617074999698,309617075492602],"compute":[309617075493306,309617075604812]},{"expert":23,"read":[309617074257750,309617074669949],"verify":[309617074669949,309617075318744],"copy":[309617075632797,309617076130437],"compute":[309617076130949,309617076241191]},{"expert":24,"read":[309617075653645,309617076076228],"verify":[309617076076228,309617076822288],"copy":[309617076870945,309617077374089],"compute":[309617077374569,309617077483819]},{"expert":25,"read":[309617076265719,309617076664446],"verify":[309617076664446,309617077343449],"copy":[309617077505243,309617077997684],"compute":[309617077998276,309617078112357]},{"expert":26,"read":[309617077512700,309617077978019],"verify":[309617077978019,309617078730815],"copy":[309617078752416,309617079244472],"compute":[309617079244936,309617079353914]},{"expert":27,"read":[309617078143286,309617078572509],"verify":[309617078572509,309617079218487],"copy":[309617079380346,309617079867474],"compute":[309617079867922,309617079977012]},{"expert":28,"read":[309617079388458,309617079798513],"verify":[309617079798513,309617080556749],"copy":[309617080606174,309617081104486],"compute":[309617081104998,309617081213128]},{"expert":29,"read":[309617080020149,309617080374618],"verify":[309617080374618,309617081153431],"copy":[309617081236217,309617081728689],"compute":[309617081729137,309617081837906]},{"expert":30,"read":[309617081246729,309617081687072],"verify":[309617081687072,309617082337530],"copy":[309617082460621,309617082956917],"compute":[309617082957269,309617083065254]},{"expert":31,"read":[309617081864195,309617082261209],"verify":[309617082261209,309617082903908],"copy":[309617083066918,309617083555998],"compute":[309617083556382,309617083665360]}]} +{"trial":5,"buffers":1,"mutant":0,"completed":32,"rejected":0,"wall_ns":57048806,"read_ns":34541734,"copy_ns":15792929,"compute_ns":3306793,"read_compute_pair_overlap_ns":0,"failed":0,"origin_monotonic_ns":309617083957525,"spans":[{"expert":0,"read":[309617083989654,309617084567215],"verify":[309617084567215,309617085216170],"copy":[309617085307227,309617085795651],"compute":[309617085796067,309617085903653]},{"expert":1,"read":[309617085940917,309617086382253],"verify":[309617086382253,309617087021015],"copy":[309617087143145,309617087638673],"compute":[309617087639073,309617087748787]},{"expert":2,"read":[309617087773827,309617088071640],"verify":[309617088071640,309617088709475],"copy":[309617088833813,309617089327053],"compute":[309617089327469,309617089434831]},{"expert":3,"read":[309617089464031,309617089765236],"verify":[309617089765236,309617090407215],"copy":[309617090517472,309617091009800],"compute":[309617091010184,309617091117578]},{"expert":4,"read":[309617091138891,309617091464608],"verify":[309617091464608,309617092104298],"copy":[309617092158763,309617092650035],"compute":[309617092650403,309617092758357]},{"expert":5,"read":[309617092785829,309617093306494],"verify":[309617093306494,309617094072955],"copy":[309617094139356,309617094630516],"compute":[309617094630868,309617094738550]},{"expert":6,"read":[309617094760214,309617095064651],"verify":[309617095064651,309617095702773],"copy":[309617095819495,309617096311807],"compute":[309617096312159,309617096419537]},{"expert":7,"read":[309617096446513,309617096763559],"verify":[309617096763559,309617097400561],"copy":[309617097457666,309617097950922],"compute":[309617097951258,309617098058092]},{"expert":8,"read":[309617098090156,309617098466531],"verify":[309617098466531,309617099123661],"copy":[309617099147790,309617099646406],"compute":[309617099646982,309617099755656]},{"expert":9,"read":[309617099782104,309617100166014],"verify":[309617100166014,309617100804121],"copy":[309617100837849,309617101328817],"compute":[309617101329313,309617101436883]},{"expert":10,"read":[309617101464692,309617101870362],"verify":[309617101870362,309617102513733],"copy":[309617102526933,309617103026541],"compute":[309617103026861,309617103135215]},{"expert":11,"read":[309617103171215,309617103576518],"verify":[309617103576518,309617104333123],"copy":[309617104372307,309617104867531],"compute":[309617104867835,309617104975341]},{"expert":12,"read":[309617105000141,309617105362435],"verify":[309617105362435,309617105998638],"copy":[309617106059743,309617106552391],"compute":[309617106552743,309617106660153]},{"expert":13,"read":[309617106689689,309617107072879],"verify":[309617107072879,309617107712954],"copy":[309617107740058,309617108231266],"compute":[309617108231618,309617108338900]},{"expert":14,"read":[309617108374149,309617108993999],"verify":[309617108993999,309617109647226],"copy":[309617109733339,309617110242867],"compute":[309617110243507,309617110352901]},{"expert":15,"read":[309617110384646,309617110764508],"verify":[309617110764508,309617111404054],"copy":[309617111442775,309617111940239],"compute":[309617111940703,309617112004848]},{"expert":16,"read":[309617112032977,309617112475336],"verify":[309617112475336,309617113233060],"copy":[309617113251093,309617113741549],"compute":[309617113741965,309617113850078]},{"expert":17,"read":[309617113975280,309617114367799],"verify":[309617114367799,309617115126915],"copy":[309617115216517,309617115704941],"compute":[309617115705325,309617115813743]},{"expert":18,"read":[309617115936193,309617116575659],"verify":[309617116575659,309617117332535],"copy":[309617117460489,309617117954113],"compute":[309617117954481,309617118065011]},{"expert":19,"read":[309617118107028,309617118579196],"verify":[309617118579196,309617119336184],"copy":[309617119464730,309617119965698],"compute":[309617119966098,309617120075316]},{"expert":20,"read":[309617120115813,309617120569980],"verify":[309617120569980,309617121216599],"copy":[309617121307064,309617121795680],"compute":[309617121796064,309617121904402]},{"expert":21,"read":[309617121937843,309617122368314],"verify":[309617122368314,309617123031685],"copy":[309617123141254,309617123630766],"compute":[309617123631102,309617123739168]},{"expert":22,"read":[309617123762913,309617124164311],"verify":[309617124164311,309617124802386],"copy":[309617124818482,309617125317450],"compute":[309617125317882,309617125425612]},{"expert":23,"read":[309617125452716,309617125767729],"verify":[309617125767729,309617126412380],"copy":[309617126458269,309617126945989],"compute":[309617126946325,309617127003782]},{"expert":24,"read":[309617127031526,309617127398460],"verify":[309617127398460,309617128154136],"copy":[309617128236362,309617128727234],"compute":[309617128727586,309617128834724]},{"expert":25,"read":[309617128859364,309617129252938],"verify":[309617129252938,309617129995495],"copy":[309617130065176,309617130554832],"compute":[309617130555200,309617130662385]},{"expert":26,"read":[309617130695122,309617131073096],"verify":[309617131073096,309617131716931],"copy":[309617131747923,309617132243211],"compute":[309617132243531,309617132350189]},{"expert":27,"read":[309617132392446,309617132798485],"verify":[309617132798485,309617133556273],"copy":[309617133584929,309617134087626],"compute":[309617134087962,309617134195835]},{"expert":28,"read":[309617134222988,309617134596978],"verify":[309617134596978,309617135356622],"copy":[309617135428416,309617135915784],"compute":[309617135916152,309617136011465]},{"expert":29,"read":[309617136037258,309617136365775],"verify":[309617136365775,309617137006537],"copy":[309617137093803,309617137587043],"compute":[309617137587507,309617137696325]},{"expert":30,"read":[309617137722565,309617137962905],"verify":[309617137962905,309617138619988],"copy":[309617138762422,309617139258046],"compute":[309617139258718,309617139367088]},{"expert":31,"read":[309617139397745,309617139761606],"verify":[309617139761606,309617140408481],"copy":[309617140452354,309617140939466],"compute":[309617140939930,309617141005259]}]} +{"trial":6,"buffers":2,"mutant":0,"completed":32,"rejected":0,"wall_ns":30345153,"read_ns":35644438,"copy_ns":15819701,"compute_ns":3424121,"read_compute_pair_overlap_ns":2861055,"failed":0,"origin_monotonic_ns":309617141228526,"spans":[{"expert":0,"read":[309617141264447,309617141978299],"verify":[309617141978299,309617142731383],"copy":[309617142773560,309617143267536],"compute":[309617143268080,309617143377362]},{"expert":1,"read":[309617141282607,309617141989099],"verify":[309617141989099,309617142744087],"copy":[309617143399074,309617143896778],"compute":[309617143897130,309617144005420]},{"expert":2,"read":[309617143411874,309617143766184],"verify":[309617143766184,309617144431523],"copy":[309617144484180,309617144972924],"compute":[309617144973244,309617145080686]},{"expert":3,"read":[309617144034636,309617144395906],"verify":[309617144395906,309617145150191],"copy":[309617145257088,309617145748200],"compute":[309617145748568,309617145856714]},{"expert":4,"read":[309617145108686,309617145466164],"verify":[309617145466164,309617146109886],"copy":[309617146157071,309617146649607],"compute":[309617146649943,309617146765481]},{"expert":5,"read":[309617145881019,309617146269409],"verify":[309617146269409,309617146911787],"copy":[309617146938396,309617147436036],"compute":[309617147436436,309617147544294]},{"expert":6,"read":[309617146803834,309617147298002],"verify":[309617147298002,309617148053390],"copy":[309617148155920,309617148648696],"compute":[309617148649176,309617148757866]},{"expert":7,"read":[309617147577270,309617147866075],"verify":[309617147866075,309617148511638],"copy":[309617148778618,309617149267714],"compute":[309617149268146,309617149376676]},{"expert":8,"read":[309617148785034,309617149165664],"verify":[309617149165664,309617149808171],"copy":[309617149856268,309617150349620],"compute":[309617150350148,309617150457782]},{"expert":9,"read":[309617149407188,309617150075055],"verify":[309617150075055,309617150820236],"copy":[309617150934029,309617151425829],"compute":[309617151426245,309617151533735]},{"expert":10,"read":[309617150484614,309617150974462],"verify":[309617150974462,309617151730714],"copy":[309617151856908,309617152347524],"compute":[309617152347940,309617152464742]},{"expert":11,"read":[309617151558952,309617151969902],"verify":[309617151969902,309617152610793],"copy":[309617152645321,309617153141153],"compute":[309617153141537,309617153249203]},{"expert":12,"read":[309617152492791,309617152764267],"verify":[309617152764267,309617153410038],"copy":[309617153421142,309617153915918],"compute":[309617153916254,309617154004432]},{"expert":13,"read":[309617153274276,309617153565960],"verify":[309617153565960,309617154211859],"copy":[309617154329173,309617154821341],"compute":[309617154821693,309617154928463]},{"expert":14,"read":[309617154041776,309617154682971],"verify":[309617154682971,309617155444791],"copy":[309617155556073,309617156057713],"compute":[309617156058065,309617156164547]},{"expert":15,"read":[309617154952287,309617155263620],"verify":[309617155263620,309617155900959],"copy":[309617156183539,309617156675755],"compute":[309617156676091,309617156785069]},{"expert":16,"read":[309617156192995,309617156643051],"verify":[309617156643051,309617157401719],"copy":[309617157418183,309617157908672],"compute":[309617157909008,309617158003729]},{"expert":17,"read":[309617156815102,309617157063410],"verify":[309617157063410,309617157700012],"copy":[309617158025777,309617158518826],"compute":[309617158519146,309617158627371]},{"expert":18,"read":[309617158032946,309617158365399],"verify":[309617158365399,309617159015538],"copy":[309617159100675,309617159589323],"compute":[309617159589675,309617159710205]},{"expert":19,"read":[309617158653388,309617159284630],"verify":[309617159284630,309617160059683],"copy":[309617160174517,309617160670749],"compute":[309617160671229,309617160781359]},{"expert":20,"read":[309617159747246,309617160271046],"verify":[309617160271046,309617160920753],"copy":[309617160952577,309617161452858],"compute":[309617161453258,309617161561019]},{"expert":21,"read":[309617160805407,309617161169845],"verify":[309617161169845,309617161815119],"copy":[309617161885345,309617162376857],"compute":[309617162377193,309617162484842]},{"expert":22,"read":[309617161585100,309617161963922],"verify":[309617161963922,309617162605100],"copy":[309617162654413,309617163149765],"compute":[309617163150085,309617163257671]},{"expert":23,"read":[309617162502715,309617162863009],"verify":[309617162863009,309617163518539],"copy":[309617163583420,309617164076533],"compute":[309617164076837,309617164184006]},{"expert":24,"read":[309617163282823,309617163563644],"verify":[309617163563644,309617164205943],"copy":[309617164355929,309617164849617],"compute":[309617164849905,309617164957171]},{"expert":25,"read":[309617164210839,309617164663614],"verify":[309617164663614,309617165421098],"copy":[309617165435099,309617165924531],"compute":[309617165924883,309617166005636]},{"expert":26,"read":[309617164984803,309617165363658],"verify":[309617165363658,309617166008276],"copy":[309617166022436,309617166513804],"compute":[309617166514124,309617166620894]},{"expert":27,"read":[309617166025028,309617166365178],"verify":[309617166365178,309617167008821],"copy":[309617167096742,309617167589582],"compute":[309617167589902,309617167696240]},{"expert":28,"read":[309617166656143,309617167087142],"verify":[309617167087142,309617167835730],"copy":[309617167867539,309617168366379],"compute":[309617168366779,309617168474220]},{"expert":29,"read":[309617167727664,309617168088918],"verify":[309617168088918,309617168836418],"copy":[309617168932420,309617169430652],"compute":[309617169431132,309617169541710]},{"expert":30,"read":[309617168496093,309617168863139],"verify":[309617168863139,309617169505325],"copy":[309617169571566,309617170080455],"compute":[309617170080967,309617170190889]},{"expert":31,"read":[309617169586239,309617170120423],"verify":[309617170120423,309617170870740],"copy":[309617170963045,309617171464797],"compute":[309617171465133,309617171572639]}]} ``` The diff is longer than this page shows; the raw diff has all of it.