From 254abe1566a47fcab1f2e6135b6b3229ac35d053 Mon Sep 17 00:00:00 2001 From: Eve <139727413+netrunnereve@users.noreply.github.com> Date: Fri, 3 Oct 2025 22:21:58 +0000 Subject: [PATCH 1/3] use a more flexible amount of threads --- ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp b/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp index 84bb9df9a0559..2c719959836db 100644 --- a/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +++ b/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp @@ -305,7 +305,7 @@ void string_to_spv(const std::string& _name, const std::string& in_fname, const { // wait until fewer than N compiles are in progress. // 16 is an arbitrary limit, the goal is to avoid "failed to create pipe" errors. - uint32_t N = 16; + uint32_t N = std::min(16u, std::thread::hardware_concurrency()); std::unique_lock guard(compile_count_mutex); while (compile_count >= N) { compile_count_cond.wait(guard); From 097fed339caee69022b6a17a1542844d2a82b47b Mon Sep 17 00:00:00 2001 From: Eve <139727413+netrunnereve@users.noreply.github.com> Date: Sat, 4 Oct 2025 00:37:31 +0000 Subject: [PATCH 2/3] fix windows compile and 0 thread case --- ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp b/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp index 2c719959836db..59153a133976d 100644 --- a/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +++ b/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp @@ -305,7 +305,7 @@ void string_to_spv(const std::string& _name, const std::string& in_fname, const { // wait until fewer than N compiles are in progress. // 16 is an arbitrary limit, the goal is to avoid "failed to create pipe" errors. - uint32_t N = std::min(16u, std::thread::hardware_concurrency()); + uint32_t N = (std::max)(1u, (std::min)(16u, std::thread::hardware_concurrency())); std::unique_lock guard(compile_count_mutex); while (compile_count >= N) { compile_count_cond.wait(guard); From 6cc34a67c7a53d88d6252e138a79487a40fa1b71 Mon Sep 17 00:00:00 2001 From: Eve <139727413+netrunnereve@users.noreply.github.com> Date: Sat, 4 Oct 2025 12:03:56 -0400 Subject: [PATCH 3/3] nominmax --- ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp b/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp index 59153a133976d..9655c73df90c3 100644 --- a/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +++ b/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp @@ -1,5 +1,3 @@ - - #include #include #include @@ -22,6 +20,7 @@ #include #ifdef _WIN32 + #define NOMINMAX #include #include // For _mkdir on Windows #else @@ -305,7 +304,7 @@ void string_to_spv(const std::string& _name, const std::string& in_fname, const { // wait until fewer than N compiles are in progress. // 16 is an arbitrary limit, the goal is to avoid "failed to create pipe" errors. - uint32_t N = (std::max)(1u, (std::min)(16u, std::thread::hardware_concurrency())); + uint32_t N = std::max(1u, std::min(16u, std::thread::hardware_concurrency())); std::unique_lock guard(compile_count_mutex); while (compile_count >= N) { compile_count_cond.wait(guard);