Skip to main content

MlaInputs

Struct MlaInputs 

Source
pub struct MlaInputs<'a> {
    pub q_nope: &'a [f32],
    pub q_pe: &'a [f32],
    pub c_kv: &'a [f32],
    pub k_pe: &'a [f32],
    pub w_uk: &'a [f32],
    pub w_uv: &'a [f32],
    pub t_q: usize,
    pub t_kv: usize,
}
Expand description

Inputs shared by both forms. Rope is already applied to q_pe/k_pe (it happens upstream of the attention core and is identical in both forms). c_kv is already RMS-normed.

Layouts (row-major): q_nope: [t_q][n_head][d_nope] q_pe: [t_q][n_head][d_rope] c_kv: [t_kv][kv_rank] — the latent KV cache (one row per token, all heads) k_pe: [t_kv][d_rope] — decoupled rope key (one per token, all heads) w_uk: [n_head][d_nope][kv_rank] — k_nope_h = w_uk[h] · c_kv w_uv: [n_head][d_v][kv_rank] — v_h = w_uv[h] · c_kv

The queries occupy the LAST t_q positions of the cache (decode/prefill convention: their own rows are already appended). Causal: query i attends to cache rows 0 ..= (t_kv - t_q + i).

Fields§

§q_nope: &'a [f32]§q_pe: &'a [f32]§c_kv: &'a [f32]§k_pe: &'a [f32]§w_uk: &'a [f32]§w_uv: &'a [f32]§t_q: usize§t_kv: usize

Auto Trait Implementations§

§

impl<'a> Freeze for MlaInputs<'a>

§

impl<'a> RefUnwindSafe for MlaInputs<'a>

§

impl<'a> Send for MlaInputs<'a>

§

impl<'a> Sync for MlaInputs<'a>

§

impl<'a> Unpin for MlaInputs<'a>

§

impl<'a> UnsafeUnpin for MlaInputs<'a>

§

impl<'a> UnwindSafe for MlaInputs<'a>

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.