Skip to content

Commit ee3c777

Browse files
build: support ppc64le build for make and CMake
1 parent 3d48f42 commit ee3c777

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,12 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$" OR "${CMAKE_GE
565565
endif()
566566
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
567567
message(STATUS "PowerPC detected")
568-
add_compile_options(-mcpu=native -mtune=native)
569-
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
568+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
569+
add_compile_options(-mcpu=powerpc64le)
570+
else()
571+
add_compile_options(-mcpu=native -mtune=native)
572+
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
573+
endif()
570574
else()
571575
message(STATUS "Unknown architecture")
572576
endif()

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
337337
endif
338338
endif
339339

340+
ifneq ($(filter ppc64le%,$(UNAME_M)),)
341+
MK_CFLAGS += -mcpu=powerpc64le
342+
MK_CXXFLAGS += -mcpu=powerpc64le
343+
CUDA_POWER_ARCH = 1
344+
endif
345+
340346
else
341347
MK_CFLAGS += -march=rv64gcv -mabi=lp64d
342348
MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
@@ -387,6 +393,8 @@ else
387393
endif #LLAMA_CUDA_NVCC
388394
ifdef CUDA_DOCKER_ARCH
389395
NVCCFLAGS += -Wno-deprecated-gpu-targets -arch=$(CUDA_DOCKER_ARCH)
396+
else ifdef CUDA_POWER_ARCH
397+
NVCCFLAGS +=
390398
else
391399
NVCCFLAGS += -arch=native
392400
endif # CUDA_DOCKER_ARCH

ggml-quants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ inline static int32_t vaddvq_s32(int32x4_t v) {
3939
#ifdef __wasm_simd128__
4040
#include <wasm_simd128.h>
4141
#else
42-
#ifdef __POWER9_VECTOR__
42+
#ifdef __powerpc64__
4343
#include <altivec.h>
4444
#undef bool
4545
#define bool _Bool

0 commit comments

Comments
 (0)