pub struct OptimizationContext<'a> {
pub order: &'a [NodeId],
pub plan: &'a ExecutionPlan,
pub cycle_guard: &'a HashSet<NodeId>,
pub bindings: &'a KernelBindingTable,
}Expand description
Read-only context threaded to every Pathfinder::propose and
Optimizer::prune call during a PassRegistry::run_lockstep
drive.
It carries the measure stage’s output — the ranked, per-device
frontier-pruned per-node AlternativeSets compile_plan produced
(Self::plan) plus the dispatch Self::order — and the
incremental-reopt guard (Self::cycle_guard): the set of nodes
that lie on an active cycle or in a currently-executing region and so
must never be mutated by an optimizer. Batch optimize_graph has no
executing region, so the guard is empty there; it exists to document
and enforce the incremental-reopt contract for the Phase-C runtime.
Fields§
§order: &'a [NodeId]The dispatch order compile_plan
was driven over — data-flow topo refined by destructive-op
ordering edges.
plan: &'a ExecutionPlanThe per-node ranked + frontier-pruned AlternativeSets (the
measure + per-node prune output). Pathfinders read the
winner + runner-up placements off this; optimizers read it to
honor the never-strand-last invariant.
cycle_guard: &'a HashSet<NodeId>Nodes on an active cycle / currently-executing region — an
optimizer must not mutate any node in this set. Empty for batch
optimize_graph.
bindings: &'a KernelBindingTableThe kernel binding table optimize_graph was handed by its caller —
the SAME table compile_plan resolved placements against. Pathfinders
that need a capability-gate answer (e.g. “is a kernel bound for this
runtime-fused op on this backend?”) read THIS reference rather than
re-acquiring crate::dispatch::global_bindings(), so a background
adopt’s write can never nest against a pathfinder’s read on the same
lock (Spec B Task 1 — see
crate::runtime_fused_kernels::fused_kernel_available_in).
Implementations§
Source§impl<'a> OptimizationContext<'a>
impl<'a> OptimizationContext<'a>
Sourcepub fn bindings(&self) -> &KernelBindingTable
pub fn bindings(&self) -> &KernelBindingTable
The threaded binding table (see Self::bindings).
Auto Trait Implementations§
impl<'a> Freeze for OptimizationContext<'a>
impl<'a> RefUnwindSafe for OptimizationContext<'a>
impl<'a> Send for OptimizationContext<'a>
impl<'a> Sync for OptimizationContext<'a>
impl<'a> Unpin for OptimizationContext<'a>
impl<'a> UnsafeUnpin for OptimizationContext<'a>
impl<'a> UnwindSafe for OptimizationContext<'a>
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