Skip to content

Commit 8e93610

Browse files
build : support ppc64le build for make and CMake (ggml-org#3963)
* build: support ppc64le build for make and CMake * build: keep __POWER9_VECTOR__ ifdef and extend with __powerpc64__ Co-authored-by: Georgi Gerganov <[email protected]> --------- Co-authored-by: Georgi Gerganov <[email protected]>
1 parent 5ad387e commit 8e93610

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,12 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$" OR "${CMAKE_GE
574574
endif()
575575
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
576576
message(STATUS "PowerPC detected")
577-
add_compile_options(-mcpu=native -mtune=native)
578-
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
577+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
578+
add_compile_options(-mcpu=powerpc64le)
579+
else()
580+
add_compile_options(-mcpu=native -mtune=native)
581+
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
582+
endif()
579583
else()
580584
message(STATUS "Unknown architecture")
581585
endif()

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
342342
endif
343343
endif
344344

345+
ifneq ($(filter ppc64le%,$(UNAME_M)),)
346+
MK_CFLAGS += -mcpu=powerpc64le
347+
MK_CXXFLAGS += -mcpu=powerpc64le
348+
CUDA_POWER_ARCH = 1
349+
endif
350+
345351
else
346352
MK_CFLAGS += -march=rv64gcv -mabi=lp64d
347353
MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
@@ -392,6 +398,8 @@ else
392398
endif #LLAMA_CUDA_NVCC
393399
ifdef CUDA_DOCKER_ARCH
394400
NVCCFLAGS += -Wno-deprecated-gpu-targets -arch=$(CUDA_DOCKER_ARCH)
401+
else ifdef CUDA_POWER_ARCH
402+
NVCCFLAGS +=
395403
else
396404
NVCCFLAGS += -arch=native
397405
endif # CUDA_DOCKER_ARCH

ggml-quants.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifdef __wasm_simd128__
2020
#include <wasm_simd128.h>
2121
#else
22-
#ifdef __POWER9_VECTOR__
22+
#if defined(__POWER9_VECTOR__) || defined(__powerpc64__)
2323
#include <altivec.h>
2424
#undef bool
2525
#define bool _Bool

0 commit comments

Comments
 (0)