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§
- Cache
Stats - Observable kernel-cache statistics (§11.1) — enough to prove reuse in tests.
- Capture
Decline - One actionable reason a device-graph capture attempt was rejected.
- Capture
Decline Report - Structured reasons a device graph could not be captured.
- Compiled
Partition - One compiled partition the session hands to the EPContext writer (§55.4).
- Control
Flow Stats - Observable control-flow executor statistics. These counters make subgraph reuse deterministic to test without relying on timing.
- Device
Allocation Counts - Device
Binding Transfer Stats - Debug counters for host traffic explicitly requested through a persistent device binding.
- Device
IoBinding - An externally owned persistent device allocation bound to a graph input and optionally aliased by a graph output.
- Encoder
Model - An IR
Graphbundled with the model-level metadata and live weight bytes needed to encode a complete ONNXModelProto. - EpContext
Dump Config - Configuration for the EPContext dump path (§55.4).
- EpContext
Partition - One EP-compiled partition to serialise into an
EPContextnode (§55.4). - EpContext
Placement - Outcome of the EPContext consume pass over a graph (§55.3).
- Execution
Provider Decline - One node-level reason the requested execution provider declined placement.
- Execution
Provider Fallback Report - Structured report for an accelerator request that executes on CPU.
- Inference
Session - A loaded model ready to run inference (§20.2).
- IoMeta
- Metadata describing a model input or output (§20.2).
- Model
Metadata - Model-level metadata that the IR
Graphdoes not itself carry. - Session
Builder - Builder for advanced session configuration (§20.6).
- Tensor
- An owned, host-resident, device-aware tensor (§5, §20.2).
- Warmup
Shape - A shape to pre-compile kernels for at session init (§11.3).
Enums§
- Capture
Path Kind - Structural execution path used by a node during a captured run.
- Decode
Precision - Decoder-wide numeric precision for the session’s decode graph.
- Device
Graph Capture Result - Device
Preference - Intent-based device preference (§20.4). The runtime maps this to concrete
EPs during
build. - Opset
Version - Operator-set version associated with an operator dispatch failure.
- Optimization
Level - Graph-optimization level for the session’s
optimizepipeline stage (docs/ORT2.md§18). Selected via the generic"optimization"session option (seeSessionBuilder::option). - Seam
Reason - Structural reason a node forms an eager seam during device-graph capture.
- Session
Error - Errors produced by the session layer.
- Session
Output - A graph output produced by the runtime.
Functions§
- cpu_
allocator - The shared CPU execution provider as an
ExecutionProvidertrait object. - dump_
session_ ep_ context - Drive the §55.4 dump path: serialise
modelto a*_ctx.onnxcontext-cache model, replacing each compiledpartition’s subgraph with a singlecom.microsoft::EPContextnode. - load
- Load a model. Auto-detects the best available hardware (§20.2).
- load_
ep_ context_ nodes - Consume every
com.microsoft::EPContextnode ingraph(§55.3). - print_
exec_ phase_ profile - Public re-export so the bench/profile harness can dump the phase table.