Skip to content

Commit

Permalink
ggml : detect SSSE3 (ggerganov#1211)
Browse files Browse the repository at this point in the history
* ggml : add ggml_cpu_has_ssse3

* whisper : show SSSE3 in system info

* make : detect SSSE3 via cpuinfo
  • Loading branch information
przemoc authored Aug 27, 2023
1 parent f6feb64 commit d832bad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions ggml.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

//
Expand Down
1 change: 1 addition & 0 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) + " | ";
Expand Down

0 comments on commit d832bad

Please sign in to comment.