Glm5NextKdaLayer

Struct Glm5NextKdaLayer 

Source
pub struct Glm5NextKdaLayer {
    pub layer_idx: usize,
    pub cfg: Glm5NextKdaConfig,
    pub weights: Glm5NextKdaWeights,
    pub kernels: Glm5NextKdaKernels,
}
Expand description

2026-09-25: One bound KDA attention block.

Fields§

§layer_idx: usize

2026-09-25: The checkpoint layer index this block was bound from.

§cfg: Glm5NextKdaConfig§weights: Glm5NextKdaWeights§kernels: Glm5NextKdaKernels

Implementations§

Source§

impl Glm5NextKdaLayer

Source

pub fn decode( &self, gpu: &dyn GpuBackend, hidden: DevicePtr, state: &KdaSeqState, ws: &Glm5NextKdaWorkspace, stream: u64, ) -> Result<()>

2026-09-25: Single-token decode, carrying both states. The result lands in ws.final_out; state is updated in place.

Source

pub fn decode_k( &self, gpu: &dyn GpuBackend, hidden: DevicePtr, k: usize, state: &KdaSeqState, ws: &Glm5NextKdaWorkspace, snapshots: &[(DevicePtr, DevicePtr)], stream: u64, ) -> Result<()>

2026-09-25: k tokens of one sequence: the projections batched, the recurrence one row at a time. Used for the speculative verify, and for prefill sub-chunks that do not take the chunked arm (glm5next_layer/steps/forward.rs).

front_end and back_end run once over all k rows. For 2 <= k <= DENSE_GEMV_BATCHM_MAX_M on a target with dense_gemv_bf16_batchm, the output matches k serial Self::decode calls bit for bit: the batched GEMV gives each row the bits of the M = 1 GEMV, the pack, gate, sigmoid and o_norm kernels treat rows independently, and stateful_row walks the state one row at a time as decode does.

snapshots[t], (h_dst, conv_dst), receives the state after row t; rows past snapshots.len() take no snapshot. Refuses k == 0 or k above the workspace.

Source§

impl Glm5NextKdaLayer

Source

pub fn prefill( &self, gpu: &dyn GpuBackend, hidden: DevicePtr, t: usize, state: &KdaSeqState, ws: &Glm5NextKdaWorkspace, stream: u64, ) -> Result<()>

2026-09-25: Chunked prefill over t tokens, starting from the carried state.

Source

pub fn prefill_with_pad_fill( &self, gpu: &dyn GpuBackend, hidden: DevicePtr, t: usize, state: &KdaSeqState, ws: &Glm5NextKdaWorkspace, pad_fill: f32, stream: u64, ) -> Result<()>

2026-09-25: Self::prefill with the padded q/k/v tails filled with pad_fill.

Self::prefill passes zero. The layer harness passes other values to show that kda_chunk_* ignores positions at or past t in-kernel, which a zeroed tail cannot show.

Source§

impl Glm5NextKdaLayer

Source

pub fn new( layer_idx: usize, cfg: Glm5NextKdaConfig, weights: Glm5NextKdaWeights, kernels: Glm5NextKdaKernels, ) -> Result<Self>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,