aboutsummaryrefslogtreecommitdiff
path: root/qwen_kernels_generic.c
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-15 08:40:11 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-15 08:40:11 +0200
commitc4a1c97a09da6d8d88c2ac834bf6234506fc41bc (patch)
tree81ce5675ce886aad0309a41f4d6a696826e0a061 /qwen_kernels_generic.c
parentb377ba8656bfb807ed8dda6c9f26942b50ce626d (diff)
downloadffwd-c4a1c97a09da6d8d88c2ac834bf6234506fc41bc.tar.gz
ffwd-c4a1c97a09da6d8d88c2ac834bf6234506fc41bc.zip
chore: run clang-format
Diffstat (limited to 'qwen_kernels_generic.c')
-rw-r--r--qwen_kernels_generic.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/qwen_kernels_generic.c b/qwen_kernels_generic.c
index fd07455..149dfe0 100644
--- a/qwen_kernels_generic.c
+++ b/qwen_kernels_generic.c
@@ -6,8 +6,8 @@
#include <string.h>
-void qwen_bf16_matvec_fused_generic(float *y, const float *x, const uint16_t *W_bf16,
- const float *bias, int in_dim, int out_dim) {
+void qwen_bf16_matvec_fused_generic(
+ float *y, const float *x, const uint16_t *W_bf16, const float *bias, int in_dim, int out_dim) {
for (int o = 0; o < out_dim; o++) {
const uint16_t *w_row = W_bf16 + (size_t)o * in_dim;
float sum = bias ? bias[o] : 0.0f;
@@ -23,18 +23,22 @@ void qwen_bf16_matvec_fused_generic(float *y, const float *x, const uint16_t *W_
float qwen_dot_f32_generic(const float *a, const float *b, int n) {
float sum = 0.0f;
- for (int i = 0; i < n; i++) sum += a[i] * b[i];
+ for (int i = 0; i < n; i++)
+ sum += a[i] * b[i];
return sum;
}
void qwen_vec_scale_inplace_generic(float *dst, float scale, int n) {
- for (int i = 0; i < n; i++) dst[i] *= scale;
+ for (int i = 0; i < n; i++)
+ dst[i] *= scale;
}
void qwen_vec_axpy_inplace_generic(float *dst, const float *src, float alpha, int n) {
- for (int i = 0; i < n; i++) dst[i] += alpha * src[i];
+ for (int i = 0; i < n; i++)
+ dst[i] += alpha * src[i];
}
void qwen_vec_scale_add_generic(float *dst, const float *src, float correction, int n) {
- for (int i = 0; i < n; i++) dst[i] = dst[i] * correction + src[i];
+ for (int i = 0; i < n; i++)
+ dst[i] = dst[i] * correction + src[i];
}