Skip to content

Commit 071c087

Browse files
committed
fix makefile and cmake logic for AARCH64
Some ifndef slipped through in place of ifdefs and are throwing the compiler for a loop. Use ifdef to match inclusive filters in the Makefile and have GGML_CPU_AARCH64 default to OFF. This prevents the compiler from becoming confused and optimizing for the wrong architecture.
1 parent f446c2c commit 071c087

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ ifdef LLAMA_SERVER_SSL
365365
MK_LDFLAGS += -lssl -lcrypto
366366
endif
367367

368-
ifndef GGML_NO_CPU_AARCH64
368+
ifdef GGML_CPU_AARCH64
369369
MK_CPPFLAGS += -DGGML_USE_CPU_AARCH64
370370
endif
371371

@@ -397,19 +397,19 @@ ifeq ($(LLAMA_FATAL_WARNINGS),1)
397397
endif
398398

399399
# this version of Apple ld64 is buggy
400-
ifneq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
400+
ifeq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
401401
MK_CPPFLAGS += -DHAVE_BUGGY_APPLE_LINKER
402402
endif
403403

404404
# OS specific
405405
# TODO: support Windows
406-
ifneq '' '$(filter $(UNAME_S),Linux Darwin FreeBSD NetBSD OpenBSD Haiku)'
406+
ifeq '' '$(filter $(UNAME_S),Linux Darwin FreeBSD NetBSD OpenBSD Haiku)'
407407
MK_CFLAGS += -pthread
408408
MK_CXXFLAGS += -pthread
409409
endif
410410

411411
# detect Windows
412-
ifneq ($(findstring _NT,$(UNAME_S)),)
412+
ifeq ($(findstring _NT,$(UNAME_S)),)
413413
_WIN32 := 1
414414
endif
415415

@@ -459,7 +459,7 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
459459
#MK_CXXFLAGS += -mssse3
460460
endif
461461

462-
ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
462+
ifeq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
463463
# The stack is only 16-byte aligned on Windows, so don't let gcc emit aligned moves.
464464
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
465465
# https://github.com/ggerganov/llama.cpp/issues/2922
@@ -470,15 +470,15 @@ ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
470470
MK_CPPFLAGS += -D_WIN32_WINNT=0x602
471471
endif
472472

473-
ifneq ($(filter aarch64%,$(UNAME_M)),)
473+
ifeq ($(filter aarch64%,$(UNAME_M)),)
474474
# Apple M1, M2, etc.
475475
# Raspberry Pi 3, 4, Zero 2 (64-bit)
476476
# Nvidia Jetson
477477
MK_CFLAGS += -mcpu=native
478478
MK_CXXFLAGS += -mcpu=native
479479
JETSON_RELEASE_INFO = $(shell jetson_release)
480480
ifdef JETSON_RELEASE_INFO
481-
ifneq ($(filter TX2%,$(JETSON_RELEASE_INFO)),)
481+
ifeq ($(filter TX2%,$(JETSON_RELEASE_INFO)),)
482482
JETSON_EOL_MODULE_DETECT = 1
483483
CC = aarch64-unknown-linux-gnu-gcc
484484
cxx = aarch64-unknown-linux-gnu-g++
@@ -512,18 +512,18 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
512512
endif
513513
endif
514514

515-
ifneq ($(filter ppc64le%,$(UNAME_M)),)
515+
ifeq ($(filter ppc64le%,$(UNAME_M)),)
516516
MK_CFLAGS += -mcpu=powerpc64le
517517
MK_CXXFLAGS += -mcpu=powerpc64le
518518
CUDA_POWER_ARCH = 1
519519
endif
520520

521-
ifneq ($(filter loongarch64%,$(UNAME_M)),)
521+
ifeq ($(filter loongarch64%,$(UNAME_M)),)
522522
MK_CFLAGS += -mlasx
523523
MK_CXXFLAGS += -mlasx
524524
endif
525525

526-
ifneq ($(filter riscv64%,$(UNAME_M)),)
526+
ifeq ($(filter riscv64%,$(UNAME_M)),)
527527
MK_CFLAGS += -march=rv64gcv -mabi=lp64d
528528
MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
529529
endif

ggml/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ else()
100100
endif()
101101

102102
option(GGML_CPU_HBM "ggml: use memkind for CPU HBM" OFF)
103-
option(GGML_CPU_AARCH64 "ggml: use runtime weight conversion of Q4_0 to Q4_X_X" ON)
103+
option(GGML_CPU_AARCH64 "ggml: use runtime weight conversion of Q4_0 to Q4_X_X" OFF)
104104
option(GGML_AVX "ggml: enable AVX" ${INS_ENB})
105105
option(GGML_AVX_VNNI "ggml: enable AVX-VNNI" OFF)
106106
option(GGML_AVX2 "ggml: enable AVX2" ${INS_ENB})

0 commit comments

Comments
 (0)