aboutsummaryrefslogtreecommitdiff
path: root/qwen_kernels.h
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-14 15:19:12 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-14 15:19:12 +0200
commitf463018cd700690336898d109226d489deca036d (patch)
tree4e1d83f55a5e231af519aa4d647141db5de23af7 /qwen_kernels.h
parentd98ee1568c0bd88304a12e59d12104066e01e8d0 (diff)
downloadffwd-f463018cd700690336898d109226d489deca036d.tar.gz
ffwd-f463018cd700690336898d109226d489deca036d.zip
all: add support for Qwen3-Embedding + causal GQA attention
Diffstat (limited to 'qwen_kernels.h')
-rw-r--r--qwen_kernels.h14
1 files changed, 14 insertions, 0 deletions
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
* ======================================================================== */