Skip to content

Commit d5376cf

Browse files
authored
ci: fix vulkan docker images (#24595)
* Update vulkan-shaders-gen.cpp * Update vulkan-shaders-gen.cpp add comment describing code change intention * Update vulkan-shaders-gen.cpp fix potential UB
1 parent bae36ef commit d5376cf

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ std::map<std::string, std::string> merge_maps(const std::map<std::string, std::s
407407
return result;
408408
}
409409

410-
static std::vector<std::future<void>> compiles;
410+
static std::deque<std::future<void>> compiles;
411411
void string_to_spv(std::string name, const std::string& source, const std::map<std::string, std::string>& defines, bool fp16 = true, bool coopmat = false, bool coopmat2 = false, bool f16acc = false, const std::string& suffix = "") {
412412
name = name + (f16acc ? "_f16acc" : "") + (coopmat ? "_cm1" : "") + (coopmat2 ? "_cm2" : (fp16 ? "" : "_fp32")) + suffix;
413413
std::string out_path = join_paths(output_dir, name + ".spv");
@@ -426,6 +426,11 @@ void string_to_spv(std::string name, const std::string& source, const std::map<s
426426
string_to_spv_func, name, input_filepath, out_path, defines, coopmat, generate_dep_file, std::move(slot)));
427427
// Don't write the same dep file from multiple processes
428428
generate_dep_file = false;
429+
430+
// Clean up completed futures - don't accumulate virtual memory for completed threads' stacks.
431+
while (!compiles.empty() && compiles.front().wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
432+
compiles.pop_front();
433+
}
429434
}
430435

431436
void matmul_shaders(bool fp16, MatMulIdType matmul_id_type, bool coopmat, bool coopmat2, bool f16acc, bool dot2 = false) {

0 commit comments

Comments
 (0)