mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-06-26 11:45:21 +00:00
ggml-cpu: add nnpa compile flag
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
This commit is contained in:
@ -131,6 +131,7 @@ option(GGML_RVV "ggml: enable rvv" ON)
|
|||||||
option(GGML_RV_ZFH "ggml: enable riscv zfh" OFF)
|
option(GGML_RV_ZFH "ggml: enable riscv zfh" OFF)
|
||||||
option(GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF)
|
option(GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF)
|
||||||
option(GGML_VXE "ggml: enable vxe" ON)
|
option(GGML_VXE "ggml: enable vxe" ON)
|
||||||
|
option(GGML_NNPA "ggml: enable nnpa" ON)
|
||||||
|
|
||||||
option(GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF)
|
option(GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF)
|
||||||
set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM")
|
set(GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM")
|
||||||
|
@ -101,6 +101,7 @@ extern "C" {
|
|||||||
GGML_BACKEND_API int ggml_cpu_has_riscv_v (void);
|
GGML_BACKEND_API int ggml_cpu_has_riscv_v (void);
|
||||||
GGML_BACKEND_API int ggml_cpu_has_vsx (void);
|
GGML_BACKEND_API int ggml_cpu_has_vsx (void);
|
||||||
GGML_BACKEND_API int ggml_cpu_has_vxe (void);
|
GGML_BACKEND_API int ggml_cpu_has_vxe (void);
|
||||||
|
GGML_BACKEND_API int ggml_cpu_has_nnpa (void);
|
||||||
GGML_BACKEND_API int ggml_cpu_has_wasm_simd (void);
|
GGML_BACKEND_API int ggml_cpu_has_wasm_simd (void);
|
||||||
GGML_BACKEND_API int ggml_cpu_has_llamafile (void);
|
GGML_BACKEND_API int ggml_cpu_has_llamafile (void);
|
||||||
|
|
||||||
|
@ -427,6 +427,7 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
|
|||||||
|
|
||||||
# TODO: Separation to determine activation of VX/VXE/VXE2
|
# TODO: Separation to determine activation of VX/VXE/VXE2
|
||||||
if (${S390X_M} MATCHES "8561|8562")
|
if (${S390X_M} MATCHES "8561|8562")
|
||||||
|
set(GGML_NNPA OFF)
|
||||||
message(STATUS "z15 target")
|
message(STATUS "z15 target")
|
||||||
list(APPEND ARCH_FLAGS -march=z15)
|
list(APPEND ARCH_FLAGS -march=z15)
|
||||||
elseif (${S390X_M} MATCHES "3931")
|
elseif (${S390X_M} MATCHES "3931")
|
||||||
@ -443,8 +444,14 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GGML_VXE)
|
if (GGML_VXE)
|
||||||
|
message(STATUS "VX/VXE/VXE2 enabled")
|
||||||
list(APPEND ARCH_FLAGS -mvx -mzvector)
|
list(APPEND ARCH_FLAGS -mvx -mzvector)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (GGML_NNPA)
|
||||||
|
target_compile_definitions(${GGML_CPU_NAME} PRIVATE GGML_NNPA)
|
||||||
|
message(STATUS "NNPA enabled")
|
||||||
|
endif()
|
||||||
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "wasm")
|
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "wasm")
|
||||||
message(STATUS "Wasm detected")
|
message(STATUS "Wasm detected")
|
||||||
list (APPEND GGML_CPU_SOURCES ggml-cpu/arch/wasm/quants.c)
|
list (APPEND GGML_CPU_SOURCES ggml-cpu/arch/wasm/quants.c)
|
||||||
|
@ -3364,6 +3364,14 @@ int ggml_cpu_has_vxe(void) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ggml_cpu_has_nnpa(void) {
|
||||||
|
#if defined(GGML_NNPA)
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int ggml_cpu_has_neon(void) {
|
int ggml_cpu_has_neon(void) {
|
||||||
#if defined(__ARM_ARCH) && defined(__ARM_NEON)
|
#if defined(__ARM_ARCH) && defined(__ARM_NEON)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -578,6 +578,9 @@ static ggml_backend_feature * ggml_backend_cpu_get_features(ggml_backend_reg_t r
|
|||||||
if (ggml_cpu_has_vxe()) {
|
if (ggml_cpu_has_vxe()) {
|
||||||
features.push_back({ "VXE", "1" });
|
features.push_back({ "VXE", "1" });
|
||||||
}
|
}
|
||||||
|
if (ggml_cpu_has_nnpa()) {
|
||||||
|
features.push_back({ "NNPA", "1" });
|
||||||
|
}
|
||||||
if (ggml_cpu_has_wasm_simd()) {
|
if (ggml_cpu_has_wasm_simd()) {
|
||||||
features.push_back({ "WASM_SIMD", "1" });
|
features.push_back({ "WASM_SIMD", "1" });
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user