Skip to content

Commit 7c7836d

Browse files
authored
Vulkan Shader Refactor, Memory Debugging Option (#7947)
* Refactor shaders, extract GLSL code from ggml_vk_generate_shaders.py into vulkan-shaders directory * Improve debug log code * Add memory debug output option * Fix flake8 * Fix unnecessary high llama-3 VRAM use
1 parent 0c7b359 commit 7c7836d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+30601
-27220
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ option(LLAMA_HIP_UMA "llama: use HIP unified memory arch
119119
option(LLAMA_VULKAN "llama: use Vulkan" OFF)
120120
option(LLAMA_VULKAN_CHECK_RESULTS "llama: run Vulkan op checks" OFF)
121121
option(LLAMA_VULKAN_DEBUG "llama: enable Vulkan debug output" OFF)
122+
option(LLAMA_VULKAN_MEMORY_DEBUG "llama: enable Vulkan memory debug output" OFF)
122123
option(LLAMA_VULKAN_VALIDATE "llama: enable Vulkan validation" OFF)
123124
option(LLAMA_VULKAN_RUN_TESTS "llama: run Vulkan tests" OFF)
124125
option(LLAMA_METAL "llama: use Metal" ${LLAMA_METAL_DEFAULT})
@@ -534,6 +535,10 @@ if (LLAMA_VULKAN)
534535
add_compile_definitions(GGML_VULKAN_DEBUG)
535536
endif()
536537

538+
if (LLAMA_VULKAN_MEMORY_DEBUG)
539+
add_compile_definitions(GGML_VULKAN_MEMORY_DEBUG)
540+
endif()
541+
537542
if (LLAMA_VULKAN_VALIDATE)
538543
add_compile_definitions(GGML_VULKAN_VALIDATE)
539544
endif()

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ ifdef LLAMA_VULKAN_DEBUG
608608
MK_CPPFLAGS += -DGGML_VULKAN_DEBUG
609609
endif
610610

611+
ifdef LLAMA_VULKAN_MEMORY_DEBUG
612+
MK_CPPFLAGS += -DGGML_VULKAN_MEMORY_DEBUG
613+
endif
614+
611615
ifdef LLAMA_VULKAN_VALIDATE
612616
MK_CPPFLAGS += -DGGML_VULKAN_VALIDATE
613617
endif

ggml-vulkan-shaders.hpp

Lines changed: 27564 additions & 23876 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)