pub struct FrontierConvergenceOptimizer;Expand description
The PR-B2 per-device-frontier optimizer, re-expressed as a registered
Optimizer. It runs after each pathfinder (lock-step) and is
the in-graph MERGE/DISCARD counterpart of
AlternativeSet::retain_per_device_frontier, which is
applied per kernel-bearing node inside
compile_plan.
Its two responsibilities:
-
Duplicate-path convergence (the trivial MERGE optimizer). Detect any two arms of a just-emitted
Op::Branchthat are forward-identical — same op, same inputs, same target backend. Two pathfinders (or one pathfinder firing twice) could in principle propose structurally-identical routes; the constitution requires “convergence merges only forward-identical paths”. The PR-A4 seed proposes one runner-up per fork, distinct from arm-0 by construction (differenttarget_backend), so today no duplicate arm ever arises and this detection is a no-op — it is the trivial second optimizer the spec calls for, in place (with a debug assertion that it stays a no-op) so the contract is documented and enforced before a future multi-runner-up pathfinder can leak a duplicate arm into a branch. -
Invariant guard (the never-strand / no-active-cycle contract). Assert that every
Op::Branchkeeps ≥1 viable(device, backend)route — never strand the last path (upheld by the per-node frontier insidecompile_plan, re-asserted here over the in-graph form) — and that no branch the optimizer would touch is inctx.cycle_guard(the incremental-reopt contract — batch optimize has an empty guard, but the guard documents and enforces the rule for the Phase-C runtime).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FrontierConvergenceOptimizer
impl RefUnwindSafe for FrontierConvergenceOptimizer
impl Send for FrontierConvergenceOptimizer
impl Sync for FrontierConvergenceOptimizer
impl Unpin for FrontierConvergenceOptimizer
impl UnsafeUnpin for FrontierConvergenceOptimizer
impl UnwindSafe for FrontierConvergenceOptimizer
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