aboutsummaryrefslogtreecommitdiff
path: root/qwen_kernels.h
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-16 09:26:20 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-16 09:26:20 +0200
commitc20279050f88d9c24187c3e402912596e1f54587 (patch)
tree2750fc95cca51258c1ceb31cfcce6c2a46cb2bc7 /qwen_kernels.h
parent849c571a8e79d92c1fd3dabecf0fb3621aa4f59b (diff)
downloadffwd-c20279050f88d9c24187c3e402912596e1f54587.tar.gz
ffwd-c20279050f88d9c24187c3e402912596e1f54587.zip
all: support BERT tanh-GeLU (gelu_new / gelu_pytorch_tanh)
Diffstat (limited to 'qwen_kernels.h')
-rw-r--r--qwen_kernels.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/qwen_kernels.h b/qwen_kernels.h
index 36d2913..9abb489 100644
--- a/qwen_kernels.h
+++ b/qwen_kernels.h
@@ -111,6 +111,10 @@ void qwen_silu_mul_inplace(float *gate, const float *up, int n);
* "gelu" activation HF BERT/BGE/MiniLM use, not the tanh approximation. */
void qwen_gelu_inplace(float *x, int n);
+/* Tanh-approximation GeLU in place (HF gelu_new / gelu_pytorch_tanh):
+ * x = 0.5 * x * (1 + tanh(sqrt(2/pi) * (x + 0.044715 * x^3))). */
+void qwen_gelu_tanh_inplace(float *x, int n);
+
/* ========================================================================
* Attention Operations
* ======================================================================== */