Skip to main content

KdaAttnLayer

Struct KdaAttnLayer 

Source
pub struct KdaAttnLayer {
Show 15 fields pub plan: KimiDeltaNetPlan, pub wq: GpuTensor, pub wk: GpuTensor, pub wv: GpuTensor, pub f_a: GpuTensor, pub f_b: GpuTensor, pub g_a: GpuTensor, pub g_b: GpuTensor, pub b_proj: GpuTensor, pub wo: GpuTensor, pub conv: CudaSlice<f32>, pub a_log: GpuTensor, pub dt_bias: GpuTensor, pub o_norm: GpuTensor, pub tp: Option<Box<Glm5TpKda>>,
}
Expand description

One loaded KDA mixer. Field names follow the reference’s tensor roles, not the HF spellings.

Fields§

§plan: KimiDeltaNetPlan§wq: GpuTensor

q/k/v projections, [qkv, hidden] each.

§wk: GpuTensor§wv: GpuTensor§f_a: GpuTensor

Forget gate low-rank pair: f_a [head_dim, hidden], f_b [qkv, head_dim].

§f_b: GpuTensor§g_a: GpuTensor

Output gate low-rank pair, same shapes as the forget pair.

§g_b: GpuTensor§b_proj: GpuTensor

Per-head beta projection, [heads, hidden].

§wo: GpuTensor

Output projection, [hidden, qkv].

§conv: CudaSlice<f32>

The three per-plane conv weights concatenated into [3*qkv, kernel] (see module header).

§a_log: GpuTensor

A_log [heads], dt_bias [qkv] (per CHANNEL, unlike GDN’s per-head bias), o_norm [head_dim].

§dt_bias: GpuTensor§o_norm: GpuTensor§tp: Option<Box<Glm5TpKda>>

glm5 TP-2 sidecar (MEMRA_GLM5_TP, lane/glm5-tp2). Some means THIS layer struct is the ROOT-RANK HEAD SHARD (heads/2) and the sidecar carries the peer shard + runtime. Every plain entry point REFUSES a sharded layer by name — only the TP walk (glm5_tp::kda_tp_*) may execute it. None everywhere else (zero cost, zero change).

Implementations§

Source§

impl KdaAttnLayer

Source

pub fn heads(&self) -> usize

Source

pub fn head_dim(&self) -> usize

Source

pub fn qkv(&self) -> usize

Source

pub fn conv_kernel(&self) -> usize

Source

pub fn conv_width(&self) -> usize

Fused conv ring width, matching StatePlan::Recurrent { conv_width } for this layer.

Source

pub fn state_width(&self) -> usize

Recurrent state elements, matching StatePlan::Recurrent { state_width }.

Source

pub fn load( e: &Engine, src: &dyn TensorSource, il: u32, plan: &KimiDeltaNetPlan, ) -> Result<Self, Box<dyn Error>>

Load block il’s KDA tensors. Names are the ggml-dialect contract names from memra_gguf::tensor_contract::add_kda; the safetensors source translates them.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.