Skip to main content

OptimizationPass

Trait OptimizationPass 

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

    // Provided method
    fn postconditions(&self, graph: &Graph) -> Result<()> { ... }
}
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<()>

Apply the rewrite in place.

Provided Methods§

Source

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

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§