File tree Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ option(GGML_RVV "ggml: enable rvv" ON)
131131option (GGML_RV_ZFH "ggml: enable riscv zfh" OFF )
132132option (GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF )
133133option (GGML_VXE "ggml: enable vxe" ON )
134+ option (GGML_NNPA "ggml: enable nnpa" ON )
134135
135136option (GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF )
136137set (GGML_CPU_ARM_ARCH "" CACHE STRING "ggml: CPU architecture for ARM" )
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ extern "C" {
101101 GGML_BACKEND_API int ggml_cpu_has_riscv_v (void );
102102 GGML_BACKEND_API int ggml_cpu_has_vsx (void );
103103 GGML_BACKEND_API int ggml_cpu_has_vxe (void );
104+ GGML_BACKEND_API int ggml_cpu_has_nnpa (void );
104105 GGML_BACKEND_API int ggml_cpu_has_wasm_simd (void );
105106 GGML_BACKEND_API int ggml_cpu_has_llamafile (void );
106107
Original file line number Diff line number Diff line change @@ -427,6 +427,7 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
427427
428428 # TODO: Separation to determine activation of VX/VXE/VXE2
429429 if (${S390X_M} MATCHES "8561|8562" )
430+ set (GGML_NNPA OFF )
430431 message (STATUS "z15 target" )
431432 list (APPEND ARCH_FLAGS -march=z15)
432433 elseif (${S390X_M} MATCHES "3931" )
@@ -443,8 +444,14 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
443444 endif ()
444445
445446 if (GGML_VXE)
447+ message (STATUS "VX/VXE/VXE2 enabled" )
446448 list (APPEND ARCH_FLAGS -mvx -mzvector)
447449 endif ()
450+
451+ if (GGML_NNPA)
452+ target_compile_definitions (${GGML_CPU_NAME} PRIVATE GGML_NNPA)
453+ message (STATUS "NNPA enabled" )
454+ endif ()
448455 elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "wasm" )
449456 message (STATUS "Wasm detected" )
450457 list (APPEND GGML_CPU_SOURCES ggml-cpu/arch/wasm/quants.c)
Original file line number Diff line number Diff line change @@ -3364,6 +3364,14 @@ int ggml_cpu_has_vxe(void) {
33643364#endif
33653365}
33663366
3367+ int ggml_cpu_has_nnpa (void ) {
3368+ #if defined(GGML_NNPA )
3369+ return 1 ;
3370+ #else
3371+ return 0 ;
3372+ #endif
3373+ }
3374+
33673375int ggml_cpu_has_neon (void ) {
33683376#if defined(__ARM_ARCH ) && defined(__ARM_NEON )
33693377 return 1 ;
Original file line number Diff line number Diff line change @@ -578,6 +578,9 @@ static ggml_backend_feature * ggml_backend_cpu_get_features(ggml_backend_reg_t r
578578 if (ggml_cpu_has_vxe ()) {
579579 features.push_back ({ " VXE" , " 1" });
580580 }
581+ if (ggml_cpu_has_nnpa ()) {
582+ features.push_back ({ " NNPA" , " 1" });
583+ }
581584 if (ggml_cpu_has_wasm_simd ()) {
582585 features.push_back ({ " WASM_SIMD" , " 1" });
583586 }
You can’t perform that action at this time.
0 commit comments