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: usizeAuto 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> 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