Skip to content

Commit 08e69bf

Browse files
committed
feat(makefile-workflow): add support for OpenCL and BLAS in LLAMA build options
1 parent cac28a0 commit 08e69bf

File tree

2 files changed

+76
-4
lines changed

2 files changed

+76
-4
lines changed

.github/workflows/main.yml

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,61 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
include:
18+
# Linux CPU builds
19+
- os: ubuntu-latest
20+
arch: x86_64
21+
name: linux-cpu
22+
make: LLAMA="-DGGML_NATIVE=ON"
23+
- os: ubuntu-latest
24+
arch: x86_64
25+
name: linux-cpu-avx2
26+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_AVX2=ON -DGGML_FMA=ON -DGGML_F16C=ON"
27+
- os: ubuntu-latest
28+
arch: x86_64
29+
name: linux-cpu-avx512
30+
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_AVX512=ON -DGGML_AVX512_VNNI=ON"
31+
32+
# Linux BLAS builds
33+
- os: ubuntu-latest
34+
arch: x86_64
35+
name: linux-openblas
36+
make: LLAMA="-DGGML_NATIVE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
37+
38+
# Linux GPU builds
1839
- os: ubuntu-latest
1940
arch: x86_64
2041
name: linux-vulkan
2142
make: LLAMA="-DGGML_NATIVE=OFF -DGGML_VULKAN=ON"
43+
- os: ubuntu-latest
44+
arch: x86_64
45+
name: linux-opencl
46+
make: LLAMA="-DGGML_NATIVE=ON -DGGML_OPENCL=ON"
47+
48+
# macOS builds
49+
- os: macos-latest
50+
name: macos-cpu
51+
make: LLAMA="-DGGML_NATIVE=ON"
2252
- os: macos-latest
23-
name: macos
53+
name: macos-metal
54+
make: LLAMA="-DGGML_NATIVE=ON -DGGML_METAL=ON" WHISPER="-DGGML_METAL=ON"
55+
- os: macos-latest
56+
name: macos-accelerate
57+
make: LLAMA="-DGGML_NATIVE=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple" WHISPER="-DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple"
58+
- os: macos-latest
59+
name: macos-coreml
60+
make: WHISPER="-DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON"
61+
62+
# Windows builds (commented out but ready to enable)
2463
# - os: windows-latest
2564
# arch: x86_64
26-
# name: windows
65+
# name: windows-cpu
66+
# make: LLAMA="-DGGML_NATIVE=ON"
67+
# - os: windows-latest
68+
# arch: x86_64
69+
# name: windows-vulkan
70+
# make: LLAMA="-DGGML_NATIVE=OFF -DGGML_VULKAN=ON"
71+
72+
# Android builds
2773
- os: ubuntu-latest
2874
arch: arm64-v8a
2975
name: android
@@ -33,6 +79,8 @@ jobs:
3379
name: android
3480
make: PLATFORM=android ARCH=x86_64
3581
sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
82+
83+
# iOS builds
3684
- os: macos-latest
3785
name: ios
3886
make: PLATFORM=ios
@@ -59,6 +107,22 @@ jobs:
59107
mingw-w64-x86_64-cmake
60108
make
61109
110+
- name: linux install dependencies
111+
if: startsWith(matrix.name, 'linux-')
112+
run: |
113+
sudo apt-get update -y
114+
sudo apt-get install -y build-essential wget git cmake sqlite3 libcurl4-openssl-dev
115+
116+
- name: linux install openblas
117+
if: matrix.name == 'linux-openblas'
118+
run: |
119+
sudo apt-get install -y libopenblas-dev
120+
121+
- name: linux install opencl
122+
if: matrix.name == 'linux-opencl'
123+
run: |
124+
sudo apt-get install -y opencl-headers ocl-icd-opencl-dev
125+
62126
- name: linux install vulkan
63127
if: matrix.name == 'linux-vulkan'
64128
run: |
@@ -90,7 +154,7 @@ jobs:
90154
run: choco install sqlite -y
91155

92156
- name: macos install sqlite3 without SQLITE_OMIT_LOAD_EXTENSION
93-
if: matrix.name == 'macos'
157+
if: startsWith(matrix.name, 'macos-')
94158
run: brew link sqlite --force
95159

96160
- name: android setup test environment
@@ -136,7 +200,7 @@ jobs:
136200
adb shell "sh /data/local/tmp/commands.sh"
137201
138202
- name: test sqlite-ai
139-
if: contains(matrix.name, 'linux') || contains(matrix.name, 'windows') || contains(matrix.name, 'macos')
203+
if: startsWith(matrix.name, 'linux-') || startsWith(matrix.name, 'windows-') || startsWith(matrix.name, 'macos-')
140204
run: make test
141205

142206
- uses: actions/[email protected]

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ ifneq (,$(findstring VULKAN,$(LLAMA)))
139139
LLAMA_LDFLAGS += -ldl
140140
endif
141141
endif
142+
ifneq (,$(findstring OPENCL,$(LLAMA)))
143+
LLAMA_LIBS += $(BUILD_LLAMA)/ggml/src/ggml-opencl/libggml-opencl.a
144+
LLAMA_LDFLAGS += -L./$(BUILD_LLAMA)/ggml/src/ggml-opencl -lggml-opencl -lOpenCL
145+
endif
146+
ifneq (,$(findstring BLAS,$(LLAMA)))
147+
LLAMA_LIBS += $(BUILD_LLAMA)/ggml/src/ggml-blas/libggml-blas.a
148+
LLAMA_LDFLAGS += -L./$(BUILD_LLAMA)/ggml/src/ggml-blas -lggml-blas
149+
endif
142150

143151
# Windows .def file generation
144152
$(DEF_FILE):

0 commit comments

Comments
 (0)