From c4aed6831ef8df6635ad4414a6384ff8d1b7b4a8 Mon Sep 17 00:00:00 2001 From: gn64 Date: Mon, 16 Dec 2024 19:34:38 +0900 Subject: [PATCH] vulkan : fix soft_max.comp division by zero (#2633) This change prevents a division by zero error when p.KY is 0. --- ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp b/ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp index 6e20b641..a25808e1 100644 --- a/ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp +++ b/ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp @@ -32,7 +32,7 @@ shared FLOAT_TYPE vals[BLOCK_SIZE]; void soft_max(uint num_iters) { const uint tid = gl_LocalInvocationID.x; const uint rowx = gl_WorkGroupID.z * 262144 + gl_WorkGroupID.y * 512 + gl_WorkGroupID.x; - const uint rowy = rowx % p.KY; + const uint rowy = (p.KY > 0) ? (rowx % p.KY) : 0; if (rowx >= p.nrows_x) { return;