From: Jie Fu (傅杰) Date: Mon, 13 Oct 2025 12:48:47 +0000 (+0800) Subject: ggml : fix build broken with -march=armv9-a on MacOS (llama/16520) X-Git-Tag: upstream/0.9.4.58~12 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=ac314c148b8b522e9d8e5dcfe6ed0817eb64cf5f;p=pkg%2Fggml%2Fsources%2Fggml ggml : fix build broken with -march=armv9-a on MacOS (llama/16520) * ggml : fix build broken with -march=armv9-a on MacOS Signed-off-by: Jie Fu * Add #pragma message Signed-off-by: Jie Fu * Address review comment. Signed-off-by: Jie Fu * Update ggml/src/ggml-cpu/ggml-cpu.c --------- Signed-off-by: Jie Fu Co-authored-by: Diego Devesa --- diff --git a/src/ggml-cpu/ggml-cpu-impl.h b/src/ggml-cpu/ggml-cpu-impl.h index 799e2b11..713bf85e 100644 --- a/src/ggml-cpu/ggml-cpu-impl.h +++ b/src/ggml-cpu/ggml-cpu-impl.h @@ -68,7 +68,7 @@ struct ggml_compute_params { #endif // __VXE2__ #endif // __s390x__ && __VEC__ -#if defined(__ARM_FEATURE_SVE) +#if defined(__ARM_FEATURE_SVE) && defined(__linux__) #include #endif diff --git a/src/ggml-cpu/ggml-cpu.c b/src/ggml-cpu/ggml-cpu.c index eded6eb7..ba2a36d9 100644 --- a/src/ggml-cpu/ggml-cpu.c +++ b/src/ggml-cpu/ggml-cpu.c @@ -689,8 +689,13 @@ bool ggml_is_numa(void) { #endif static void ggml_init_arm_arch_features(void) { -#if defined(__linux__) && defined(__aarch64__) && defined(__ARM_FEATURE_SVE) +#if defined(__aarch64__) && defined(__ARM_FEATURE_SVE) +#if defined(__linux__) ggml_arm_arch_features.sve_cnt = PR_SVE_VL_LEN_MASK & prctl(PR_SVE_GET_VL); +#else + // TODO: add support of SVE for non-linux systems +#error "TODO: SVE is not supported on this platform. To use SVE, sve_cnt needs to be initialized here." +#endif #endif }