@@ -119,7 +119,7 @@ inline static void ggml_vec_dot_f16_unroll(const int n, const int xs, float * GG
119119 }
120120
121121#if defined(GGML_SIMD )
122- #if defined(__ARM_FEATURE_SVE )
122+ #if defined(__ARM_FEATURE_SVE ) && defined( __linux__ )
123123
124124 const int sve_register_length = svcntb () * 8 ;
125125 const int ggml_f16_epr = sve_register_length / 16 ; // running when 16
@@ -277,7 +277,7 @@ inline static void ggml_vec_dot_f16_unroll(const int n, const int xs, float * GG
277277
278278inline static void ggml_vec_mad_f32 (const int n , float * GGML_RESTRICT y , const float * GGML_RESTRICT x , const float v ) {
279279#if defined(GGML_SIMD )
280- #if defined(__ARM_FEATURE_SVE )
280+ #if defined(__ARM_FEATURE_SVE ) && defined( __linux__ )
281281
282282 const int sve_register_length = ggml_cpu_get_sve_cnt () * 8 ;
283283 const int ggml_f32_epr = sve_register_length / 32 ;//8;//svcntw(); // SVE128:4, SVE256:8, SVE512:16
@@ -397,7 +397,7 @@ inline static void ggml_vec_mad_f32(const int n, float * GGML_RESTRICT y, const
397397
398398inline static void ggml_vec_mad_f16 (const int n , ggml_fp16_t * GGML_RESTRICT y , const ggml_fp16_t * GGML_RESTRICT x , const float v ) {
399399#if defined(GGML_SIMD )
400- #if defined(__ARM_FEATURE_SVE )
400+ #if defined(__ARM_FEATURE_SVE ) && defined( __linux__ )
401401 const int sve_register_length = svcntb () * 8 ;
402402 const int ggml_f16_epr = sve_register_length / 16 ;
403403 const int ggml_f16_step = 8 * ggml_f16_epr ;
@@ -523,7 +523,7 @@ inline static void ggml_vec_mad_f32_unroll(const int n, const int xs, const int
523523 }
524524
525525#if defined(GGML_SIMD )
526- #if defined(__ARM_FEATURE_SVE )
526+ #if defined(__ARM_FEATURE_SVE ) && defined( __linux__ )
527527 // scalar Route to scalar implementation //TODO: Write SVE code
528528 for (int k = 0 ; k < GGML_VEC_MAD_UNROLL ; ++ k ) {
529529 for (int i = 0 ; i < n ; ++ i ) {
@@ -698,7 +698,7 @@ inline static void ggml_vec_scale_f32(const int n, float * y, const float v) {
698698
699699inline static void ggml_vec_scale_f16 (const int n , ggml_fp16_t * y , const float v ) {
700700#if defined(GGML_SIMD )
701- #if defined(__ARM_FEATURE_SVE )
701+ #if defined(__ARM_FEATURE_SVE ) && defined( __linux__ )
702702 const int sve_register_length = svcntb () * 8 ;
703703 const int ggml_f16_epr = sve_register_length / 16 ;
704704 const int ggml_f16_step = 2 * ggml_f16_epr ;
@@ -968,7 +968,7 @@ inline static ggml_fp16_t ggml_silu_f16(ggml_fp16_t x) {
968968
969969/* Below function was borrowed from the GitHub repository:
970970https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/common.hpp */
971- #if defined(__ARM_FEATURE_SVE ) && defined(__aarch64__ )
971+ #if defined(__ARM_FEATURE_SVE ) && defined(__aarch64__ ) && defined( __linux__ )
972972 inline static svfloat32_t exp_ps_sve (svbool_t pg , svfloat32_t src ) {
973973 // Constants
974974 const svfloat32_t log2_e = svdup_n_f32 (1.4426950409f );
@@ -1002,7 +1002,7 @@ inline static ggml_fp16_t ggml_silu_f16(ggml_fp16_t x) {
10021002 }
10031003#endif
10041004
1005- #if defined(__ARM_FEATURE_SVE ) && defined(__aarch64__ )
1005+ #if defined(__ARM_FEATURE_SVE ) && defined(__aarch64__ ) && defined( __linux__ )
10061006
10071007inline static svfloat32_t ggml_v_expf (svbool_t pg , svfloat32_t x ) {
10081008 const svfloat32_t r = svdup_n_f32_x (pg , 0x1.8p23f );
0 commit comments