pub struct Compiler { /* private fields */ }Expand description
The single compile entry point.
Implementations§
Source§impl Compiler
impl Compiler
Sourcepub fn new() -> Self
pub fn new() -> Self
Fresh compiler.
let artifact = bb::Compiler::new()
.bind_backend::<CpuBackend>("compute")
.bind_index::<HnswIndex>("primary_index")
.compile(module)?;Sourcepub fn with_target_version(self, version: u32) -> Self
pub fn with_target_version(self, version: u32) -> Self
Override the IR contract version. Mismatch with the input
model’s FRAMEWORK_IR_VERSION stamp raises
CompileError::IrVersionMismatch.
Sourcepub fn with_per_hop_budget_ns(self, budget_ns: u64) -> Self
pub fn with_per_hop_budget_ns(self, budget_ns: u64) -> Self
Override the per-hop budget in nanoseconds used by
derive_wire_deadlines when stamping static deadlines on
wire ops.
Sourcepub fn with_permissive_types(self) -> Self
pub fn with_permissive_types(self) -> Self
Permissive type-solver mode for hand-authored NodeProtos.
Unresolved values pass through as TYPE_ANY.
Sourcepub fn without_stage(self, name: &str) -> Self
pub fn without_stage(self, name: &str) -> Self
Disable a canonical pass by name. No-op for non-canonical.
Sourcepub fn push_front_stage<S: CompilerStage + 'static>(self, stage: S) -> Self
pub fn push_front_stage<S: CompilerStage + 'static>(self, stage: S) -> Self
Insert a stage at the front of the user-stage list.
Sourcepub fn push_back_stage<S: CompilerStage + 'static>(self, stage: S) -> Self
pub fn push_back_stage<S: CompilerStage + 'static>(self, stage: S) -> Self
Insert a stage at the back of the user-stage list.
Sourcepub fn insert_stage<S: CompilerStage + 'static>(
self,
index: usize,
stage: S,
) -> Self
pub fn insert_stage<S: CompilerStage + 'static>( self, index: usize, stage: S, ) -> Self
Insert a stage at the supplied index. Index clamped to
[0, stages.len()].
Sourcepub fn bind_backend<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + BackendRuntime,
pub fn bind_backend<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + BackendRuntime,
Bind a Backend-role concrete at slot.
Sourcepub fn bind_index<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + IndexRuntime,
pub fn bind_index<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + IndexRuntime,
Bind an Index-role concrete at slot.
Sourcepub fn bind_model<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + ModelRuntime,
pub fn bind_model<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + ModelRuntime,
Bind a Model-role concrete at slot.
Sourcepub fn bind_aggregator<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + AggregatorRuntime,
pub fn bind_aggregator<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + AggregatorRuntime,
Bind an Aggregator-role concrete at slot.
Sourcepub fn bind_codec<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + CodecRuntime,
pub fn bind_codec<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + CodecRuntime,
Bind a Codec-role concrete at slot.
Sourcepub fn bind_data_source<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + DataSourceRuntime,
pub fn bind_data_source<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + DataSourceRuntime,
Bind a DataSource-role concrete at slot.
Sourcepub fn bind_peer_selector<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + PeerSelectorRuntime,
pub fn bind_peer_selector<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + PeerSelectorRuntime,
Bind a PeerSelector-role concrete at slot.
Sourcepub fn bind_protocol<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + ProtocolRuntime,
pub fn bind_protocol<T>(self, slot: impl Into<String>) -> Selfwhere
T: ConcreteComponent + ProtocolRuntime,
Bind a Protocol-role concrete at slot.
Sourcepub fn compile(self, model: ModelProto) -> Result<ModelProto, CompileError>
pub fn compile(self, model: ModelProto) -> Result<ModelProto, CompileError>
Run the canonical pipeline and emit one compiled ModelProto.
Output carries compiled passport,
binding.<target>.<slot> entries, and functions[]
(one partition root per target). See src/install.rs for
the install-side parse.
Sourcepub fn compile_partitions(
&self,
model: ModelProto,
) -> Result<Vec<ModelProto>, CompileError>
pub fn compile_partitions( &self, model: ModelProto, ) -> Result<Vec<ModelProto>, CompileError>
Inspection-only: pipeline output as Vec<ModelProto>
without binding validation or passport stamping. Tests only;
production paths use Self::compile.