From f463018cd700690336898d109226d489deca036d Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Sun, 14 Jun 2026 15:19:12 +0200 Subject: all: add support for Qwen3-Embedding + causal GQA attention --- qwen_kernels.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'qwen_kernels.h') diff --git a/qwen_kernels.h b/qwen_kernels.h index 71f77f1..c611194 100644 --- a/qwen_kernels.h +++ b/qwen_kernels.h @@ -116,6 +116,20 @@ void qwen_bidirectional_gqa_attention_packed_with_scratch( const int *offsets, int batch, int n_heads, int n_kv_heads, int head_dim, float scale, float *scratch, size_t scratch_bytes); +/* + * Causal GQA attention over a packed/ragged batch. Query position i attends + * only to positions at or before i within its sequence. + */ +void qwen_causal_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); +void qwen_causal_gqa_attention_packed_with_scratch( + 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, float *scratch, size_t scratch_bytes); + /* ======================================================================== * Position Embeddings * ======================================================================== */ -- cgit v1.3.1