Skip to main content

Crate bb_ir

Crate bb_ir 

Source
Expand description

Foundation IR crate. Hosts prost-generated ONNX + bb.core bindings and the cross-crate types every other crate depends on:

  • idsPeerId, NodeSiteId, OpRef, ComponentRef, ExecId, CommandId, RequestId.
  • wireTypeNode denotations + canonical statics.
  • tensorScalar, Tensor traits + Dense<T> storage.
  • slot_value — universal SlotValue trait.
  • atomicAtomicOpsetDecl, AtomicOpDecl, AtomicOpKind.

Re-exports§

pub use tensor_primitives::opset_covers_primitives;
pub use tensor_primitives::MissingPrimitives;
pub use tensor_primitives::TENSOR_PRIMITIVES_DOMAIN;
pub use tensor_primitives::TENSOR_PRIMITIVES_OPS;
pub use tensor_primitives::TENSOR_PRIMITIVES_VERSION;
pub use inventory;
pub use bincode;

Modules§

atomic
Atomic-op opset declaration types. Returned from <Role>Runtime::atomic_opset(); engine-side DispatchResult lives in bb_runtime::atomic because it carries CommandId.
component
Foundation polymorphism plumbing shared by bb-dsl (authoring) and bb-runtime (dispatch).
ids
Wire-format and compiler-bound identifier types.
keys
Single source of truth for metadata-key string constants shared across DSL → Compiler → Runtime. Reference these constants rather than re-typing "ai.bytesandbrains.*" literals.
peer_class
Peer-class metadata for partitioning by “what kind of Node does this op run on.” PEER_CLASS_KEY tags Output<PeerId> producers; HOME_CLASS_KEY tags each NodeProto with the class of Node it runs on (stamped by infer_peer_classes).
proto
Prost-generated proto bindings.
registry
Concrete-component inventory registry. Derive macros submit per-type entries; the linker preserves them if the type is referenced. Custom-op registry lives in bb_runtime::registry.
slot_value
Universal slot value trait. The blanket impl is the only path, so anything Any + Send + Sync + Clone + Serialize + DeserializeOwned is a SlotValue by construction. Type identity per slot rides on ValueInfoProto.type_node; consumers downcast to the graph-guaranteed concrete type.
syscall_ids
Syscall identifier string constants — the IR-level contract between compiler (gate emission) and runtime (dispatch).
tensor
Tensor + Scalar abstractions. The framework crate ships no concrete tensor type; backends implement these traits over their own storage of choice.
tensor_primitives
The framework’s curated floor of primitive tensor ops.
types
Hierarchical type system resolved at compile time by the compiler’s TypeSolver. The tree is open via inventory: backends and DSL authors register new leaves via inventory::submit!. The Lattice is built once at startup; is_subtype_of walks the parent chain with caching. The runtime never sees abstract types.
verify
IR well-formedness checkers run between compiler passes. Each function is a pure check returning Result<(), VerifyError>; the compiler invokes them at the per-pass seams described in docs/COMPILER.md.
version
Framework-wide version constants.
wire
Wire codec hash helper.
wire_shape
Canonical Send / Recv NodeProto shape — the contract every wire-IR-touching pass + runtime gate agrees on.

Macros§

register_charged_bytes
Register a carrier’s wire-byte resolver.
register_type_node
Register a concrete type’s lattice TypeNode + wire decoder. Emits both a RuntimeTypeBinding and a WireDecoderBinding. Unregistered types resolve to crate::types::TYPE_ANY and their wire payloads cannot be decoded.