Skip to content

Commit 115f0b1

Browse files
committed
ggml : use svcntb() for SVE vector length detection
Signed-off-by: Adrien Gallouët <[email protected]>
1 parent b8372ee commit 115f0b1

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

ggml/src/ggml-cpu/ggml-cpu.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -683,22 +683,14 @@ bool ggml_is_numa(void) {
683683
}
684684

685685
#if defined(__ARM_ARCH)
686-
687-
#if defined(__linux__) && defined(__aarch64__)
688-
#include <sys/auxv.h>
689-
#endif
690-
691-
static void ggml_init_arm_arch_features(void) {
692686
#if defined(__aarch64__) && defined(__ARM_FEATURE_SVE)
693-
#if defined(__linux__)
694-
ggml_arm_arch_features.sve_cnt = PR_SVE_VL_LEN_MASK & prctl(PR_SVE_GET_VL);
687+
#include <arm_sve.h>
688+
static void ggml_init_arm_arch_features(void) {
689+
ggml_arm_arch_features.sve_cnt = svcntb();
690+
}
695691
#else
696-
// TODO: add support of SVE for non-linux systems
697-
#error "TODO: SVE is not supported on this platform. To use SVE, sve_cnt needs to be initialized here."
698-
#endif
692+
static void ggml_init_arm_arch_features(void) {}
699693
#endif
700-
}
701-
702694
#endif // __ARM_ARCH
703695

704696
struct ggml_tensor * ggml_new_i32(struct ggml_context * ctx, int32_t value) {

0 commit comments

Comments
 (0)