Skip to content

Commit

Permalink
ggml : Add GGML_USE_SVE macro to disable SVE by default
Browse files Browse the repository at this point in the history
  • Loading branch information
msy-kato committed Jul 10, 2024
1 parent a59f8fd commit 029deaf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions ggml/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64" OR
list(APPEND ARCH_FLAGS -mno-unaligned-access)
endif()
if (GGML_SVE)
list(APPEND GGML_CDEF_PUBLIC GGML_USE_SVE)
list(APPEND ARCH_FLAGS -march=armv8.6-a+sve)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion ggml/src/ggml-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ extern "C" {
#endif
#endif

#if defined(__ARM_FEATURE_SVE)
#if (defined(__ARM_FEATURE_SVE) && defined(GGML_USE_SVE))
#include <arm_sve.h>
#endif

Expand Down
4 changes: 2 additions & 2 deletions ggml/src/ggml-quants.c
Original file line number Diff line number Diff line change
Expand Up @@ -3813,7 +3813,7 @@ void ggml_vec_dot_q4_0_q8_0(int n, float * restrict s, size_t bs, const void * r
return;
}
#endif
#if defined(__ARM_FEATURE_SVE)
#if (defined(__ARM_FEATURE_SVE) && defined(GGML_USE_SVE))
const svbool_t ptrueh = svptrue_pat_b8(SV_VL16);
const svbool_t ptruel = svnot_b_z(svptrue_b8(), ptrueh);

Expand Down Expand Up @@ -5421,7 +5421,7 @@ void ggml_vec_dot_q8_0_q8_0(int n, float * restrict s, size_t bs, const void * r
return;
}
#endif
#if defined(__ARM_FEATURE_SVE)
#if (defined(__ARM_FEATURE_SVE) && defined(GGML_USE_SVE))
svfloat32_t sumv0 = svdup_n_f32(0.0f);
svfloat32_t sumv1 = svdup_n_f32(0.0f);

Expand Down
2 changes: 1 addition & 1 deletion ggml/src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -21758,7 +21758,7 @@ int ggml_cpu_has_neon(void) {
}

int ggml_cpu_has_sve(void) {
#if defined(__ARM_FEATURE_SVE)
#if (defined(__ARM_FEATURE_SVE) && defined(GGML_USE_SVE))
// TODO: Currently, SVE 256 bit is only supported.
GGML_ASSERT(svcntb() == QK8_0);
return 1;
Expand Down

0 comments on commit 029deaf

Please sign in to comment.