pub struct CostVector {
pub time: u64,
pub memory: MemoryTiers,
pub precision: PrecisionDigits,
pub accuracy: AccuracyClass,
}Expand description
The per-path cost vector the rankers produce. Pareto dominance (the per-device frontier in PR-B2) is over this whole vector; ties break precision → accuracy → memory (decisions-log #7).
Orientation: lower time, lower memory, higher precision,
higher accuracy is better.
Fields§
§time: u64ONE central wall-clock metric (ns). For B1: the old scalar
composite_ns(static_cost) + inbound_transfer_ns. Lower is
better. t_min is deliberately not an axis.
memory: MemoryTiersPer-tier memory footprint. Lower is better, per tier.
precision: PrecisionDigitsNumerical precision in decimal digits. Higher is better.
accuracy: AccuracyClassAccuracy descriptor (ULP / rounding / monotonicity). Higher is better.
Implementations§
Source§impl CostVector
impl CostVector
Sourcepub fn from_candidate(candidate: &Candidate) -> Self
pub fn from_candidate(candidate: &Candidate) -> Self
Build a cost vector from a candidate.
time=composite_ns(&static_cost) + inbound_transfer_ns(saturating) — the exact B1 scalar.memory= the candidate’sstatic_cost.bytes_movedattributed to the placement tier ofcandidate.device.precision/accuracyare derived fromcandidate.precision.
Sourcepub fn dominates(&self, other: &CostVector) -> bool
pub fn dominates(&self, other: &CostVector) -> bool
Pareto dominance over the whole vector.
Returns true iff self is no worse than other on every
axis AND strictly better on at least one — the standard
Pareto relation. Per the documented orientation: lower time,
lower memory (per tier), higher precision, higher accuracy
is better.
This is the relation PR-B2’s per-device Pareto frontier will
filter on. It is intentionally not what selects the winner —
the winner stays time-first (see
super::alternative_set::AlternativeSet::rank_by_cost) so
realize behavior is preserved.
Sourcepub fn total_order_key(&self) -> (u64, u16, u8, u64)
pub fn total_order_key(&self) -> (u64, u16, u8, u64)
Total-order key that keeps the winner time-first: the
lowest-time candidate wins (preserving the old composite_ns
winner), with ties broken precision → accuracy → memory
(the constitution’s order). Memory ties break on total bytes
(host + VRAM, saturating), lower first.
Precision and accuracy are oriented “higher is better,” so the
key negates them (via Reverse-style inversion) to sort
descending while time and memory sort ascending.
Winner vs frontier: the winner (index 0 / arm-0) uses THIS
time-first order for realize-behavior preservation; the
frontier retention (PR-B2) will use Self::dominates.
Trait Implementations§
Source§impl Clone for CostVector
impl Clone for CostVector
impl Copy for CostVector
Source§impl Debug for CostVector
impl Debug for CostVector
impl Eq for CostVector
Source§impl PartialEq for CostVector
impl PartialEq for CostVector
impl StructuralPartialEq for CostVector
Auto Trait Implementations§
impl Freeze for CostVector
impl RefUnwindSafe for CostVector
impl Send for CostVector
impl Sync for CostVector
impl Unpin for CostVector
impl UnsafeUnpin for CostVector
impl UnwindSafe for CostVector
Blanket Implementations§
impl<T> Boilerplate for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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