From: taher Date: Sun, 23 Jul 2023 14:54:27 +0000 (-0700) Subject: ggml : add vector scaling using Accelerate (#380) X-Git-Tag: upstream/0.0.1642~1300 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=c380411a7e3bbeb44fab010438c54b98f59ea6a3;p=pkg%2Fggml%2Fsources%2Fggml ggml : add vector scaling using Accelerate (#380) * Added vector scaling using Accelerate * added missing elif --- diff --git a/src/ggml.c b/src/ggml.c index 14658ae4..b1be7d8d 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -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);