]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
ggml : detect SSSE3 (#1211)
authorPrzemysław Pawełczyk <redacted>
Sun, 27 Aug 2023 18:36:41 +0000 (20:36 +0200)
committerGitHub <redacted>
Sun, 27 Aug 2023 18:36:41 +0000 (21:36 +0300)
* ggml : add ggml_cpu_has_ssse3

* whisper : show SSSE3 in system info

* make : detect SSSE3 via cpuinfo

Makefile
ggml.c
ggml.h
whisper.cpp

index 89c3b7ef328196fb9c42ea5e5f0f4edd356680e6..58cd859220baa200b3018acde3a69725c7646561 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -104,6 +104,11 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686))
                ifneq (,$(findstring sse3,$(SSE3_M)))
                        CFLAGS += -msse3
                endif
+
+               SSSE3_M := $(shell $(CPUINFO_CMD) | grep -m 1 "ssse3 ")
+               ifneq (,$(findstring ssse3,$(SSSE3_M)))
+                       CFLAGS += -mssse3
+               endif
        endif
 endif
 ifeq ($(UNAME_M),amd64)
diff --git a/ggml.c b/ggml.c
index 5149a1572353912e69a3acb8eb633ceb0bc69854..70bbbad4d0d986c1ee6aee131cf7aacb3383a214 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -18721,6 +18721,14 @@ int ggml_cpu_has_sse3(void) {
 #endif
 }
 
+int ggml_cpu_has_ssse3(void) {
+#if defined(__SSSE3__)
+    return 1;
+#else
+    return 0;
+#endif
+}
+
 int ggml_cpu_has_vsx(void) {
 #if defined(__POWER9_VECTOR__)
     return 1;
diff --git a/ggml.h b/ggml.h
index 0af96c76b6d0ecd4951c6dc6b8b5e3959bfc3d0b..29884166edc7a4df6103abad3cd6b2a7e0043de2 100644 (file)
--- a/ggml.h
+++ b/ggml.h
@@ -1508,6 +1508,7 @@ extern "C" {
     GGML_API int ggml_cpu_has_clblast    (void);
     GGML_API int ggml_cpu_has_gpublas    (void);
     GGML_API int ggml_cpu_has_sse3       (void);
+    GGML_API int ggml_cpu_has_ssse3      (void);
     GGML_API int ggml_cpu_has_vsx        (void);
 
     //
index e7f760b6072e66f56b93386fb0fb924f0c26550b..1a74a7b52b7f8cb8bf121a62ff164c4ff49be494 100644 (file)
@@ -3480,6 +3480,7 @@ const char * whisper_print_system_info(void) {
     s += "WASM_SIMD = " + std::to_string(ggml_cpu_has_wasm_simd()) + " | ";
     s += "BLAS = "      + std::to_string(ggml_cpu_has_blas())      + " | ";
     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 += "COREML = "    + std::to_string(whisper_has_coreml())     + " | ";
     s += "OPENVINO = "  + std::to_string(whisper_has_openvino())   + " | ";