Dissolve the M0 crates (core/io/proto/telemetry/hip/cli) into the approved service layout abi/kn/ld/cc/rt/lab/sp/nt/tm/gw (docs/ARCHITECTURE.md). - kn: Lean-verified control bus + service registry (bus_lifecycle.lean, 14 thms) and SlabRing/UMA broker; rt: PrefixState + hybrid checkpoint pool. - sp: faithful throughput-aware Adaptive-K port of clover_policy.h (cooldowns, probes, throughput guards) with scenario parity tests. - gw: strata-ctl-compatible wire emitters + serve session FSM (serve_session.lean, 10 thms); abi::serve accepts image= (Vision delta closed). - abi: pure contracts, checked JSON/VTC1/GEN parsers, zero-alloc sampler. - ld/cc: checked safetensors reader + write-once VTC1 writer / O_RDONLY reader. - tm: lock-free telemetry; nt: LyraRpc; lab shares the rt executor core. - Docs: ARCHITECTURE.md decision-complete spec (MoE-only scope, .vbundle, .vplan->CompiledPlan, wire contract, migration map); AGENTS.md Lean rule + tandem/review workflow. Verified live: cargo test --workspace -D warnings = 46/46 PASS; lean proofs = 34 theorems (slab_ring_dma 10, bus_lifecycle 14, serve_session 10), 0 sorryAx, standard axioms only; vetta-infer info on Inkling = 1244 tensors, 18.18 GiB, checked bounds.
44 lines
1.5 KiB
Rust
44 lines
1.5 KiB
Rust
//! Core pluggable traits and shared domain types: WeightStore quantization formats,
|
|
//! Speculative Drafting (local or Lyra LAN), and Prefetching.
|
|
|
|
/// `(layer, expert)` identity of one MoE expert (shared by cc, tm, sp).
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
pub struct ExpertKey {
|
|
pub layer: u16,
|
|
pub expert: u16,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
pub enum QuantFormat {
|
|
Bf16,
|
|
Fp32,
|
|
Q8G64T16,
|
|
Q4G64T16,
|
|
NvFp4,
|
|
MxFp8,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct DraftProposal {
|
|
pub tokens: Vec<i32>,
|
|
/// Optional scalar draft probabilities `q(x_j)` for lossless non-greedy Leviathan verification.
|
|
pub draft_probs: Option<Vec<f32>>,
|
|
}
|
|
|
|
/// Pluggable speculative drafter:
|
|
/// - Local MTP (1-layer) / Block-Diffusion preview
|
|
/// - Remote LAN drafter on **Lyra** (`~128 B/step`, `~0.3 ms` RTT on 2.5 Gbps Ethernet)
|
|
pub trait DraftProvider: Send {
|
|
fn name(&self) -> &'static str;
|
|
fn propose(&mut self, prefix_tail: &[i32], max_k: usize) -> Result<DraftProposal, String>;
|
|
fn notify_accepted(&mut self, accepted_tokens: &[i32]) -> Result<(), String>;
|
|
fn reset(&mut self);
|
|
}
|
|
|
|
/// Pluggable MoE prefetch advisor:
|
|
/// - Local router lookahead (`h_{L-1} -> W_router[L]`)
|
|
/// - Remote domain classifier on **Lyra** (`Dante/letteratura` vs `Lean 4/matematica` -> NVMe pre-warm)
|
|
pub trait PrefetchAdvisor: Send {
|
|
fn on_prompt_domain(&mut self, domain_tag: &str) -> Vec<ExpertKey>;
|
|
fn on_layer_routed(&mut self, layer: u16, active_experts: &[u16]) -> Vec<ExpertKey>;
|
|
} |