]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
build : support ppc64le build for make and CMake (#3963)
authorRoger Meier <redacted>
Fri, 17 Nov 2023 16:11:23 +0000 (17:11 +0100)
committerGitHub <redacted>
Fri, 17 Nov 2023 16:11:23 +0000 (18:11 +0200)
* build: support ppc64le build for make and CMake

* build: keep __POWER9_VECTOR__ ifdef and extend with __powerpc64__

Co-authored-by: Georgi Gerganov <redacted>
---------

Co-authored-by: Georgi Gerganov <redacted>
CMakeLists.txt
Makefile
ggml-quants.c

index db1f42f1eda6a71660e146020a2c704404b37520..f32df5fe52335ede2d939d7e29a52d163f1dde7d 100644 (file)
@@ -574,8 +574,12 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$" OR "${CMAKE_GE
     endif()
 elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
     message(STATUS "PowerPC detected")
-    add_compile_options(-mcpu=native -mtune=native)
-    #TODO: Add  targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
+    if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
+        add_compile_options(-mcpu=powerpc64le)
+    else()
+        add_compile_options(-mcpu=native -mtune=native)
+        #TODO: Add  targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
+    endif()
 else()
     message(STATUS "Unknown architecture")
 endif()
index 36d08811e32b6dca54372c8c759959e8296b66bd..7150dbaf602947391331fb2f7e85f92e1ce3e3f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -342,6 +342,12 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
        endif
 endif
 
+ifneq ($(filter ppc64le%,$(UNAME_M)),)
+       MK_CFLAGS   += -mcpu=powerpc64le
+       MK_CXXFLAGS += -mcpu=powerpc64le
+       CUDA_POWER_ARCH = 1
+endif
+
 else
        MK_CFLAGS   += -march=rv64gcv -mabi=lp64d
        MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
@@ -392,6 +398,8 @@ else
 endif #LLAMA_CUDA_NVCC
 ifdef CUDA_DOCKER_ARCH
        NVCCFLAGS += -Wno-deprecated-gpu-targets -arch=$(CUDA_DOCKER_ARCH)
+else ifdef CUDA_POWER_ARCH
+       NVCCFLAGS +=
 else
        NVCCFLAGS += -arch=native
 endif # CUDA_DOCKER_ARCH
index cf2860b8cbd5924c3da459a5feb78541dd120323..7285d5f7fbcc00ce41b5d481b702ecc52c5671f6 100644 (file)
@@ -19,7 +19,7 @@
 #ifdef __wasm_simd128__
 #include <wasm_simd128.h>
 #else
-#ifdef __POWER9_VECTOR__
+#if defined(__POWER9_VECTOR__) || defined(__powerpc64__)
 #include <altivec.h>
 #undef bool
 #define bool _Bool