pub struct KvLayer {
pub k: Arc<RwLock<Storage>>,
pub v: Arc<RwLock<Storage>>,
pub k_layout: Layout,
pub v_layout: Layout,
pub k_version: u64,
pub v_version: u64,
pub k_authority: AuthorityState,
pub v_authority: AuthorityState,
}Expand description
One layer’s K + V slots in a backend-erased KV cache.
Storage Arcs are dispatch-erased: each Arc points at a
fuel_memory::BackendStorage enum variant (Cpu, Cuda,
Vulkan, Metal). The graph references these Arcs via the
persistent map in InferenceContext; readers see the bytes
through whichever Layout the graph carries for the consuming
NodeId.
Fields§
§k: Arc<RwLock<Storage>>§v: Arc<RwLock<Storage>>§k_layout: LayoutView layout into k describing the live extent. For the grow-
by-replacement pattern (today) the layout matches the storage’s
full shape. For pre-allocated buffers (Phase E.3.2) the layout
describes the leading [..., cached_len, ...] slice.
v_layout: Layout§k_version: u64Monotonic write version for K. Bumps on every successful
Op::WriteSlice targeting this slot. Used by the future
multi-device coherence protocol to detect staleness.
v_version: u64Coherence authority per slot. K and V can in principle diverge (a future optimization that decouples their update cadence could exploit this), though standard transformer decoding updates both together every step.
Auto Trait Implementations§
impl Freeze for KvLayer
impl RefUnwindSafe for KvLayer
impl Send for KvLayer
impl Sync for KvLayer
impl Unpin for KvLayer
impl UnsafeUnpin for KvLayer
impl UnwindSafe for KvLayer
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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