Jelajahi Sumber

vulkan : fix soft_max.comp division by zero (whisper/2633)

This change prevents a division by zero error when p.KY is 0.
gn64 1 tahun lalu
induk
melakukan
8dd19a4812
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp

+ 1 - 1
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) {
 void soft_max(uint num_iters) {
     const uint tid = gl_LocalInvocationID.x;
     const uint tid = gl_LocalInvocationID.x;
     const uint rowx = gl_WorkGroupID.z * 262144 + gl_WorkGroupID.y * 512 + gl_WorkGroupID.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) {
     if (rowx >= p.nrows_x) {
         return;
         return;