Skip to content

Commit

Permalink
Add make target for Vulkan shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
bandoti committed Jun 25, 2024
1 parent dd198ce commit 491a967
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ ggml-metal-embed.metal
llama-batched-swift
out/
tmp/
ggml-vulkan-shaders.hpp
ggml-vulkan-shaders.cpp

# CI

Expand Down
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,26 @@ ifdef LLAMA_VULKAN_RUN_TESTS
MK_CPPFLAGS += -DGGML_VULKAN_RUN_TESTS
endif

ggml-vulkan.o: ggml-vulkan.cpp ggml-vulkan.h
PYTHON_CMD = python
GLSLC_CMD = glslc
_llama_vk_genshaders_cmd = $(PYTHON_CMD) ggml_vk_generate_shaders.py
_llama_vk_header = ggml-vulkan-shaders.hpp
_llama_vk_source = ggml-vulkan-shaders.cpp
_llama_vk_input_dir = vulkan-shaders
_llama_vk_shader_deps = $(echo $(_llama_vk_input_dir)/*.comp)

ggml-vulkan.o: ggml-vulkan.cpp ggml-vulkan.h $(_llama_vk_header) $(_llama_vk_source)
$(CXX) $(CXXFLAGS) -c $< -o $@

$(_llama_vk_header): $(_llama_vk_source)

$(_llama_vk_source): $(_llama_vk_shader_deps)
$(_llama_vk_genshaders_cmd) \
--glslc $(GLSLC_CMD) \
--input-dir $(_llama_vk_input_dir) \
--target-hpp $(_llama_vk_header) \
--target-cpp $(_llama_vk_source)

endif # LLAMA_VULKAN

ifdef LLAMA_HIPBLAS
Expand Down

0 comments on commit 491a967

Please sign in to comment.