pub struct PassRegistry { /* private fields */ }Expand description
A registry of Pathfinders and Optimizers, driven lock-step by
Self::run_lockstep. Mirrors fuel_graph::opt::RuleRegistry: a
Vec<Box<dyn …>> of passes built up with with_* builders and run
through one driver method. Keeping the same shape means the future
passes the constitution names (fusion, algebraic, dtype-lowering)
register exactly as the two shipped passes do.
Implementations§
Source§impl PassRegistry
impl PassRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty registry. Use Self::with_pathfinder /
Self::with_optimizer to add passes, or Self::default_passes
for the shipped configuration.
Sourcepub fn with_pathfinder(self, p: Box<dyn Pathfinder>) -> Self
pub fn with_pathfinder(self, p: Box<dyn Pathfinder>) -> Self
Append a pathfinder. Returns self for builder-style chaining.
Sourcepub fn with_optimizer(self, o: Box<dyn Optimizer>) -> Self
pub fn with_optimizer(self, o: Box<dyn Optimizer>) -> Self
Append an optimizer. Returns self for builder-style chaining.
Sourcepub fn default_passes() -> Self
pub fn default_passes() -> Self
The shipped Phase-B configuration: the PR-A4
PlacementForkPathfinder (the one pathfinder that records an
Op::Branch per genuine multi-placement fork) and the
FrontierConvergenceOptimizer (duplicate-path convergence +
the per-device-frontier invariant guards). This is exactly the
pre-B3 hardcoded sequence re-expressed as registered passes.
Sourcepub fn default_passes_with_runtime_fusion() -> Self
pub fn default_passes_with_runtime_fusion() -> Self
Self::default_passes plus runtime fusion: the
crate::runtime_fused_pathfinder::RuntimeFusedArmPathfinder runs
FIRST (before placement — placement must see the fused arms it emits;
the fork seed can’t double-fork them because ctx.plan/ctx.order
predate the drive and don’t contain the appended arm nodes).
A separate constructor rather than a change to default_passes so the
bare registry never scans the process-global runtime-fused sidecar —
non-adopting tests stay hermetic by construction, not by reset
discipline (dd-shapes coordination, 2026-07-08). Transitional, like the
sidecar itself: both collapse when runtime entries fold into the one
binding registry (10-decisions-log, runtime-fused-sidecar entry).
Sourcepub fn pathfinder_count(&self) -> usize
pub fn pathfinder_count(&self) -> usize
Number of registered pathfinders.
Sourcepub fn optimizer_count(&self) -> usize
pub fn optimizer_count(&self) -> usize
Number of registered optimizers.
Sourcepub fn run_lockstep(
&self,
graph: &mut Graph,
ctx: &OptimizationContext<'_>,
) -> Result<()>
pub fn run_lockstep( &self, graph: &mut Graph, ctx: &OptimizationContext<'_>, ) -> Result<()>
Drive the passes lock-step / prune-as-you-go: for each registered pathfinder, ADD its candidate paths, then immediately run every registered optimizer to MERGE/DISCARD over the region that pathfinder just touched, before moving to the next pathfinder.
This is the constitution’s bound: the merge/discard optimizers run after each pathfinder step, not once at the end, so the working set never explodes-then-extracts. Ordering is enforced by construction — an optimizer can only ever see the paths the pathfinders before it in this drive added.
Returns Result; the first failing pass aborts the drive
(build-time validation, never a panic).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PassRegistry
impl !UnwindSafe for PassRegistry
impl Forget for PassRegistry
impl Freeze for PassRegistrywhere
*const u8 is !null: Freeze,
PhantomData<Box<dyn Pathfinder>>: Freeze,
PhantomData<Box<dyn Optimizer>>: Freeze,
impl Move for PassRegistry
impl Send for PassRegistry
impl Sync for PassRegistry
impl Unpin for PassRegistry
impl UnsafeUnpin for PassRegistrywhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Box<dyn Pathfinder>>: UnsafeUnpin,
PhantomData<Box<dyn Optimizer>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more