]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
Add WHISPER_NO_AVX and WHISPER_NO_AVX2 to CMakeLists (#136)
authorChidi Williams <redacted>
Fri, 11 Nov 2022 16:10:01 +0000 (16:10 +0000)
committerGitHub <redacted>
Fri, 11 Nov 2022 16:10:01 +0000 (18:10 +0200)
* Check for AVX and AVX2 on Darwin

* Add AVX options to CMakeLists

CMakeLists.txt

index 38e4cd7b7196b736b11a7a38b5594045864924eb..301143d900926e09d32c5a94320111f47e261f79 100644 (file)
@@ -48,6 +48,8 @@ option(WHISPER_SUPPORT_SDL2            "whisper: support for libSDL2" OFF)
 
 if (APPLE)
     option(WHISPER_NO_ACCELERATE       "whisper: disable Accelerate framework" OFF)
+    option(WHISPER_NO_AVX              "whisper: disable AVX" OFF)
+    option(WHISPER_NO_AVX2             "whisper: disable AVX2" OFF)
 else()
     option(WHISPER_SUPPORT_OPENBLAS    "whisper: support for OpenBLAS" OFF)
 endif()
@@ -151,7 +153,13 @@ else()
             set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -pthread -msimd128")
             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
         else()
-            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx -mavx2 -mfma -mf16c")
+            if(NOT WHISPER_NO_AVX)
+                set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
+            endif()
+            if(NOT WHISPER_NO_AVX2)
+                set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
+            endif()
+            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma -mf16c")
         endif()
     endif()
 endif()