pub struct KvCache {
pub layers: Vec<LayerKvCache>,
pub max_seq_len: usize,
pub policy: EvictionPolicy,
}Expand description
Full KV cache for all layers.
Fields§
§layers: Vec<LayerKvCache>§max_seq_len: usize§policy: EvictionPolicyImplementations§
Source§impl KvCache
impl KvCache
pub fn new( num_layers: usize, num_kv_heads: usize, head_dim: usize, max_seq_len: usize, ) -> Self
pub fn clear(&mut self)
pub fn total_memory_bytes(&self) -> usize
Sourcepub fn seq_len(&self) -> usize
pub fn seq_len(&self) -> usize
Current sequence length (max across layers — dead layers may lag).
pub fn needs_eviction(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KvCache
impl RefUnwindSafe for KvCache
impl Send for KvCache
impl Sync for KvCache
impl Unpin for KvCache
impl UnsafeUnpin for KvCache
impl UnwindSafe for KvCache
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