pub struct DerivedWeights { /* private fields */ }Expand description
2026-09-25: Per-model memo of derived weight encodings, one map per
Derivation.
Implementations§
Source§impl DerivedWeights
impl DerivedWeights
pub fn new() -> Self
Sourcepub fn get_ptr(&self, kind: Derivation, key: u64) -> Option<u64>
pub fn get_ptr(&self, kind: Derivation, key: u64) -> Option<u64>
2026-09-25: Memo read for a single-pointer derivation, for callers that
allocate and launch between the lookup and Self::insert_ptr. A
pair-valued kind returns None.
pub fn insert_ptr(&self, kind: Derivation, key: u64, value: u64)
pub fn get_pair(&self, kind: Derivation, key: u64) -> Option<(u64, u64)>
pub fn insert_pair(&self, kind: Derivation, key: u64, value: (u64, u64))
Sourcepub fn get_or_build_ptr(
&self,
kind: Derivation,
key: u64,
build: impl FnOnce() -> Result<u64>,
) -> Result<u64>
pub fn get_or_build_ptr( &self, kind: Derivation, key: u64, build: impl FnOnce() -> Result<u64>, ) -> Result<u64>
2026-09-25: Look up a single-pointer derivation, building it on a miss. A failed build stores nothing.
build runs outside the lock. If two threads race on one key, both
build, the first stored value is kept and returned to both, and the
loser’s value is not freed.
Sourcepub fn get_or_build_pair(
&self,
kind: Derivation,
key: u64,
build: impl FnOnce() -> Result<(u64, u64)>,
) -> Result<(u64, u64)>
pub fn get_or_build_pair( &self, kind: Derivation, key: u64, build: impl FnOnce() -> Result<(u64, u64)>, ) -> Result<(u64, u64)>
2026-09-25: Self::get_or_build_ptr for a pair-valued derivation.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Debug for DerivedWeights
impl Debug for DerivedWeights
Source§impl Default for DerivedWeights
impl Default for DerivedWeights
Source§fn default() -> DerivedWeights
fn default() -> DerivedWeights
Source§impl ModelResource<dyn GpuBackend> for DerivedWeights
2026-09-25: Release every derived allocation.
impl ModelResource<dyn GpuBackend> for DerivedWeights
2026-09-25: Release every derived allocation.
The keys are the source weights’ pointers, which the weight store owns and frees; only the values are freed here. Every free is attempted, and the first error is returned.