prefill_attention

Function prefill_attention 

Source
pub fn prefill_attention(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    q: DevicePtr,
    k: DevicePtr,
    v: DevicePtr,
    output: DevicePtr,
    seq_len: u32,
    batch: u32,
    num_q_heads: u32,
    num_kv_heads: u32,
    head_dim: u32,
    inv_sqrt_d: f32,
    causal: bool,
    sliding_window: u32,
    stream: u64,
) -> Result<()>
Expand description

2026-09-25: Flash-attention prefill on contiguous BF16 tensors: Q and O [batch, seq_len, num_q_heads, head_dim], K and V [batch, seq_len, num_kv_heads, head_dim]. sliding_window == 0 disables the window; otherwise keys with q - k >= sliding_window are masked.