Skip to main content

Crate onnx_runtime_optimizer

Crate onnx_runtime_optimizer 

Source
Expand description

§onnx-runtime-optimizer

Device-independent graph→graph optimization passes for the ORT 2.0 runtime (see docs/ORT2.md §18 “Optimization Passes”). This is the first Phase-2 crate: pure, safe Rust graph rewriting over onnx_runtime_irno CUDA, no ORT C library, no FFI.

§What lives here

ConceptType
Pass contractOptimizationPass, PassContext, run_passes
Dead-code removalDeadNodeElimination
Bounded constant foldingConstantFolding
Operator fusionOpFusion, FusionPattern, PatternMatch
ErrorsOptimizerError, Result

§Pipeline

default_passes returns only the device-independent passes implemented here, in pipeline order: ConstantFolding → DeadNodeElimination → OpFusion.

§Deferred (Phase 2b / Phase 3)

The full pipeline in docs/ORT2.md §18.1 also lists passes that depend on crates or analyses not yet built. They are intentionally not implemented here and are listed in default_passes’s source in their eventual pipeline position: ShapeInference (the loader owns inference for now), AttentionFusionPass, LayoutPropagation, PlacementOptimizer, TransferInsertion, InPlaceDetection, MemoryPlanning, CudaGraphRegionDetection, and OverlapScheduling.

Structs§

ConstantFolding
Folds constant-input nodes into initializers (bounded, integer/shape only).
DeadNodeElimination
Removes nodes that do not contribute to any graph output.
FusionPattern
A fusion rule: an op-type sequence rewritten to a single replacement op.
OpFusion
The op-fusion pass: applies each FusionPattern to fixpoint.
PassContext
Shared, read-only context threaded through every pass.
PatternMatch
A matched occurrence of a FusionPattern in a graph.#[derive(Clone, Debug)]

Enums§

OptimizerError
Crate-level error for the optimization pipeline.

Constants§

CONTRIB_DOMAIN
The private contrib domain under which the optimizer emits every fused op.

Traits§

InitializerResolver
Resolves graph initializer descriptors to their backing bytes.
OptimizationPass
A single graph→graph rewrite (see docs/ORT2.md §18.1).

Functions§

default_fusion_patterns
The default device-independent fusion patterns.
default_passes
The device-independent Phase-1 pass pipeline, in run order.
run_passes
Run passes over graph in order.

Type Aliases§

Result
A convenience Result alias for optimizer operations.