Skip to main content

Optimizer

Trait Optimizer 

Source
pub trait Optimizer: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn prune(
        &self,
        graph: &mut Graph,
        ctx: &OptimizationContext<'_>,
    ) -> Result<()>;
}
Expand description

An optimizer MERGEs / DISCARDs paths. The PR-B2 per-device Pareto frontier is applied per-node inside compile_plan; the registered FrontierConvergenceOptimizer is its in-graph counterpart that runs after each pathfinder to collapse duplicate (forward-identical) arms and enforce the optimizer invariants.

prune runs after each Pathfinder::propose (lock-step), so the working set never explodes-then-extracts. It must honor the optimizer invariants: never strand the last (device, backend) path, and never mutate a node in ctx.cycle_guard.

Required Methods§

Source

fn name(&self) -> &'static str

Stable, human-readable name. Shows up in debug traces.

Source

fn prune(&self, graph: &mut Graph, ctx: &OptimizationContext<'_>) -> Result<()>

Merge/discard candidate paths in graph. Runs after each pathfinder over the region that pathfinder just touched.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§