Skip to main content

OptimizerPass

Trait OptimizerPass 

Source
pub trait OptimizerPass: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn run(
        &self,
        graph: &mut Graph,
        ctx: &PassContext,
    ) -> Result<(), OptimizerError>;

    // Provided method
    fn postconditions(&self, graph: &Graph) -> Result<(), OptimizerError> { ... }
}
Expand description

A single graph→graph rewrite (see docs/ORT2.md §18.1).

Passes mutate the Graph in place and must preserve its structural invariants; postconditions is checked after each pass in debug builds by run_passes.

Required Methods§

Source

fn name(&self) -> &str

A short, stable name for logging and error messages.

Source

fn run( &self, graph: &mut Graph, ctx: &PassContext, ) -> Result<(), OptimizerError>

Apply the rewrite in place.

Provided Methods§

Source

fn postconditions(&self, graph: &Graph) -> Result<(), OptimizerError>

Invariants that must hold after this pass. The default requires the graph to pass full structural validation (Graph::validate).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§