Skip to main content

KvLayer

Struct KvLayer 

Source
pub struct KvLayer {
    pub k: CudaSlice<u8>,
    pub v: CudaSlice<u8>,
    pub kv_dim_k: usize,
    pub kv_dim_v: usize,
    pub k_tok_bytes: usize,
    pub v_tok_bytes: usize,
    pub len: usize,
    pub len_d: CudaSlice<i32>,
}
Expand description

Per-full-attn-layer growing KV cache, resident on GPU. QUANTIZED (KVQUANT-PLAN §B): K stored q8_0 (34 B/32 elem), V stored q5_1 (24 B/32 elem). Per-token byte layout keeps the [token, kv_head, dim] element order so a 32-block never straddles a head (assert head_dim%32==0). Element-within-token index = kv_head*head_dim + d; block = idx/32; lane = idx%32.

Fields§

§k: CudaSlice<u8>§v: CudaSlice<u8>§kv_dim_k: usize§kv_dim_v: usize§k_tok_bytes: usize§v_tok_bytes: usize§len: usize§len_d: CudaSlice<i32>

Device-resident mirror of len (CUDA-GRAPH-PLAN Phase 2). Holds the KV write SLOT for the append-dc kernel (old len, before this step’s append); after inc_seqlen it holds the new len == t_kv for fa_decode_dc. Kept in lock-step with the host len. i32[1].

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.