Executor & Content-Addressed Execution
hologram-exec runs a compiled .holo archive. Execution is synchronous
— there is no async API and no streaming. The runtime is no_std + alloc by
default so inference runs in wasm and on embedded targets; the std feature
adds host-only amenities.
Execution Model
Section titled “Execution Model”Execution rides on one content-addressed buffer pool (BufferArena). A
value lives in exactly one 64-byte-aligned buffer; a slot binds to that
buffer rather than copying it — so the runtime is zero-movement. Buffers fall
into two classes:
- pinned — model constants/weights, deduped by content κ-label, resident for the session
- transient — boundary inputs, intermediates, and outputs, held in a byte-bounded two-generation pool
Every value carries a UOR-ADDR κ-label (71 bytes). A computed value’s label is
derived by ordered composition of its operands’ labels — cost O(operands),
independent of tensor size. Because the kernels are deterministic, an identical
derivation always yields identical content, so:
- A whole-graph re-execution whose input ports content-address to a key already in the graph memo returns the cached output addresses without walking the graph — O(1) in graph size.
- A shared sub-graph (common prefix / CSE within one run) is recognized and its kernel dispatch is elided.
Warm-start (WarmStore) pins the constant-only cone’s materialized results so
the runtime cache is never cold.
InferenceSession<B>— the loaded model;B: SessionBackendBufferArena— the content-addressed buffer pool (implements the backend’sWorkspace)InputBuffer<'a>—{ bytes: &'a [u8] }, a borrowed input tensorOutputBuffer—{ bytes: Vec<u8> }, an owned output tensorRefinementPlan— pass budget, validators, and repair policyRefinementStateContract— explicit state port contract for planner-generated plansRefinementRunner<'a, B>— a borrowed runner over an existing sessionCompiledRefinement<B>— owning convenience wrapper for a session and planValidatorKind— built-in pass-boundary validators such asStableLabelsandStableBytesRepairPolicy— bounded repair behaviorRefinementReport— final status, pass counts, labels, counters, and resident-memory dataWarmStore/MemWarmStore/FileWarmStore(the last requiresstd)ExecError— the runtime’s error type
Loading & executing
Section titled “Loading & executing”use hologram_exec::{InferenceSession, BufferArena, InputBuffer};use hologram_backend::CpuBackend;
let backend: CpuBackend<BufferArena> = CpuBackend::new();let mut session = InferenceSession::load(&archive, backend)?;
let outputs = session.execute(&[InputBuffer { bytes: &input_bytes }])?;let result: &[u8] = &outputs[0].bytes;Refinement execution
Section titled “Refinement execution”Refinement is a bounded execution strategy around execute_addressed, not a
graph op or backend kernel. The session’s input and output state ports must
match in arity, dtype, shape, element count, and byte length so each pass output
can become the next pass input.
Planner-generated plans can attach a RefinementStateContract; otherwise the
runtime derives the contract from the session ports.
use hologram_exec::{ InputBuffer, RefinementPlan, RepairPolicy, ValidatorKind,};
let plan = RefinementPlan::builder(2) .validator(ValidatorKind::StableBytes) .repair_policy(RepairPolicy::RetryPass { extra_passes: 1 }) .build()?;
let report = plan.execute( &mut session, &[InputBuffer { bytes: &state_bytes }],)?;StableLabels is O(number of state ports). StableBytes compares resolved
arena slices without copying tensors, but it scans logical state bytes.
Accessors
Section titled “Accessors”| Method | Returns |
|---|---|
input_count() | declared input ports |
output_count() | declared output ports |
kernel_count() | kernel calls in the loaded archive |
resident_bytes() | bytes currently resident in the pool |
resident_count() | resident buffers in the pool |
content_store_len() | distinct content-addressed entries |
Feature Gates
Section titled “Feature Gates”| Feature | Effect |
|---|---|
std | Host-only amenities, including FileWarmStore |
parallel | Forwards to the backend’s intra-kernel parallelism (one dispatch uses every core) |
tiered-exec | PM_7 memory-tier coherence types |