diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-05-20 05:26:35 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-06-14 08:17:30 +0200 |
| commit | 7a88087ba0b5b1b388234f3d2a907673c63bd8cb (patch) | |
| tree | 3a656367ab23d65d625c9cbbb3014ed109a2ebd2 /qwen_asr_kernels.h | |
| parent | 47859fbfdc02329090c59357cbb826b42c946bf7 (diff) | |
| download | ffwd-7a88087ba0b5b1b388234f3d2a907673c63bd8cb.tar.gz ffwd-7a88087ba0b5b1b388234f3d2a907673c63bd8cb.zip | |
all: support batched embedding attention
Diffstat (limited to 'qwen_asr_kernels.h')
| -rw-r--r-- | qwen_asr_kernels.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qwen_asr_kernels.h b/qwen_asr_kernels.h index c59aeff..ce5e738 100644 --- a/qwen_asr_kernels.h +++ b/qwen_asr_kernels.h @@ -124,6 +124,22 @@ void qwen_causal_attention(float *out, const float *Q, const float *K, const flo int seq_q, int seq_k, int n_heads, int n_kv_heads, int head_dim, float scale, int q_offset); +/* + * Bidirectional GQA attention over a packed/ragged batch. + * + * Q: [total_seq, n_heads * head_dim] + * K,V: [total_seq, n_kv_heads * head_dim] + * offsets: [batch + 1], token spans for each sequence. + * + * Attention is block-diagonal: tokens only attend within their own + * offsets[b]..offsets[b+1] span. + */ +void qwen_bidirectional_gqa_attention_packed(float *out, const float *Q, + const float *K, const float *V, + const int *offsets, int batch, + int n_heads, int n_kv_heads, + int head_dim, float scale); + /* ======================================================================== * Position Embeddings * ======================================================================== */ |
