Skip to content

Commit

Permalink
ggml : add vector scaling using Accelerate (ggerganov#380)
Browse files Browse the repository at this point in the history
* Added vector scaling using Accelerate

* added missing elif
  • Loading branch information
nullhook authored Jul 23, 2023
1 parent 27e2c5b commit c380411
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -3440,7 +3440,9 @@ inline static void ggml_vec_mad_f32(const int n, float * restrict y, const float

//inline static void ggml_vec_scale_f32(const int n, float * y, const float v) { for (int i = 0; i < n; ++i) y[i] *= v; }
inline static void ggml_vec_scale_f32(const int n, float * y, const float v) {
#if defined(GGML_SIMD)
#if defined(GGML_USE_ACCELERATE)
vDSP_vsmul(y, 1, &v, y, 1, n);
#elif defined(GGML_SIMD)
const int np = (n & ~(GGML_F32_STEP - 1));

GGML_F32_VEC vx = GGML_F32_VEC_SET1(v);
Expand Down

0 comments on commit c380411

Please sign in to comment.