pub struct MapId { /* private fields */ }Expand description
Identity of the memory mapping a repacked buffer was built from.
The repack caches below key on a weight’s address, and an address is only a stable identity for as long as the mapping that published it is alive. Unmap one file and map another and the kernel will hand the same address straight back – a textbook ABA. The cache then serves one matrix another matrix’s interleaved bytes, which panicked with an out-of-range slice when the two shapes differed and was SILENT, i.e. wrong output, when they matched.
Holding a std::sync::Weak is what closes it, and it closes both
halves at once:
- while the
Weaklives, theArc’s control block cannot be recycled, soSelf::idis a unique name for exactly one mapping for as long as the cache entry exists; and upgrade()succeeding proves the mapping itself is still alive, which is what makes the address it published still mean what it meant when the entry was written.
A dead Weak is therefore a stale entry, not a hit, and is
repacked and replaced. The Weak holds no mapping open, so nothing
here keeps a file resident.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MapId
impl RefUnwindSafe for MapId
impl Send for MapId
impl Sync for MapId
impl Unpin for MapId
impl UnsafeUnpin for MapId
impl UnwindSafe for MapId
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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