interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / docs / campaigns / dual / 2026-10-04-macro-snapshot-receipt.md

109 lines · 6255 bytes Raw Blame History Rendered
1# Receipt: DUAL serve observation snapshot (read-only macroscopic adapter, DUAL-3a)
2
3Program: ARCH-0031 "DUAL, Constraint Pricing for Soft Resource Budgets".
4Deliverable: an immutable snapshot of the serve path built only from existing
5exact counters, with normalized densities and exact deltas, for DUAL
6observation. Companion to the `serve.admit_preempt` decision observer
7(`2026-10-04-serve-observer-receipt.md`); independent of it (no shared code,
8no dependency on that branch).
9
10**Gate verdict: none claimed.** `DUAL_ADVISORY_SCHEDULER` is NOT claimed
11PASS. No snapshot field is an authority input anywhere; nothing here can
12change a scheduling, admission, preemption or KV decision.
13
14## 1. Identity
15
16| Field | Value |
17|---|---|
18| Repository | `aien-dev/aien-sovereign-core` |
19| Base commit (GitHub `main`) | `91fba8fc0f00fd09fc3e9a6137522af3ae79c4e1` |
20| Branch | `dual/macro-snapshot` (from `main`, not stacked) |
21| Tree | clean at each recorded command |
22| Compiler | `rustc 1.98.1 (48a229cea 2026-09-01)`, `cargo 1.98.1 (797e8a9bc 2026-08-05)` |
23| Build config | `dev` profile (as CI) |
24| Host | NVIDIA DGX Spark, GB10, aarch64, Linux 7.0.0-1019-nvidia, 20 CPUs |
25| GPU exercised | **No.** Tests run `MockInferenceBackend` on the host CPU. |
26
27## 2. What changed
28
29New crate `crates/aien-dual-observation` (registered in the workspace
30members list; `Cargo.lock` gains its entry). It depends on `aien-scheduler`,
31`aien-kv-cache`, `aien-abi-core` and `serde` only, and reads them through
32`&AienScheduler`, `&AienKvManager`, `&StepMetrics`, `&ScheduledBatch`.
33Living in its own crate means it can reach only public counters; it cannot
34touch scheduler or KV internals by construction. No existing crate changed.
35
36Types (`src/lib.rs`):
37
38- `Density { numerator, denominator }` with `value() -> Option<f64>`:
39 `None` when `denominator == 0`. Every quotient in the crate is one of these.
40- `StepReading` (from `StepMetrics`, timing field left out), `BatchReading`
41 (from `ScheduledBatch`: counts and the token sum the scheduler compares to
42 `max_batch_tokens`).
43- `ServeObservationSnapshot::capture(&scheduler, &kv, last_step, last_batch)`.
44 Every field's doc names its source counter: `SchedulerMetrics::total_steps`
45 (generation), `waiting_count`, `preempted_count`, `running_count`,
46 `SequenceArena::active_count`, the six `SchedulerMetrics` lifetime
47 counters, three `SchedulerConfig` limits, `total_block_count`,
48 `available_blocks`, `allocated_block_count`, `active_sequence_count`, the
49 six `KvMetrics` fields, the pool half of the watermark predicate, and five
50 densities (`kv_block`, `kv_sharing`, `running_slot`, `batch_slot`,
51 `batch_token`).
52- `ObservationDelta::between(earlier, later)`: exact differences (steps,
53 arrivals = `admitted_requests` diff, completions, preemptions, prefill and
54 decode tokens, signed changes of allocated blocks, running and waiting).
55 Refuses a reversed generation, a lifetime counter that went backwards, or a
56 different pool size (`DeltaError`).
57
58No interpolation, no estimate, no state kept between calls, no new state
59machine. The scheduler's own `step_id` is private and is not duplicated; the
60generation is the existing `total_steps` counter (documented).
61
62## 3. Tests
63
64`crates/aien-dual-observation/tests/snapshot_conservation.rs` runs the real
65`AienScheduler` and `AienKvManager` with the mock backend through a mixed
66workload (admission, 150-token chunked prefill, completion) and a watermark
67pressure workload (6-block pool, watermark 3, one preemption), snapshotting
68after every submit and every step, and asserts at every snapshot:
69
70| Ledger check | Exact statement |
71|---|---|
72| KV partition | `physical_pages (ref_count>0) + free_blocks == total_blocks`; `allocated + free == total`; `used_blocks == physical_pages`; `shared + private == physical`; `logical >= physical` |
73| Sequence state machine | `arena_active == running + waiting + preempted` |
74| Lifetime ledger | `admitted_requests == finished_requests + running + waiting + preempted` (workload submits only through `submit_request`, never cancels; fork children via `fork_sequence` and cancellation are the documented cases where this denominator does not apply) |
75| Step reading | `StepMetrics::active_kv_blocks == allocated_block_count` right after the step |
76| Densities | numerators and denominators equal the named counters; `kv_below_watermark == free < watermark` |
77
78Plus: deltas equal counter differences and sum over consecutive snapshots to
79the whole (arrivals 5, completions 5, prefill tokens 274 = submitted prompt
80tokens); refusals for reversed order, foreign pool size and a counter that
81went backwards; zero-capacity scheduler (0 blocks, batch size 0): every
82density is `None`, not 0; `BatchReading` token sum; serde round trip.
83
84Commands and results are in §5.
85
86## 4. Limits
87
88- Mock backend, host CPU, no GPU, no real model.
89- The snapshot is a point reading; the caller supplies `last_step` and
90 `last_batch` because the scheduler does not retain them. A capture with
91 `None` for both still holds every counter.
92- `generation` is `total_steps` (steps that executed a batch), not the
93 scheduler's private per-call `step_id`.
94
95## 5. Run log
96
97| Command | Result |
98|---|---|
99| `cargo test -p aien-dual-observation` | 8 passed, 0 failed (1 unit: zero-denominator rule; 7 integration: ledgers close at every snapshot under plenty and under watermark pressure, deltas exact and additive, reversed / foreign / backwards refused, zero-capacity densities `None`, batch reading sums, serde round trip) |
100| `cargo clippy -p aien-dual-observation --all-targets -- -D warnings` | exit 0 |
101| `cargo fmt --all -- --check` | exit 0 |
102| `cargo check --workspace --all-targets` | Finished (new member builds with the workspace) |
103| `crumb compile .` then `crumb verify .` before the commit | see commit; the post-commit STALE reading of the root crumb is the tool's `generated_at_commit` behaviour, also present on pristine `main` (documented in the observer receipt §9.1 T7) |
104
105Negative control (by construction): the crate holds `&AienScheduler` and
106`&AienKvManager` only; there is no `&mut` path and no return value the
107scheduler reads. Nothing to inject.
108
109Candidate commit: the commit carrying this file (see the PR).