Skip to content

Commit e227c75

Browse files
authored
fix vulkan builds
1 parent 313bf8a commit e227c75

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

.devcontainer/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM ubuntu:24.04
33
# Build arguments for optional components (default: disabled)
44
ARG INSTALL_CUDA=false
55
ARG INSTALL_ROCM=false
6+
ARG INSTALL_VULKAN=false
67
ARG INSTALL_PYTHON_DEPS=false
78

89
# Avoid prompts from apt
@@ -84,6 +85,18 @@ RUN if [ "$INSTALL_ROCM" = "true" ]; then \
8485
echo "Skipping ROCm installation"; \
8586
fi
8687

88+
# Install Vulkan SDK (conditional)
89+
RUN if [ "$INSTALL_VULKAN" = "true" ]; then \
90+
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | tee /etc/apt/trusted.gpg.d/lunarg.asc && \
91+
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list http://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list && \
92+
apt-get update && \
93+
apt-get install -y vulkan-sdk && \
94+
apt-get autoremove -y && \
95+
apt-get clean; \
96+
else \
97+
echo "Skipping Vulkan SDK installation"; \
98+
fi
99+
87100
# Install Python dependencies for gguf conversion tools (conditional)
88101
RUN if [ "$INSTALL_PYTHON_DEPS" = "true" ]; then \
89102
python3 -m pip install --break-system-packages \

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"args": {
66
// Enable/disable optional components (set to "true" to install)
77
"INSTALL_CUDA": "true",
8-
"INSTALL_ROCM": "true",
8+
"INSTALL_ROCM": "true",
9+
"INSTALL_VULKAN": "true",
910
"INSTALL_PYTHON_DEPS": "false"
1011
}
1112
},

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ static void * const vk_ptr_base = (void *)(uintptr_t) 0x1000; // NOLINT
13981398

13991399
static uint64_t vk_tensor_offset(const ggml_tensor * tensor) {
14001400
if (tensor->view_src) {
1401-
return (uint8_t *) tensor->tensor_data(view_src) - (uint8_t *) vk_ptr_base;
1401+
return (uint8_t *) tensor_data(tensor->view_src) - (uint8_t *) vk_ptr_base;
14021402
}
14031403
return (uint8_t *) tensor_data(tensor) - (uint8_t *) vk_ptr_base;
14041404
}
@@ -7356,7 +7356,7 @@ static void ggml_vk_flash_attn(ggml_backend_vk_context * ctx, vk_context& subctx
73567356
if (ctx->device->uma) {
73577357
ggml_vk_host_get(ctx->device, tensor_data(q), d_Q, q_buf_offset);
73587358
ggml_vk_host_get(ctx->device, tensor_data(k), d_K, k_buf_offset);
7359-
ggml_vk_host_get(ctx->device, v->data(), d_V, v_buf_offset);
7359+
ggml_vk_host_get(ctx->device, tensor_data(v), d_V, v_buf_offset);
73607360
ggml_vk_host_get(ctx->device, tensor_data(dst), d_D, d_buf_offset);
73617361
Q_uma = d_Q != nullptr;
73627362
K_uma = d_K != nullptr;
@@ -8555,7 +8555,7 @@ static void ggml_vk_multi_add(ggml_backend_vk_context * ctx, vk_context& subctx,
85558555
uma[i] = false;
85568556

85578557
if (ctx->device->uma) {
8558-
ggml_vk_host_get(ctx->device, tensors[i]->data, buf[i], offset[i]);
8558+
ggml_vk_host_get(ctx->device, tensor_data(tensors[i]), buf[i], offset[i]);
85598559
uma[i] = buf[i] != nullptr;
85608560
}
85618561
if (!uma[i]) {
@@ -8708,7 +8708,7 @@ static void ggml_vk_op_f32_wkv(ggml_backend_vk_context * ctx, vk_context& subctx
87088708

87098709
if (ctx->device->uma) {
87108710
for (int i = 0; i < num_srcs; i++) {
8711-
ggml_vk_host_get(ctx->device, dst->src[i]->data, d_srcs[i], src_offsets[i]);
8711+
ggml_vk_host_get(ctx->device, tensor_data(dst->src[i]), d_srcs[i], src_offsets[i]);
87128712
srcs_uma[i] = d_srcs[i] != nullptr;
87138713
}
87148714

0 commit comments

Comments
 (0)