Skip to content

Commit 8dd19a4

Browse files
gn64ggerganov
authored andcommitted
vulkan : fix soft_max.comp division by zero (whisper/2633)
This change prevents a division by zero error when p.KY is 0.
1 parent 130d0c9 commit 8dd19a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ shared FLOAT_TYPE vals[BLOCK_SIZE];
3232
void soft_max(uint num_iters) {
3333
const uint tid = gl_LocalInvocationID.x;
3434
const uint rowx = gl_WorkGroupID.z * 262144 + gl_WorkGroupID.y * 512 + gl_WorkGroupID.x;
35-
const uint rowy = rowx % p.KY;
35+
const uint rowy = (p.KY > 0) ? (rowx % p.KY) : 0;
3636

3737
if (rowx >= p.nrows_x) {
3838
return;

0 commit comments

Comments
 (0)