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)
131
131
option (GGML_RV_ZFH "ggml: enable riscv zfh" OFF )
132
132
option (GGML_XTHEADVECTOR "ggml: enable xtheadvector" OFF )
133
133
option (GGML_VXE "ggml: enable vxe" ON )
134
+ option (GGML_NNPA "ggml: enable nnpa" ON )
134
135
135
136
option (GGML_CPU_ALL_VARIANTS "ggml: build all variants of the CPU backend (requires GGML_BACKEND_DL)" OFF )
136
137
set (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" {
101
101
GGML_BACKEND_API int ggml_cpu_has_riscv_v (void );
102
102
GGML_BACKEND_API int ggml_cpu_has_vsx (void );
103
103
GGML_BACKEND_API int ggml_cpu_has_vxe (void );
104
+ GGML_BACKEND_API int ggml_cpu_has_nnpa (void );
104
105
GGML_BACKEND_API int ggml_cpu_has_wasm_simd (void );
105
106
GGML_BACKEND_API int ggml_cpu_has_llamafile (void );
106
107
Original file line number Diff line number Diff line change @@ -427,6 +427,7 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
427
427
428
428
# TODO: Separation to determine activation of VX/VXE/VXE2
429
429
if (${S390X_M} MATCHES "8561|8562" )
430
+ set (GGML_NNPA OFF )
430
431
message (STATUS "z15 target" )
431
432
list (APPEND ARCH_FLAGS -march=z15 )
432
433
elseif (${S390X_M} MATCHES "3931" )
@@ -443,8 +444,14 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
443
444
endif ()
444
445
445
446
if (GGML_VXE )
447
+ message (STATUS "VX/VXE/VXE2 enabled" )
446
448
list (APPEND ARCH_FLAGS -mvx -mzvector )
447
449
endif ()
450
+
451
+ if (GGML_NNPA )
452
+ target_compile_definitions (${GGML_CPU_NAME} PRIVATE GGML_NNPA )
453
+ message (STATUS "NNPA enabled" )
454
+ endif ()
448
455
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "wasm" )
449
456
message (STATUS "Wasm detected" )
450
457
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) {
3364
3364
#endif
3365
3365
}
3366
3366
3367
+ int ggml_cpu_has_nnpa (void ) {
3368
+ #if defined(GGML_NNPA )
3369
+ return 1 ;
3370
+ #else
3371
+ return 0 ;
3372
+ #endif
3373
+ }
3374
+
3367
3375
int ggml_cpu_has_neon (void ) {
3368
3376
#if defined(__ARM_ARCH ) && defined(__ARM_NEON )
3369
3377
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
578
578
if (ggml_cpu_has_vxe ()) {
579
579
features.push_back ({ " VXE" , " 1" });
580
580
}
581
+ if (ggml_cpu_has_nnpa ()) {
582
+ features.push_back ({ " NNPA" , " 1" });
583
+ }
581
584
if (ggml_cpu_has_wasm_simd ()) {
582
585
features.push_back ({ " WASM_SIMD" , " 1" });
583
586
}
You can’t perform that action at this time.
0 commit comments