mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-26 06:10:29 +01:00
build: add armv{6,7,8} support to cmake (#1251)
- flags copied from Makefile - updated comments in both CMakeLists.txt and Makefile to match reality
This commit is contained in:
parent
a5d30b1f53
commit
6f79699286
@ -258,9 +258,22 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES
|
|||||||
# TODO: arm msvc?
|
# TODO: arm msvc?
|
||||||
else()
|
else()
|
||||||
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
|
||||||
|
# Apple M1, M2, etc.
|
||||||
|
# Raspberry Pi 3, 4, Zero 2 (64-bit)
|
||||||
add_compile_options(-mcpu=native)
|
add_compile_options(-mcpu=native)
|
||||||
endif()
|
endif()
|
||||||
# TODO: armv6,7,8 version specific flags
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv6")
|
||||||
|
# Raspberry Pi 1, Zero
|
||||||
|
add_compile_options(-mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access)
|
||||||
|
endif()
|
||||||
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7")
|
||||||
|
# Raspberry Pi 2
|
||||||
|
add_compile_options(-mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations)
|
||||||
|
endif()
|
||||||
|
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv8")
|
||||||
|
# Raspberry Pi 3, 4, Zero 2 (32-bit)
|
||||||
|
add_compile_options(-mfp16-format=ieee -mno-unaligned-access)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$")
|
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$")
|
||||||
message(STATUS "x86 detected")
|
message(STATUS "x86 detected")
|
||||||
|
8
Makefile
8
Makefile
@ -135,19 +135,21 @@ ifdef LLAMA_PERF
|
|||||||
CXXFLAGS += -DGGML_PERF
|
CXXFLAGS += -DGGML_PERF
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter aarch64%,$(UNAME_M)),)
|
ifneq ($(filter aarch64%,$(UNAME_M)),)
|
||||||
|
# Apple M1, M2, etc.
|
||||||
|
# Raspberry Pi 3, 4, Zero 2 (64-bit)
|
||||||
CFLAGS += -mcpu=native
|
CFLAGS += -mcpu=native
|
||||||
CXXFLAGS += -mcpu=native
|
CXXFLAGS += -mcpu=native
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter armv6%,$(UNAME_M)),)
|
ifneq ($(filter armv6%,$(UNAME_M)),)
|
||||||
# Raspberry Pi 1, 2, 3
|
# Raspberry Pi 1, Zero
|
||||||
CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access
|
CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter armv7%,$(UNAME_M)),)
|
ifneq ($(filter armv7%,$(UNAME_M)),)
|
||||||
# Raspberry Pi 4
|
# Raspberry Pi 2
|
||||||
CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations
|
CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter armv8%,$(UNAME_M)),)
|
ifneq ($(filter armv8%,$(UNAME_M)),)
|
||||||
# Raspberry Pi 4
|
# Raspberry Pi 3, 4, Zero 2 (32-bit)
|
||||||
CFLAGS += -mfp16-format=ieee -mno-unaligned-access
|
CFLAGS += -mfp16-format=ieee -mno-unaligned-access
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user