Skip to main content

Crate onnx_runtime_session

Crate onnx_runtime_session 

Source
Expand description

§onnx-runtime-session

The user-facing session and inference API for the ORT 2.0 runtime (see docs/ORT2.md §20). Design goal: zero-config by default — the user never has to know what an execution provider is; the runtime auto-detects hardware and picks a strategy.

Phase 1 skeleton: the intent-based SessionBuilder and InferenceSession surfaces are defined; build/run bodies are todo!() pending the sequential executor (Phase 1 task ort2-session).

let mut session = onnx_runtime_session::load("model.onnx")?;
let outputs = session.run(&[("input_ids", &tensor)])?;

Modules§

sequence
ONNX sequence values and zero-copy split views.

Structs§

CacheStats
Observable kernel-cache statistics (§11.1) — enough to prove reuse in tests.
CaptureDecline
One actionable reason a device-graph capture attempt was rejected.
CaptureDeclineReport
Structured reasons a device graph could not be captured.
CompiledPartition
One compiled partition the session hands to the EPContext writer (§55.4).
ControlFlowStats
Observable control-flow executor statistics. These counters make subgraph reuse deterministic to test without relying on timing.
DeviceAllocationCounts
DeviceBindingTransferStats
Debug counters for host traffic explicitly requested through a persistent device binding.
DeviceIoBinding
An externally owned persistent device allocation bound to a graph input and optionally aliased by a graph output.
EncoderModel
An IR Graph bundled with the model-level metadata and live weight bytes needed to encode a complete ONNX ModelProto.
EpContextDumpConfig
Configuration for the EPContext dump path (§55.4).
EpContextPartition
One EP-compiled partition to serialise into an EPContext node (§55.4).
EpContextPlacement
Outcome of the EPContext consume pass over a graph (§55.3).
ExecutionProviderDecline
One node-level reason the requested execution provider declined placement.
ExecutionProviderFallbackReport
Structured report for an accelerator request that executes on CPU.
InferenceSession
A loaded model ready to run inference (§20.2).
IoMeta
Metadata describing a model input or output (§20.2).
ModelMetadata
Model-level metadata that the IR Graph does not itself carry.
SessionBuilder
Builder for advanced session configuration (§20.6).
Tensor
An owned, host-resident, device-aware tensor (§5, §20.2).
WarmupShape
A shape to pre-compile kernels for at session init (§11.3).

Enums§

CapturePathKind
Structural execution path used by a node during a captured run.
DecodePrecision
Decoder-wide numeric precision for the session’s decode graph.
DeviceGraphCaptureResult
DevicePreference
Intent-based device preference (§20.4). The runtime maps this to concrete EPs during build.
OpsetVersion
Operator-set version associated with an operator dispatch failure.
OptimizationLevel
Graph-optimization level for the session’s optimize pipeline stage (docs/ORT2.md §18). Selected via the generic "optimization" session option (see SessionBuilder::option).
SeamReason
Structural reason a node forms an eager seam during device-graph capture.
SessionError
Errors produced by the session layer.
SessionOutput
A graph output produced by the runtime.

Functions§

cpu_allocator
The shared CPU execution provider as an ExecutionProvider trait object.
dump_session_ep_context
Drive the §55.4 dump path: serialise model to a *_ctx.onnx context-cache model, replacing each compiled partition’s subgraph with a single com.microsoft::EPContext node.
load
Load a model. Auto-detects the best available hardware (§20.2).
load_ep_context_nodes
Consume every com.microsoft::EPContext node in graph (§55.3).
print_exec_phase_profile
Public re-export so the bench/profile harness can dump the phase table.