Expand description
The compilation pipeline. Each pass is a pure function over
GraphProto / FunctionProto. Composition flattens at
authoring time, so no compiler-side sub-Module inlining pass
exists. partition_by_wire_ops slices at wire ops via
reachability + names partitions by longest common
module_instance prefix.
Re-exports§
pub use analyze_wire_edges::analyze_wire_edges;pub use derive_wire_deadlines::derive_wire_deadlines;pub use driver::Compiler;pub use driver::CompilerStage;pub use driver::PassError;pub use error::CompileError;pub use error::SlotSource;pub use error::ValidationError;pub use expand_ops::expand_ops;pub use inline_for_partition::inline_for_partition;pub use insert_async_deadlines::insert_async_deadlines;pub use insert_backoff_gate_rx::insert_backoff_gate_rx;pub use insert_backoff_gate_tx::insert_backoff_gate_tx;pub use insert_dedup_gate_rx::insert_dedup_gate_rx;pub use insert_peer_health_gate_rx::insert_peer_health_gate_rx;pub use insert_peer_health_gate_tx::insert_peer_health_gate_tx;pub use partition_by_wire_ops::partition_by_wire_ops;pub use partition_by_wire_ops::NetworkAnalysis;pub use partition_by_wire_ops::WireEdge;pub use resolve_slots::resolve_slots;pub use runner::CANONICAL_PASS_NAMES;pub use stamp_compilation_metadata::stamp_for_test;pub use synthesize_wire_recvs::synthesize_wire_recvs;pub use type_solver::TypeError;pub use type_solver::TypeSolution;pub use type_solver::TypeSolver;pub use validate::validate;pub use validate_bootstrap_composition::validate_bootstrap_composition;pub use validate_runtime_complete::validate_runtime_complete;pub use verify_no_dangling_calls::verify_no_dangling_calls;
Modules§
- analyze_
wire_ edges analyze_wire_edges— classify each cross-Node edge asdataortrigger_onlyand group sends in the same cycle scope for batching.- derive_
wire_ deadlines - Stamps each
wire.Send’s static deadline from the (per_hop_budget_ns × chain_depth) formula, defaulting to chain_depth = 1 when nochain_depthon every target-boundarywire.Send. For each such Send, computes the static deadline aschain_depth * per_hop_budget_nsand stamps it as adeadline_ns: i64attribute on the NodeProto. The existingsuper::insert_async_deadlinespass then inserts aDeadlineCheckgate upstream so the deadline is enforced at runtime. - driver
Compiler— single compile entry point. Canonical pipeline runs once per compile target; user stages fire after, once per emitted partition.- error
- Compiler error taxonomies.
ValidationErroris exclusive tovalidate;CompileErrorcovers everything else and wrapsValidationErrorviaFrom. - expand_
ops expand_ops— materialize op-variant choices.- gate_
contract - Open
GateContractinventory consumed by [crate::validate_runtime_complete]. - infer_
peer_ classes infer_peer_classes- stamp every NodeProto with the class of Node it runs on.- inline_
for_ partition - Selective function inlining for the partition stage.
- insert_
async_ deadlines - Pair every NodeProto carrying a
deadline_nsattribute with an upstreamDeadlineChecksyscall gate. The check writes to a new sibling<node>#__trigger_deadlineslot so the protected node fires only after both its original payload AND the deadline gate. - insert_
backoff_ gate_ rx - Compiler pass - pair every synthesized
wire::Recvop with a downstreamBackoffGateRx. Runs afterinsert_peer_health_gate_rxso the RX chain order isRecv → DedupGateRx → PeerHealthGateRx → BackoffGateRx. - insert_
backoff_ gate_ tx - Compiler pass - pair every
wire::Sendop with an upstreamBackoffGateTxsyscall. The gate consults [crate::framework::BackoffTable] and drops sends to peers currently in cooldown. - insert_
dedup_ gate_ rx - Compiler pass - pair every synthesized
wire::Recvop with a downstreamDedupGateRx. First in the RX gate chain (cheap drops for replays). - insert_
peer_ health_ gate_ rx - Compiler pass - pair every synthesized
wire::Recvop with a downstreamPeerHealthGateRx. Runs afterinsert_dedup_gate_rxso the RX chain order isRecv → DedupGateRx → PeerHealthGateRx. - insert_
peer_ health_ gate_ tx - Compiler pass - pair every
wire::Sendop with an upstreamPeerHealthGateTxsyscall. The gate consults [crate::framework::PeerGovernor] before the Send fires; blocked / cooldowned peers fail the send through the existingOpFailedpath without the Send queueing an envelope. - partition_
by_ wire_ ops - Slice the recorded function into per-BB-Node sub-graphs by wire-op reachability.
- refine_
polymorphic_ value_ info refine_polymorphic_value_info— narrows the placeholderTYPE_TENSORdenotation stamped by the DSL recorder on every Contract-method NodeProto to each bound concrete’s actualStorage::TYPE.- resolve_
component_ dependencies resolve_component_dependenciespass.- resolve_
slots resolve_slots+ pre-flight. Final check before a ModelProto is emitted: rejects a Module where the same role domain hosts BOTH a concrete-type provider AND a generic(required_trait, slot_id)provider — that combination isAmbiguousRole.- runner
- Pipeline orchestrator. Runs canonical passes in order and emits
one
ModelProtoper partition;functions[0]is the partition main,functions[1..]are hoisted sub-Module bodies. Driven fromcrate::driver::Compiler::compile. - rx_
chain - RX-chain head bookkeeping shared by the RX gate-insertion passes.
- stamp_
compilation_ metadata stamp_compilation_metadata— the final pass that turns each per-partitionModelProtointo a complete artifact by writing the compilation passport + slot binding table intometadata_props. Install reads these stamps; the typedBindingSpecRust struct never crosses the compile boundary after this pass runs.- synthesize_
wire_ recvs synthesize_wire_recvs- synthesize awire.RecvNodeProto on each receiver partition for everywire.Send’s cross-partition data consumer.- type_
solver - Type-resolution pass — bipartite worklist solver following
TVM Relay’s
type_solver.hdesign, adapted to Rust. - validate
- Structural sanity check. Reject malformed input before any
other pass mutates it. Pure function over
GraphProto. - validate_
all_ slots_ bound validate_all_slots_bound— surfaces a typedCompileError::UnboundSlotwhen the compiler hasn’t been given enough information to construct every component the runtime needs. Walks the artifact’sBindingSpec+ IR + every bound concrete’sDEPENDENCIES.- validate_
bootstrap_ composition - Structural check for the bootstrap-as-function composition tree.
- validate_
runtime_ complete - Final structural completeness check.
- verify_
no_ dangling_ calls - Structural verifier: every entry in
model.functions[1..]must be reachable frommodel.functions[0]via the CALL chain. Errors when a CALL chases a function name absent frommodel.functions. Orphan entries (no CALL referencing them) are tolerated today; a later reachability-pruning pass may tighten this.