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
aien-sovereign-core-mv / crates / aien-expert-residency / src / lib.rs
| 1 | //! Omega Expert Ribbon P2 (sc#630): the bounded host-side expert residency |
| 2 | //! manager. |
| 3 | //! |
| 4 | //! This crate is the cache policy and correctness state machine only. It |
| 5 | //! hands out slot numbers and generations; it never touches GPU pointers, |
| 6 | //! NVMe devices or decode. The caller (the read adapter of sc#629, the |
| 7 | //! versioned GPU slots of omega#533, wiring in sc#632) drives the transfers |
| 8 | //! and reports each step back. |
| 9 | //! |
| 10 | //! * [`budget`]: the memory ledger. OS / resource-manager headroom, |
| 11 | //! non-expert weights, the model KV cache at the configured maximum context, |
| 12 | //! scratch and staging are reserved first; only what is left becomes fixed |
| 13 | //! expert slots. Oversubscription is refused, never assumed away. |
| 14 | //! * [`manager`]: the residency state machine. One expert identity maps to |
| 15 | //! one slot and one generation. States run |
| 16 | //! `Absent -> Fetching -> Verified -> Copying -> Ready -> InUse -> Evictable`, |
| 17 | //! and a failure is explicit. A pinned slot is never evicted. Eviction is |
| 18 | //! least recently used with a deterministic logical clock. Every refusal is |
| 19 | //! a typed [`Refusal`]. |
| 20 | //! |
| 21 | //! Correctness rule (aienix#4 invariant 1): a miss either waits for the exact |
| 22 | //! expert the router selected or fails explicitly. This crate has no notion of |
| 23 | //! a substitute expert, a dropped expert or a lower-precision fallback. |
| 24 | |
| 25 | pub mod budget; |
| 26 | pub mod error; |
| 27 | pub mod manager; |
| 28 | |
| 29 | pub use budget::{AllocationReport, Category, KvShape, Ledger, MemoryBudget}; |
| 30 | pub use error::{BudgetError, FailureCause, Refusal}; |
| 31 | pub use manager::{ |
| 32 | Acquired, ExpertIdentity, ExpertPart, ExpertState, FetchTicket, Phase, Pin, PinStatus, |
| 33 | ResidencyConfig, ResidencyManager, SlotId, Stats, |
| 34 | }; |