Skip to main content

Crate limen_core

Crate limen_core 

Source
Expand description

§limen-core

Limen Core defines the stable contracts and primitives for the Limen graph-driven, edge inference runtime targeting embedded and resource-constrained systems.

§Design principles

  • no_std by default. All code compiles without std. Heap use is gated behind #[cfg(feature = "alloc")]; concurrent primitives behind std.
  • No dynamic dispatch in hot paths. Node, edge, memory manager, and scheduler types are monomorphized via generics and const generics.
  • Token-based message passing. Edges carry types::MessageToken handles rather than full messages. Message data (header + payload) lives in a memory::manager::MemoryManager, addressed by token. This enables zero-copy routing and heterogeneous memory classes (host, pinned, device).
  • Stable contracts. The traits defined here are the versioned boundary between application code and the runtime. Higher-level crates (limen-runtime, limen-codegen, limen-node) depend on this crate and can evolve independently without breaking the contract surface.

§Module overview

ModuleWhat it provides
typesNewtypes for IDs, timing, QoS, MessageToken, DataType/DType, F16/BF16
errorsError families for queues, nodes, inference, graph, runtime
memoryMemoryClass, PlacementAcceptance, BufferDescriptor; memory manager traits and impls
messageMessageHeader, MessageFlags, Message<P>; Payload trait; Tensor; Batch
policyBatching, budget, deadline, admission, and per-edge/node policy types
computeComputeBackend / ComputeModel traits for dyn-free inference backends
edgeEdge SPSC trait; EnqueueResult, EdgeOccupancy; queue implementations
nodeNode trait; StepContext, StepResult, ProcessResult; source/sink/model sub-traits
graphGraphApi, ScopedGraphApi; compile-time node/edge access traits; descriptor validation
schedulingReadiness, NodeSummary, DequeuePolicy; WorkerScheduler for concurrent execution
telemetryTelemetry trait; TelemetryEvent; NodeMetrics, EdgeMetrics, GraphMetrics
platformPlatformClock, Span, Timers, Affinity; NoopClock
runtimeLimenRuntime trait; RuntimeStopHandle
preludeConvenience re-exports for all of the above, feature-gated

§Feature flags

FlagEffect
(default)no_std, no heap; fixed-size SPSC queues (SpscArrayQueue)
allocHeapMemoryManager, SpscVecDeque, owned BatchView
stdimplies alloc; ConcurrentMemoryManager, ConcurrentEdge, ScopedEdge, ScopedGraphApi, concurrent telemetry
spsc_rawunsafe lock-free ring buffer (SpscRawQueue); requires std
benchexposes test nodes, edges, graphs, and runtimes for integration tests
checked-memory-manager-refsadds per-slot borrow-state tracking to StaticMemoryManager and HeapMemoryManager

Modules§

compute
Compute backend and model traits (dyn-free, explicit; no defaults).
edge
SPSC edge trait, occupancy types, and queue implementations.
errors
Error families used across Limen Core.
graph
Graph trait hierarchy and typed graph contracts.
memory
Memory classes, placement policy, and token-backed message storage.
message
Message header, flags, and typed message wrapper.
node
Uniform node contract, lifecycle, and step context.
platform
Platform abstractions.
policy
Policies for batching, budgets, deadlines, admission, and capacities.
prelude
Convenience re-exports for crate consumers and codegen output.
runtime
Runtime trait and stop-handle for Limen graph executors.
scheduling
Scheduling traits: readiness and dequeue policy (EDF hooks).
telemetry
Telemetry primitives for Limen runtimes.
types
Small shared value types and identifiers used across limen-core.

Macros§

event_message
Constructs an EventMessage with guaranteed compile-time validation.
run_edge_contract_tests
Define a set of contract tests for an Edge implementer.
run_node_contract_tests
Expand a canonical suite of node contract tests for a NodeLink factory.