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

Flash Attention v2 prefill on contiguous Q/K/V.

Kernel: inferspark_prefill(Q, K, V, O, seq_len, num_q_heads, num_kv_heads, head_dim, inv_sqrt_d, causal) Grid: (num_q_heads, ceil(seq_len/32), batch) Block: (128, 1, 1)

Layout: Q [batch, seq_len, num_q_heads, head_dim] BF16 K/V [batch, seq_len, num_kv_heads, head_dim] BF16 O [batch, seq_len, num_q_heads, head_dim] BF16