Skip to content

Commit 6ebd60b

Browse files
authored
Merge pull request #794 from m0nsky/vulkan_build_actions
Add the github build actions for Vulkan
2 parents 2990b47 + 8907042 commit 6ebd60b

File tree

1 file changed

+78
-2
lines changed

1 file changed

+78
-2
lines changed

.github/workflows/compile.yml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,79 @@ jobs:
100100
path: .\build\bin\Release\llava_shared.dll
101101
name: llava-bin-win-${{ matrix.build }}-x64.dll
102102

103+
compile-vulkan:
104+
name: Compile (vulkan) - ${{ matrix.os }}
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
os: [
109+
ubuntu-22.04,
110+
windows-latest
111+
]
112+
env:
113+
VULKAN_VERSION: 1.3.261.1
114+
runs-on: ${{ matrix.os }}
115+
steps:
116+
- name: Clone
117+
id: checkout
118+
uses: actions/checkout@v4
119+
with:
120+
repository: ggerganov/llama.cpp
121+
122+
- name: Download dependencies - Linux
123+
if: ${{ matrix.os == 'ubuntu-22.04' }}
124+
run: |
125+
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
126+
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
127+
sudo apt update
128+
sudo apt install vulkan-sdk
129+
- name: Download dependencies - Windows
130+
id: get_vulkan
131+
if: ${{ matrix.os == 'windows-latest' }}
132+
run: |
133+
curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
134+
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
135+
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
136+
Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
137+
- name: Build
138+
id: cmake_build
139+
if: ${{ matrix.os == 'windows-latest' }}
140+
run: |
141+
mkdir build
142+
cd build
143+
cmake .. ${{ env.COMMON_DEFINE }} -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/vulkan"
144+
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
145+
#copy $env:RUNNER_TEMP/clblast/lib/clblast.dll .\bin\Release\clblast.dll
146+
# # We should probably generate a sha256 sum in a file, and use that.
147+
# echo "78a8c98bcb2efe1a63318d901ab204d9ba96c3b29707b4ce0c4240bdcdc698d6 ./bin/Release/clblast.dll" >> tmp
148+
# sha256sum -c tmp || exit 255
149+
# rm tmp
150+
ls -R
151+
- name: Build
152+
if: ${{ matrix.os == 'ubuntu-22.04' }}
153+
run: |
154+
mkdir build
155+
cd build
156+
cmake .. ${{ env.COMMON_DEFINE }} -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=ON
157+
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
158+
# if we ever want to pull libvulkan.so back into the packages, just uncomment this line, and the one below for the upload
159+
# cp $(ldconfig -p | grep libvulkan.so | tail -n 1 | cut -d ' ' -f 4) ./
160+
ls -R
161+
- name: Upload artifacts (Windows)
162+
if: ${{ matrix.os == 'windows-latest' }}
163+
uses: actions/upload-artifact@v4
164+
with:
165+
path: |
166+
.\build\bin\Release\llama.dll
167+
name: llama-bin-win-vulkan-x64.dll
168+
- name: Upload artifacts (linux)
169+
if: ${{ matrix.os == 'ubuntu-22.04' }}
170+
uses: actions/upload-artifact@v4
171+
with:
172+
path: |
173+
./build/libllama.so
174+
name: llama-bin-linux-vulkan-x64.so
175+
103176
compile-cublas:
104177
name: Compile (cublas)
105178
strategy:
@@ -223,7 +296,8 @@ jobs:
223296
"compile-linux",
224297
"compile-macos",
225298
"compile-windows",
226-
"compile-cublas"
299+
"compile-cublas",
300+
"compile-vulkan"
227301
]
228302
steps:
229303
- uses: actions/download-artifact@v4
@@ -234,7 +308,7 @@ jobs:
234308
- name: Rearrange Files
235309
run: |
236310
# Make all directories at once
237-
mkdir --parents deps/{avx,avx2,avx512,osx-arm64,osx-x64,osx-x64-rosetta2,cu11.7.1,cu12.1.0}
311+
mkdir --parents deps/{avx,avx2,avx512,osx-arm64,osx-x64,osx-x64-rosetta2,cu11.7.1,cu12.1.0,vulkan}
238312
239313
cp artifacts/llama-bin-linux-noavx-x64.so/libllama.so deps/libllama.so
240314
cp artifacts/llama-bin-linux-avx-x64.so/libllama.so deps/avx/libllama.so
@@ -279,6 +353,8 @@ jobs:
279353
cp artifacts/llama-bin-linux-cublas-cu12.1.0-x64.so/libllama.so deps/cu12.1.0/libllama.so
280354
cp artifacts/llava-bin-linux-cublas-cu12.1.0-x64.so/libllava_shared.so deps/cu12.1.0/libllava_shared.so
281355
356+
cp artifacts/llama-bin-win-vulkan-x64.dll/llama.dll deps/vulkan/
357+
cp artifacts/llama-bin-linux-vulkan-x64.so/libllama.so deps/vulkan/
282358
283359
- name: Upload artifacts
284360
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)