diff options
| author | Onur Gündüz <ogunduz@gmail.com> | 2026-06-20 20:10:56 +0200 |
|---|---|---|
| committer | Onur Gündüz <ogunduz@gmail.com> | 2026-06-21 05:57:19 +0200 |
| commit | 6b969d25ce136eaf695222bd1a10bff1ecac0220 (patch) | |
| tree | c23afb50c28b9deaddae5c6526a74ee11cf2d865 /src/kernels_rope.c | |
| parent | d4bdb8dae753462f621507d5fc3582e0e53da35c (diff) | |
| download | ffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.tar.gz ffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.zip | |
all: split Makefile and reorg library/tools
Diffstat (limited to '')
| -rw-r--r-- | libffwd/rope.c (renamed from src/kernels_rope.c) | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/kernels_rope.c b/libffwd/rope.c index ef1709a..12057b2 100644 --- a/src/kernels_rope.c +++ b/libffwd/rope.c @@ -1,5 +1,9 @@ +/* + * rope.c - rotary position embeddings + */ + #include "kernels.h" -#include "kernels_impl.h" +#include "impl.h" #include <math.h> #include <stdlib.h> @@ -7,22 +11,22 @@ #if (defined(__AVX512F__) || defined(__AVX2__)) && \ (defined(__x86_64__) || defined(__i386__) || defined(_M_X64) || defined(_M_IX86)) -#include <immintrin.h> +# include <immintrin.h> #endif #if defined(__ARM_NEON) || defined(__ARM_NEON__) -#include <arm_neon.h> +# include <arm_neon.h> #endif #ifdef USE_BLAS -#ifdef __APPLE__ -#include <Accelerate/Accelerate.h> -#else -#include <cblas.h> -#endif +# ifdef __APPLE__ +# include <Accelerate/Accelerate.h> +# else +# include <cblas.h> +# endif #endif #ifndef M_PI -#define M_PI 3.14159265358979323846 +# define M_PI 3.14159265358979323846 #endif /* Rotary position embeddings: cache-free NeoX-style RoPE compute and apply. */ @@ -31,7 +35,7 @@ * Position Embeddings * ======================================================================== */ -void embed_compute_rope_neox( +void compute_rope_neox( float *cos_out, float *sin_out, const int *positions, int seq, int head_dim, float theta) { int half = head_dim / 2; @@ -51,7 +55,7 @@ void embed_compute_rope_neox( } } -void embed_apply_rope_neox( +void apply_rope_neox( float *x, const float *cos_vals, const float *sin_vals, int seq, int n_heads, int head_dim) { /* * NeoX split-half style: |
