From 7cc64329d786ab786972ff89474cea7a7409d6dd Mon Sep 17 00:00:00 2001 From: domke <673751-domke@users.noreply.gitlab.com> Date: Fri, 26 Jul 2024 18:54:02 +0900 Subject: [PATCH] ggml : reading the runtime sve config of the cpu --- ggml/src/ggml-impl.h | 1 + ggml/src/ggml-quants.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-impl.h b/ggml/src/ggml-impl.h index a2c8dbec0..583df3239 100644 --- a/ggml/src/ggml-impl.h +++ b/ggml/src/ggml-impl.h @@ -146,6 +146,7 @@ extern "C" { #if defined(__ARM_FEATURE_SVE) #include +#include #endif // 16-bit float diff --git a/ggml/src/ggml-quants.c b/ggml/src/ggml-quants.c index 47418597c..d5524cf0e 100644 --- a/ggml/src/ggml-quants.c +++ b/ggml/src/ggml-quants.c @@ -3818,7 +3818,7 @@ void ggml_vec_dot_q4_0_q8_0(int n, float * restrict s, size_t bs, const void * r float sumf = 0; #if defined(__ARM_FEATURE_SVE) - if (svcntb() == QK8_0) { + if ((PR_SVE_VL_LEN_MASK & prctl(PR_SVE_GET_VL)) == QK8_0) { const svbool_t ptrueh = svptrue_pat_b8(SV_VL16); const svbool_t ptruel = svnot_b_z(svptrue_b8(), ptrueh); @@ -5291,7 +5291,7 @@ void ggml_vec_dot_q8_0_q8_0(int n, float * restrict s, size_t bs, const void * r float sumf = 0; #if defined(__ARM_FEATURE_SVE) - if (svcntb() == QK8_0) { + if ((PR_SVE_VL_LEN_MASK & prctl(PR_SVE_GET_VL)) == QK8_0) { svfloat32_t sumv0 = svdup_n_f32(0.0f); svfloat32_t sumv1 = svdup_n_f32(0.0f);