Skip to content

Commit

Permalink
vulkan : fix soft_max.comp division by zero (ggerganov#2633)
Browse files Browse the repository at this point in the history
This change prevents a division by zero error when p.KY is 0.
  • Loading branch information
gn64 authored Dec 16, 2024
1 parent 1995796 commit c4aed68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c4aed68

Please sign in to comment.