Crate metrale_scheduler

Crate metrale_scheduler 

Source
Expand description

2026-09-25: The scheduler’s I/O contract (SBIO).

The core (in the server crate) hands device work to a DeviceIo as StepPlans and Effects, and can reach the model itself through DeviceIo::model. The clock is a ClockIo, swap files a SpillIo. driver::run is the scheduler loop.

ScriptedDeviceIo wraps a router and answers the decode lane from a script, so a test can drive the real core with chosen tokens. TracingDeviceIo wraps a router and logs each call.

Owner: scheduler. Invariants:

  • The sequence state, the device logits handle and the model are type parameters, never a concrete model type, anywhere in this crate.

Re-exports§

pub use clock::ClockIo;
pub use clock::SystemClock;
pub use device::DeviceIo;
pub use driver::Core;
pub use driver::LaneVerdict;
pub use driver::TickPlan;
pub use driver::run;
pub use effect::Effect;
pub use effect::EffectOutcome;
pub use plan::DecodeCtxCommit;
pub use plan::DecodeRows;
pub use plan::FeedSource;
pub use plan::Label;
pub use plan::Readback;
pub use plan::RowMask;
pub use plan::StepOutcome;
pub use plan::StepPlan;
pub use plan::StepResult;
pub use scripted::Fault;
pub use scripted::ScriptedDeviceIo;
pub use spill::SpillIo;
pub use trace_device::TraceSink;
pub use trace_device::TracingDeviceIo;
pub use types::DeviceError;
pub use types::DeviceFacts;
pub use types::Ticket;
pub use types::WaitPolicy;

Modules§

clock
2026-09-25: ClockIo, the injectable clock, and SystemClock, its implementation over Instant::now.
device
2026-09-25: DeviceIo, the model-facing router: the core launches StepPlans and applies Effects, and the router decides how they reach the device.
driver
2026-09-25: The scheduler loop. A Core plans a tick, executes its lanes and ends it; run only sequences those calls and never touches a device.
effect
2026-09-25: Effect, the device-side bookkeeping the core asks a router for between steps, and EffectOutcome, the router’s answer. Generic over the sequence state S and the logits handle P.
plan
2026-09-25: What the core asks the device to run (StepPlan) and what comes back (StepResult). Generic over the device’s logits handle P.
scripted
2026-09-25: ScriptedDeviceIo, a test router wrapped around an inner router. It answers the decode lane’s readback from a script (per sequence, in order), fails a launch on cue, reports a configurable depth, and records every effect and LoRA command, while the inner router still performs the device bookkeeping the rows need.
spill
2026-09-25: SpillIo, the swap files a sequence is spilled to when the KV pool runs dry. The router owns the files, their ids and the usage ledger.
trace_device
2026-09-25: TracingDeviceIo, a decorator that writes one line per launch, effect, LoRA command and teardown into a sink, then forwards the call to the inner DeviceIo.
types
2026-09-25: Small value types shared by the routers.