Glm5NextKdaWorkspace

Struct Glm5NextKdaWorkspace 

Source
pub struct Glm5NextKdaWorkspace {
Show 13 fields pub qkv_parts: DevicePtr, pub qkv_proj: DevicePtr, pub conv_out: DevicePtr, pub q_f32: DevicePtr, pub k_f32: DevicePtr, pub v_f32: DevicePtr, pub gate: DevicePtr, pub beta: DevicePtr, pub core: DevicePtr, pub g_raw: DevicePtr, pub out_gate: DevicePtr, pub o_norm_out: DevicePtr, pub final_out: DevicePtr, /* private fields */
}
Expand description

2026-09-25: Scratch for the forward path, sized once for max_tokens (prefill buffers padded to a whole number of chunks). The loader shares one workspace across the KDA layers.

The intermediate buffers are pub so the numeric tests can compare each stage, not only the layer output.

Fields§

§qkv_parts: DevicePtr

2026-09-25: [3, T, qkv] BF16: the q, k and v projection outputs, before the pack.

§qkv_proj: DevicePtr

2026-09-25: [T, conv_dim] BF16: q|k|v per token, before the conv.

§conv_out: DevicePtr

2026-09-25: [T, conv_dim] BF16: after conv + SiLU, with q|k L2-normalised (inside the conv kernel on decode, by l2_norm_bf16 in place on prefill).

§q_f32: DevicePtr

2026-09-25: [T_pad, qkv] FP32: q, k and v widened for the chunked prefill. Prefill only.

§k_f32: DevicePtr§v_f32: DevicePtr§gate: DevicePtr

2026-09-25: [T_pad, heads, head_dim] FP32: the bounded log-decay kda_gate writes.

§beta: DevicePtr

2026-09-25: [T_pad, heads] FP32: sigmoid(b_proj(h)).

§core: DevicePtr

2026-09-25: [T_pad, heads, head_dim] FP32: the KDA core output, before o_norm.

§g_raw: DevicePtr

2026-09-25: [T, qkv] BF16: f_b(f_a(h)), the forget-gate input kda_gate reads. It has the same shape as out_gate and must not alias it.

§out_gate: DevicePtr

2026-09-25: [T, qkv] BF16: g_b(g_a(h)), the low-rank output gate.

§o_norm_out: DevicePtr

2026-09-25: [T, qkv] BF16: after the sigmoid-gated RMSNorm.

§final_out: DevicePtr

2026-09-25: [T, hidden] BF16: the block output.

Implementations§

Source§

impl Glm5NextKdaWorkspace

Source

pub fn new( gpu: &dyn GpuBackend, cfg: &Glm5NextKdaConfig, max_tokens: usize, ) -> Result<Self>

Source

pub fn max_tokens(&self) -> usize

Source

pub fn t_pad(&self) -> usize

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,