gdn_decode_chunk2

Function gdn_decode_chunk2 

Source
pub fn gdn_decode_chunk2(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    h_state: DevicePtr,
    query: DevicePtr,
    key: DevicePtr,
    value: DevicePtr,
    gate: DevicePtr,
    beta: DevicePtr,
    output: DevicePtr,
    h_state_intermediate: DevicePtr,
    batch_size: u32,
    num_k_heads: u32,
    num_v_heads: u32,
    k_dim: u32,
    v_dim: u32,
    qk_stride: u32,
    v_stride: u32,
    gb_stride: u32,
    stream: u64,
) -> Result<()>
Expand description

Fused 2-token GDN decode (speculative verification).

Processes exactly 2 tokens through GDN in a single kernel launch. Saves intermediate H_1 state for rollback on draft rejection. Reads H_0 once, computes both outputs and H_2 in 3 passes (vs 4 for 2× sequential decode), with H_1 intermediate staying in L2 cache.

Q/K/V/gate/beta are accessed via stride params (in elements, not bytes) to support layouts where tokens are interleaved with other data.

Kernel: gated_delta_rule_chunk2(h_state, query, key, value, gate, beta, output, h_state_intermediate, batch_size, num_k_heads, num_v_heads, k_dim, v_dim, qk_stride, v_stride, gb_stride) Grid: (num_v_heads, batch, 1) Block: (128, 1, 1)