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: GpuTensorq/k/v projections, [qkv, hidden] each.
wk: GpuTensor§wv: GpuTensor§f_a: GpuTensorForget gate low-rank pair: f_a [head_dim, hidden], f_b [qkv, head_dim].
f_b: GpuTensor§g_a: GpuTensorOutput gate low-rank pair, same shapes as the forget pair.
g_b: GpuTensor§b_proj: GpuTensorPer-head beta projection, [heads, hidden].
wo: GpuTensorOutput projection, [hidden, qkv].
conv: CudaSlice<f32>The three per-plane conv weights concatenated into [3*qkv, kernel] (see module header).
a_log: GpuTensorA_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
impl KdaAttnLayer
pub fn heads(&self) -> usize
pub fn head_dim(&self) -> usize
pub fn qkv(&self) -> usize
pub fn conv_kernel(&self) -> usize
Sourcepub fn conv_width(&self) -> usize
pub fn conv_width(&self) -> usize
Fused conv ring width, matching StatePlan::Recurrent { conv_width } for this layer.
Sourcepub fn state_width(&self) -> usize
pub fn state_width(&self) -> usize
Recurrent state elements, matching StatePlan::Recurrent { state_width }.
Sourcepub fn load(
e: &Engine,
src: &dyn TensorSource,
il: u32,
plan: &KimiDeltaNetPlan,
) -> Result<Self, Box<dyn Error>>
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.