pub struct HashMapJudge { /* private fields */ }Expand description
HashMap-backed JudgeOracle. The simplest possible impl —
callers (and tests) populate it from a ProfileReport or
equivalent and hand it to super::cost::compute_static_costs.
Production callers typically use this directly: fuel_core’s
integration computes a HashMapJudge from the cached
ProfileReport once at plan-start and feeds the same instance
to every compile_plan call until the topology generation
changes.
Implementations§
Source§impl HashMapJudge
impl HashMapJudge
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty map. Add entries via Self::insert.
Sourcepub fn insert(
&mut self,
op: OpKind,
dtype: DType,
size_class: SizeClass,
backend: BackendId,
kernel_source: &str,
latency_ns: u64,
kernel_revision_hash: u64,
)
pub fn insert( &mut self, op: OpKind, dtype: DType, size_class: SizeClass, backend: BackendId, kernel_source: &str, latency_ns: u64, kernel_revision_hash: u64, )
Insert one measured latency. Replaces any prior entry with
the same key (last-write-wins, mirroring the conventions in
fuel_tensor::judge::DispatchTable::rebuild_from).
kernel_source distinguishes sibling kernels at the same
(backend, device) slot — see JudgeOracle::measured_latency_ns.
The owned String is stored as part of the key; pass ""
for legacy single-impl cells.
kernel_revision_hash is last in the parameter list (after the
latency_ns value) deliberately: the key tuple’s canonical order
keeps it beside kernel_source, but placing it last here lets the
many existing call sites append the argument rather than splice it
mid-call. 0 is the untracked / single-impl default.
Trait Implementations§
Source§impl Clone for HashMapJudge
impl Clone for HashMapJudge
Source§impl Debug for HashMapJudge
impl Debug for HashMapJudge
Source§impl Default for HashMapJudge
impl Default for HashMapJudge
Source§impl JudgeOracle for HashMapJudge
impl JudgeOracle for HashMapJudge
Source§fn measured_latency_ns(
&self,
op: OpKind,
dtype: DType,
size_class: SizeClass,
backend: BackendId,
kernel_source: &str,
kernel_revision_hash: u64,
) -> Option<u64>
fn measured_latency_ns( &self, op: OpKind, dtype: DType, size_class: SizeClass, backend: BackendId, kernel_source: &str, kernel_revision_hash: u64, ) -> Option<u64>
(op, dtype, size_class, backend, kernel_source, kernel_revision_hash) cell. Returns None when the cell isn’t
profiled. Callers MUST treat absence as “no measurement” — not
“zero” — so the static estimate stays the fallback. Read moreAuto Trait Implementations§
impl Freeze for HashMapJudge
impl RefUnwindSafe for HashMapJudge
impl Send for HashMapJudge
impl Sync for HashMapJudge
impl Unpin for HashMapJudge
impl UnsafeUnpin for HashMapJudge
impl UnwindSafe for HashMapJudge
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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