Skip to content

Commit 5a372f6

Browse files
committed
Revert "vulkan : incremental shader builds (ggml-org#16341)"
This reverts commit e29acf7.
1 parent f392839 commit 5a372f6

File tree

133 files changed

+316
-405
lines changed

Some content is hidden

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

133 files changed

+316
-405
lines changed

ggml/src/ggml-vulkan/CMakeLists.txt

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cmake_minimum_required(VERSION 3.19)
22
cmake_policy(SET CMP0114 NEW)
3-
cmake_policy(SET CMP0116 NEW)
43

54
find_package(Vulkan COMPONENTS glslc REQUIRED)
65

@@ -55,25 +54,25 @@ if (Vulkan_FOUND)
5554
# Test all shader extensions
5655
test_shader_extension_support(
5756
"GL_KHR_cooperative_matrix"
58-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/feature-tests/coopmat.comp"
57+
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat_support.comp"
5958
"GGML_VULKAN_COOPMAT_GLSLC_SUPPORT"
6059
)
6160

6261
test_shader_extension_support(
6362
"GL_NV_cooperative_matrix2"
64-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/feature-tests/coopmat2.comp"
63+
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat2_support.comp"
6564
"GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT"
6665
)
6766

6867
test_shader_extension_support(
6968
"GL_EXT_integer_dot_product"
70-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/feature-tests/integer_dot.comp"
69+
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_integer_dot_support.comp"
7170
"GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT"
7271
)
7372

7473
test_shader_extension_support(
7574
"GL_EXT_bfloat16"
76-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/feature-tests/bfloat16.comp"
75+
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_bfloat16_support.comp"
7776
"GGML_VULKAN_BFLOAT16_GLSLC_SUPPORT"
7877
)
7978

@@ -161,6 +160,7 @@ if (Vulkan_FOUND)
161160
set (_ggml_vk_genshaders_dir "${CMAKE_BINARY_DIR}/$<CONFIG>")
162161
set (_ggml_vk_genshaders_cmd "${_ggml_vk_genshaders_dir}/vulkan-shaders-gen${_ggml_vk_host_suffix}")
163162
set (_ggml_vk_header "${CMAKE_CURRENT_BINARY_DIR}/ggml-vulkan-shaders.hpp")
163+
set (_ggml_vk_source "${CMAKE_CURRENT_BINARY_DIR}/ggml-vulkan-shaders.cpp")
164164
set (_ggml_vk_input_dir "${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders")
165165
set (_ggml_vk_output_dir "${CMAKE_CURRENT_BINARY_DIR}/vulkan-shaders.spv")
166166

@@ -176,35 +176,24 @@ if (Vulkan_FOUND)
176176

177177
add_custom_command(
178178
OUTPUT ${_ggml_vk_header}
179+
${_ggml_vk_source}
180+
179181
COMMAND ${_ggml_vk_genshaders_cmd}
182+
--glslc ${Vulkan_GLSLC_EXECUTABLE}
183+
--input-dir ${_ggml_vk_input_dir}
180184
--output-dir ${_ggml_vk_output_dir}
181185
--target-hpp ${_ggml_vk_header}
182-
DEPENDS ${_ggml_vk_shaders_gen_sources}
186+
--target-cpp ${_ggml_vk_source}
187+
--no-clean
188+
189+
DEPENDS ${_ggml_vk_shader_files}
190+
${_ggml_vk_shaders_gen_sources}
183191
vulkan-shaders-gen
184-
COMMENT "Generate vulkan shaders header"
192+
193+
COMMENT "Generate vulkan shaders"
185194
)
186-
target_sources(ggml-vulkan PRIVATE ${_ggml_vk_header})
187-
188-
foreach (file_full ${_ggml_vk_shader_files})
189-
get_filename_component(file ${file_full} NAME)
190-
set (_ggml_vk_target_cpp "${CMAKE_CURRENT_BINARY_DIR}/${file}.cpp")
191-
192-
add_custom_command(
193-
OUTPUT ${_ggml_vk_target_cpp}
194-
DEPFILE ${_ggml_vk_target_cpp}.d
195-
COMMAND ${_ggml_vk_genshaders_cmd}
196-
--glslc ${Vulkan_GLSLC_EXECUTABLE}
197-
--source ${file_full}
198-
--output-dir ${_ggml_vk_output_dir}
199-
--target-hpp ${_ggml_vk_header}
200-
--target-cpp ${_ggml_vk_target_cpp}
201-
DEPENDS ${file_full}
202-
${_ggml_vk_shaders_gen_sources}
203-
vulkan-shaders-gen
204-
COMMENT "Generate vulkan shaders for ${file}"
205-
)
206-
target_sources(ggml-vulkan PRIVATE ${_ggml_vk_target_cpp})
207-
endforeach()
195+
196+
target_sources(ggml-vulkan PRIVATE ${_ggml_vk_source} ${_ggml_vk_header})
208197

209198
else()
210199
message(WARNING "Vulkan not found")

ggml/src/ggml-vulkan/vulkan-shaders/acc.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#version 450
22

3-
#include "types.glsl"
4-
#include "generic_binary_head.glsl"
3+
#include "types.comp"
4+
#include "generic_binary_head.comp"
55

66
layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in;
77

ggml/src/ggml-vulkan/vulkan-shaders/add.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#extension GL_KHR_shader_subgroup_basic : enable
77
#endif
88

9-
#include "types.glsl"
10-
#include "generic_binary_head.glsl"
9+
#include "types.comp"
10+
#include "generic_binary_head.comp"
1111

1212
const uint num_threads = 256;
1313

ggml/src/ggml-vulkan/vulkan-shaders/add_id.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#extension GL_EXT_control_flow_attributes : require
44

5-
#include "types.glsl"
5+
#include "types.comp"
66

77
layout (push_constant) uniform parameter
88
{

ggml/src/ggml-vulkan/vulkan-shaders/argmax.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#version 450
22

3-
#include "generic_head.glsl"
4-
#include "types.glsl"
3+
#include "generic_head.comp"
4+
#include "types.comp"
55

66
#extension GL_EXT_control_flow_attributes : enable
77

ggml/src/ggml-vulkan/vulkan-shaders/argsort.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#version 450
22
#extension GL_EXT_control_flow_attributes : enable
33

4-
#include "types.glsl"
4+
#include "types.comp"
55

66
layout(constant_id = 0) const int BLOCK_SIZE = 1024;
77
layout(constant_id = 1) const int BLOCK_SIZE_LOG2 = 10;

ggml/src/ggml-vulkan/vulkan-shaders/clamp.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#version 450
22

3-
#include "types.glsl"
4-
#include "generic_unary_head.glsl"
3+
#include "types.comp"
4+
#include "generic_unary_head.comp"
55

66
layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in;
77

ggml/src/ggml-vulkan/vulkan-shaders/concat.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#version 450
22

3-
#include "types.glsl"
4-
#include "generic_binary_head.glsl"
3+
#include "types.comp"
4+
#include "generic_binary_head.comp"
55

66
layout(local_size_x = 512, local_size_y = 1, local_size_z = 1) in;
77

ggml/src/ggml-vulkan/vulkan-shaders/contig_copy.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#version 450
22

3-
#include "types.glsl"
4-
#include "generic_unary_head.glsl"
3+
#include "types.comp"
4+
#include "generic_unary_head.comp"
55

66
#extension GL_EXT_control_flow_attributes : require
77

ggml/src/ggml-vulkan/vulkan-shaders/conv2d_dw.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#version 450
22

3-
#include "types.glsl"
3+
#include "types.comp"
44

55
layout (push_constant) uniform parameter
66
{

0 commit comments

Comments
 (0)