From ff677758a3cd97b8c0fba9184a818cdbf6c4a672 Mon Sep 17 00:00:00 2001 From: Sunita Nadampalli Date: Wed, 31 Jan 2024 04:19:52 +0000 Subject: [PATCH] add MATMUL_INT8 capability to system_info --- common/common.cpp | 1 + ggml.c | 8 ++++++++ ggml.h | 1 + llama.cpp | 1 + 4 files changed, 11 insertions(+) diff --git a/common/common.cpp b/common/common.cpp index 0dd1c50cfb35a5..e01faf75c7cb99 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1531,6 +1531,7 @@ void dump_non_result_info_yaml(FILE * stream, const gpt_params & params, const l fprintf(stream, "cpu_has_blas: %s\n", ggml_cpu_has_blas() ? "true" : "false"); fprintf(stream, "cpu_has_sse3: %s\n", ggml_cpu_has_sse3() ? "true" : "false"); fprintf(stream, "cpu_has_vsx: %s\n", ggml_cpu_has_vsx() ? "true" : "false"); + fprintf(stream, "cpu_has_matmul_int8: %s\n", ggml_cpu_has_matmul_int8() ? "true" : "false"); #ifdef NDEBUG fprintf(stream, "debug: false\n"); diff --git a/ggml.c b/ggml.c index 1ba42c2dbf955e..dd2170271a497a 100644 --- a/ggml.c +++ b/ggml.c @@ -20579,4 +20579,12 @@ int ggml_cpu_has_vsx(void) { #endif } +int ggml_cpu_has_matmul_int8(void) { +#if defined(__ARM_FEATURE_MATMUL_INT8) + return 1; +#else + return 0; +#endif +} + //////////////////////////////////////////////////////////////////////////////// diff --git a/ggml.h b/ggml.h index 0ddfe7bf9ef61b..3830bbae114f16 100644 --- a/ggml.h +++ b/ggml.h @@ -2272,6 +2272,7 @@ extern "C" { GGML_API int ggml_cpu_has_ssse3 (void); GGML_API int ggml_cpu_has_sycl (void); GGML_API int ggml_cpu_has_vsx (void); + GGML_API int ggml_cpu_has_matmul_int8(void); // // Internal types and functions exposed for tests and benchmarks diff --git a/llama.cpp b/llama.cpp index a490eeab2fd7b4..894f091fd846c6 100644 --- a/llama.cpp +++ b/llama.cpp @@ -11417,6 +11417,7 @@ const char * llama_print_system_info(void) { s += "SSE3 = " + std::to_string(ggml_cpu_has_sse3()) + " | "; s += "SSSE3 = " + std::to_string(ggml_cpu_has_ssse3()) + " | "; s += "VSX = " + std::to_string(ggml_cpu_has_vsx()) + " | "; + s += "MATMUL_INT8 = " + std::to_string(ggml_cpu_has_matmul_int8()) + " | "; return s.c_str(); }