added NO_VULKAN_EXTENSIONS flag to disable dp4a and coopmat if needed

This commit is contained in:
Concedo 2025-04-03 20:51:17 +08:00
parent 07a96d63fa
commit 8c74520586
3 changed files with 11 additions and 2 deletions

View file

@ -392,6 +392,9 @@ endif
endif endif
endif endif
ifdef NO_VULKAN_EXTENSIONS
VKGEN_ADD = -DNO_VULKAN_EXTENSIONS
endif
# #
# Print build information # Print build information
@ -585,7 +588,7 @@ ggml_v3-opencl.o: otherarch/ggml_v3-opencl.cpp otherarch/ggml_v3-opencl.h
#vulkan #vulkan
ggml-vulkan.o: ggml/src/ggml-vulkan/ggml-vulkan.cpp ggml/include/ggml-vulkan.h ggml/src/ggml-vulkan-shaders.cpp ggml-vulkan.o: ggml/src/ggml-vulkan/ggml-vulkan.cpp ggml/include/ggml-vulkan.h ggml/src/ggml-vulkan-shaders.cpp
$(CXX) $(CXXFLAGS) $(VULKAN_FLAGS) -c $< -o $@ $(CXX) $(CXXFLAGS) $(VKGEN_ADD) $(VULKAN_FLAGS) -c $< -o $@
# intermediate objects # intermediate objects
llama.o: src/llama.cpp ggml/include/ggml.h ggml/include/ggml-alloc.h ggml/include/ggml-backend.h ggml/include/ggml-cuda.h ggml/include/ggml-metal.h include/llama.h otherarch/llama-util.h llama.o: src/llama.cpp ggml/include/ggml.h ggml/include/ggml-alloc.h ggml/include/ggml-backend.h ggml/include/ggml-cuda.h ggml/include/ggml-metal.h include/llama.h otherarch/llama-util.h
@ -666,15 +669,17 @@ endif
vulkan-shaders-gen: ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp vulkan-shaders-gen: ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp
@echo 'Vulkan shaders need to be regenerated. This can only be done on Windows or Linux. Please stand by...' @echo 'Vulkan shaders need to be regenerated. This can only be done on Windows or Linux. Please stand by...'
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) $(CXX) $(CXXFLAGS) $(VKGEN_ADD) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@echo 'Now rebuilding vulkan shaders for Windows...' @echo 'Now rebuilding vulkan shaders for Windows...'
$(shell) vulkan-shaders-gen --glslc glslc --input-dir ggml/src/ggml-vulkan/vulkan-shaders --target-hpp ggml/src/ggml-vulkan-shaders.hpp --target-cpp ggml/src/ggml-vulkan-shaders.cpp $(shell) vulkan-shaders-gen --glslc glslc --input-dir ggml/src/ggml-vulkan/vulkan-shaders --target-hpp ggml/src/ggml-vulkan-shaders.hpp --target-cpp ggml/src/ggml-vulkan-shaders.cpp
@echo 'Vulkan Shaders Rebuilt for Windows...'
else else
@echo 'Now rebuilding vulkan shaders for Linux...' @echo 'Now rebuilding vulkan shaders for Linux...'
${shell} chmod +x vulkan-shaders-gen ${shell} chmod +x vulkan-shaders-gen
${shell} chmod +x glslc-linux ${shell} chmod +x glslc-linux
$(shell) ./vulkan-shaders-gen --glslc ./glslc-linux --input-dir ggml/src/ggml-vulkan/vulkan-shaders --target-hpp ggml/src/ggml-vulkan-shaders.hpp --target-cpp ggml/src/ggml-vulkan-shaders.cpp $(shell) ./vulkan-shaders-gen --glslc ./glslc-linux --input-dir ggml/src/ggml-vulkan/vulkan-shaders --target-hpp ggml/src/ggml-vulkan-shaders.hpp --target-cpp ggml/src/ggml-vulkan-shaders.cpp
@echo 'Vulkan Shaders Rebuilt for Linux...'
endif endif
#generated libraries #generated libraries

View file

@ -1,9 +1,11 @@
#ifndef NO_VULKAN_EXTENSIONS
#ifndef GGML_VULKAN_COOPMAT_GLSLC_SUPPORT #ifndef GGML_VULKAN_COOPMAT_GLSLC_SUPPORT
#define GGML_VULKAN_COOPMAT_GLSLC_SUPPORT #define GGML_VULKAN_COOPMAT_GLSLC_SUPPORT
#endif #endif
#ifndef GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT #ifndef GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT
#define GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT #define GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT
#endif #endif
#endif
#include "ggml-vulkan.h" #include "ggml-vulkan.h"
#include <vulkan/vulkan_core.h> #include <vulkan/vulkan_core.h>

View file

@ -32,12 +32,14 @@
#endif #endif
#define ASYNCIO_CONCURRENCY 64 #define ASYNCIO_CONCURRENCY 64
#ifndef NO_VULKAN_EXTENSIONS
#ifndef GGML_VULKAN_COOPMAT_GLSLC_SUPPORT #ifndef GGML_VULKAN_COOPMAT_GLSLC_SUPPORT
#define GGML_VULKAN_COOPMAT_GLSLC_SUPPORT #define GGML_VULKAN_COOPMAT_GLSLC_SUPPORT
#endif #endif
#ifndef GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT #ifndef GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT
#define GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT #define GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT
#endif #endif
#endif
std::mutex lock; std::mutex lock;
std::vector<std::pair<std::string, std::string>> shader_fnames; std::vector<std::pair<std::string, std::string>> shader_fnames;