Skip to content

Commit dadfd96

Browse files
committed
Use compiler to determine best optimizations for platform
1 parent 4c0787b commit dadfd96

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- name: Install dependencies
7474
run: |
7575
python3 -m pip install --upgrade pip
76-
CMAKE_ARGS="-DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX512_VBMI=OFF -DLLAMA_AVX512_VNNI=OFF -DLLAMA_FMA=OFF -DLLAMA_F16C=OFF -DLLAMA_ACCELERATE=OFF -DLLAMA_METAL=OFF" python3 -m pip install .[all] --verbose --config-settings=cmake.verbose=true --config-settings=logging.level=INFO
76+
python3 -m pip install .[all] --verbose
7777
- name: Test with pytest
7878
run: |
7979
python3 -m pytest

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ project(llama_cpp)
44

55
option(BUILD_LLAMA_CPP "Build llama.cpp shared library and install alongside python package" ON)
66

7+
if (APPLE)
8+
set(LLAMA_AVX ON CACHE BOOL)
9+
set(LLAMA_AVX2 OFF CACHE BOOL)
10+
set(LLAMA_FMA OFF CACHE BOOL)
11+
set(LLAMA_F16C OFF CACHE BOOL)
12+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native")
13+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
14+
endif()
715

816
if (BUILD_LLAMA_CPP)
917
set(BUILD_SHARED_LIBS "On")

0 commit comments

Comments
 (0)