Skip to content

Commit cb86def

Browse files
committed
feat(vulkan): add vulkan support to llama.cpp
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent a181dd0 commit cb86def

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

.github/workflows/image-pr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,12 @@ jobs:
128128
runs-on: 'ubuntu-latest'
129129
base-image: "ubuntu:22.04"
130130
makeflags: "--jobs=4 --output-sync=target"
131+
- build-type: 'vulkan'
132+
platforms: 'linux/amd64'
133+
tag-latest: 'false'
134+
tag-suffix: '-vulkan-ffmpeg-core'
135+
ffmpeg: 'true'
136+
image-type: 'core'
137+
runs-on: 'ubuntu-latest'
138+
base-image: "ubuntu:22.04"
139+
makeflags: "--jobs=4 --output-sync=target"

.github/workflows/image.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,12 @@ jobs:
315315
runs-on: 'arc-runner-set'
316316
base-image: "ubuntu:22.04"
317317
makeflags: "--jobs=4 --output-sync=target"
318+
- build-type: 'vulkan'
319+
platforms: 'linux/amd64,linux/arm64'
320+
tag-latest: 'false'
321+
tag-suffix: '-vulkan-ffmpeg-core'
322+
ffmpeg: 'true'
323+
image-type: 'core'
324+
runs-on: 'arc-runner-set'
325+
base-image: "ubuntu:22.04"
326+
makeflags: "--jobs=4 --output-sync=target"

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ ARG CUDA_MINOR_VERSION=5
103103

104104
ENV BUILD_TYPE=${BUILD_TYPE}
105105

106+
# Vulkan requirements
107+
RUN <<EOT bash
108+
if [ "${BUILD_TYPE}" = "vulkan" ]; then
109+
apt-get update && \
110+
apt-get install -y --no-install-recommends \
111+
software-properties-common pciutils wget && \
112+
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key add - && \
113+
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list && \
114+
apt-get update && \
115+
apt-get install -y \
116+
vulkan-sdk && \
117+
apt-get clean && \
118+
rm -rf /var/lib/apt/lists/*
119+
fi
120+
EOT
121+
106122
# CuBLAS requirements
107123
RUN <<EOT bash
108124
if [ "${BUILD_TYPE}" = "cublas" ]; then

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ ifeq ($(BUILD_TYPE),cublas)
103103
CGO_LDFLAGS_WHISPER+=-L$(CUDA_LIBPATH)/stubs/ -lcuda -lcufft
104104
endif
105105

106+
ifeq ($(BUILD_TYPE),vulkan)
107+
CMAKE_ARGS+=-DLLAMA_VULKAN=1
108+
endif
109+
106110
ifeq ($(BUILD_TYPE),hipblas)
107111
ROCM_HOME ?= /opt/rocm
108112
ROCM_PATH ?= /opt/rocm

0 commit comments

Comments
 (0)