pub struct NoPrefixCaching;Expand description
No-op prefix cache (zero overhead when disabled).
Trait Implementations§
Source§impl PrefixCache for NoPrefixCaching
impl PrefixCache for NoPrefixCaching
Source§fn is_active(&self) -> bool
fn is_active(&self) -> bool
Whether this implementation is active (i.e., a real cache that
actually inserts/holds refs).
NoPrefixCaching returns false;
RadixTree returns true. Callers use this to skip ref-bookkeeping
that’s only meaningful when the cache holds refs (e.g., the manual
kv_cache.inc_ref in cache_sequence that pairs with eviction’s
return_evicted_block).Source§fn lookup(
&self,
_tokens: &[u32],
_block_size: usize,
_session_hash: u64,
_adapter_id: u64,
) -> PrefixMatch
fn lookup( &self, _tokens: &[u32], _block_size: usize, _session_hash: u64, _adapter_id: u64, ) -> PrefixMatch
Look up a token sequence and return cached KV blocks for the
longest matching prefix (block-aligned). Read more
Source§fn insert(
&self,
_tokens: &[u32],
_block_table: &[u32],
_disk_block_ids: &[u32],
_block_size: usize,
_matched_tokens: usize,
_adapter_id: u64,
) -> InsertAcquired
fn insert( &self, _tokens: &[u32], _block_table: &[u32], _disk_block_ids: &[u32], _block_size: usize, _matched_tokens: usize, _adapter_id: u64, ) -> InsertAcquired
Insert a completed prefill’s blocks into the cache. Read more
Source§fn insert_with_snapshot(
&self,
_tokens: &[u32],
_block_table: &[u32],
_disk_block_ids: &[u32],
_block_size: usize,
_snapshot_id: usize,
_session_hash: u64,
_matched_tokens: usize,
_adapter_id: u64,
) -> (Option<usize>, InsertAcquired)
fn insert_with_snapshot( &self, _tokens: &[u32], _block_table: &[u32], _disk_block_ids: &[u32], _block_size: usize, _snapshot_id: usize, _session_hash: u64, _matched_tokens: usize, _adapter_id: u64, ) -> (Option<usize>, InsertAcquired)
Insert blocks with an SSM state snapshot registered in the snapshot index. Read more
Source§fn insert_intermediate_snapshot(
&self,
_tokens: &[u32],
_block_table: &[u32],
_disk_block_ids: &[u32],
_block_size: usize,
_snapshot_id: usize,
_session_hash: u64,
_matched_tokens: usize,
_adapter_id: u64,
) -> Option<usize>
fn insert_intermediate_snapshot( &self, _tokens: &[u32], _block_table: &[u32], _disk_block_ids: &[u32], _block_size: usize, _snapshot_id: usize, _session_hash: u64, _matched_tokens: usize, _adapter_id: u64, ) -> Option<usize>
Insert an SSM snapshot at an intermediate token boundary. Read more
Source§fn insert_tail_snapshot(
&self,
_tokens: &[u32],
_snapshot_id: usize,
_session_hash: u64,
_adapter_id: u64,
) -> Vec<usize>
fn insert_tail_snapshot( &self, _tokens: &[u32], _snapshot_id: usize, _session_hash: u64, _adapter_id: u64, ) -> Vec<usize>
Register the per-session TAIL snapshot in the index WITHOUT touching the
radix tree (the final chunk’s
insert covers those blocks). Supersedes
this session’s previous tail; returns displaced snapshot ids to free.Source§fn insert_tail_sibling_snapshot(
&self,
_tokens: &[u32],
_snapshot_id: usize,
_session_hash: u64,
_adapter_id: u64,
) -> Option<usize>
fn insert_tail_sibling_snapshot( &self, _tokens: &[u32], _snapshot_id: usize, _session_hash: u64, _adapter_id: u64, ) -> Option<usize>
Register the tail’s EARLY sibling (
tb - bs) in the index. Must be
called after insert_tail_snapshot in the same finalize (the tail
insert sweeps the session’s previous tail + sibling). Returns a
displaced snapshot id to free, if the prefix was already registered.Source§fn release(&self, _tokens: &[u32], _block_size: usize, _adapter_id: u64)
fn release(&self, _tokens: &[u32], _block_size: usize, _adapter_id: u64)
Release ref_counts on blocks that were acquired via
lookup. Read moreSource§fn release_matched(
&self,
_tokens: &[u32],
_block_size: usize,
_matched_tokens: usize,
_adapter_id: u64,
)
fn release_matched( &self, _tokens: &[u32], _block_size: usize, _matched_tokens: usize, _adapter_id: u64, )
Release exactly the block-aligned prefix acquired by one
lookup. Read moreSource§fn evict(&self, _num_blocks: usize) -> EvictedBlocks
fn evict(&self, _num_blocks: usize) -> EvictedBlocks
Evict up to
num_blocks cached blocks, returning their physical
indices and parallel disk-block IDs (Phase 6.1.e). Read moreSource§fn evict_snapshot_lru(&self) -> Option<usize>
fn evict_snapshot_lru(&self) -> Option<usize>
Evict the least-recently-used SSM snapshot from the snapshot index.
Returns the snapshot ID so the caller can free it in
SsmSnapshotPool.Source§fn snapshot_count(&self) -> usize
fn snapshot_count(&self) -> usize
Number of SSM snapshots currently stored in the snapshot index.
Source§fn peek_matched_tokens(
&self,
_tokens: &[u32],
_block_size: usize,
_adapter_id: u64,
) -> usize
fn peek_matched_tokens( &self, _tokens: &[u32], _block_size: usize, _adapter_id: u64, ) -> usize
Read-only longest-prefix probe: number of tokens (block-aligned)
lookup would match, WITHOUT taking refs, touching LRU state, or
counting a hit/miss. Used by the prefill tail-checkpoint split to
detect conversation reuse before deciding to pay the extra pass.
Task #24: keyed by adapter_id so a cross-adapter peek reports a miss.Source§fn evict_snapshot_to_tier(&self, min_tokens: usize) -> Option<TierEvict>
fn evict_snapshot_to_tier(&self, min_tokens: usize) -> Option<TierEvict>
Phase 1b spill tier: pick a spill victim (same policy as
evict_snapshot_lru, HBM-resident only) and decide whether it is worth
spilling — see TierEvict. A victim shallower than min_tokens
cannot repay the spill’s fixed cost, so its entry is dropped outright
rather than left findable-but-empty. min_tokens == 0 disables the
gate. None when nothing resident remains; default None (no tier).Source§fn promote_snapshot(&self, key: u64, new_slot: usize) -> bool
fn promote_snapshot(&self, key: u64, new_slot: usize) -> bool
Phase 1b spill tier: after the caller faulted a spilled snapshot’s bytes
into
new_slot, re-home its index entry to HBM. Returns false if the
key is unknown. Default: false.Source§fn forget_snapshot_tier_key(&self, key: u64) -> bool
fn forget_snapshot_tier_key(&self, key: u64) -> bool
Phase 1b spill tier: the FAILED-fault-in twin of
Self::promote_snapshot.
The caller’s store.get(key) MISSED, so this entry is findable by
lookup_tiered with no bytes behind it. Left in place, every warm turn
on this prefix repeats the whole doomed cycle — spill a LIVE 66 MB
victim D2H to free a slot, fault in, miss, free the slot — and then
recomputes anyway; under ATLAS_SSM_TIER_DISK_GB that doomed spill
evicts one MORE tier record, so the cap’s own pressure re-amplifies
itself. Dropping the entry degrades the prefix to a plain recompute
ONCE. Read moreAuto Trait Implementations§
impl Freeze for NoPrefixCaching
impl RefUnwindSafe for NoPrefixCaching
impl Send for NoPrefixCaching
impl Sync for NoPrefixCaching
impl Unpin for NoPrefixCaching
impl UnwindSafe for NoPrefixCaching
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