whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

ppc64le and intrinsics

Open fitzsim opened this issue 1 year ago • 2 comments

ggml.c fails to compile on Debian ppc64le, GCC 11, with:

ggml.c:135:10: fatal error: immintrin.h: No such file or directory 135 | #include <immintrin.h>

If I comment out that line, the build succeeds and the output binary works.

fitzsim avatar Dec 08 '22 22:12 fitzsim

Should be better than commenting it out:

diff --git a/Makefile b/Makefile
index a52df41..3aa7657 100644
--- a/Makefile
+++ b/Makefile
@@ -27,8 +27,10 @@ endif
 # Compile flags
 #
 
-CFLAGS   = -I.              -O3 -std=c11   -fPIC
-CXXFLAGS = -I. -I./examples -O3 -std=c++11 -fPIC
+CC=clang
+CXX=clang++
+CFLAGS   = -I.              -O3 -std=c11   -fPIC -mcpu=native -DNO_WARN_X86_INTRINSICS
+CXXFLAGS = -I. -I./examples -O3 -std=c++11 -fPIC -mcpu=native -DNO_WARN_X86_INTRINSICS
 LDFLAGS  =
 
 # OS specific
diff --git a/ggml.c b/ggml.c
index 7c79129..881883a 100644
--- a/ggml.c
+++ b/ggml.c
@@ -133,6 +134,8 @@ ggml_fp16_t ggml_fp32_to_fp16(float x) {
 #include <wasm_simd128.h>
 #else
 #include <immintrin.h>
+#undef bool
+#define bool _Bool
 #endif
 
 // FP16 <-> FP32

luke-jr avatar Dec 10 '22 20:12 luke-jr

Looks like my patch builds, but doesn't actually use intrinsics :/

luke-jr avatar Dec 10 '22 22:12 luke-jr