Skip to main content

psa_merge_attn_nchw

Function psa_merge_attn_nchw 

Source
pub fn psa_merge_attn_nchw<T: Triton, D: Float, const KEY_DIM: i32>(
    lo_ptr: T::Pointer<D>,
    hi_ptr: T::Pointer<D>,
    out_ptr: T::Pointer<D>,
    c: i32,
    H: i32,
    W: i32,
    num_heads: i32,
)
where T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>, T::Pointer<D>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<D>>>,
Expand description

Merges two FA2 outputs (V_lo and V_hi attention results) into NCHW.

Inputs: lo_ptr, hi_ptr — each [BH * N * KEY_DIM] flat Output: out_ptr[B, c, H, W] NCHW (c = num_heads * 2 * KEY_DIM)

Grid: [BH * N, 1, 1]. Block: [KEY_DIM, 1, 1].