diff options
author | Kawrakow <iwankawrakow@gmail.com> | 2025-04-26 09:19:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-26 09:19:43 +0200 |
commit | 9e846f0eb196ed543cb29753bfd6a21a936a5138 (patch) | |
tree | c341f5a2037c8a8f92cc0f59d2980f0510372e83 /ggml/src/iqk/iqk_flash_attn.cpp | |
parent | 715fc552ad2ea5fad38e7ff856bf84fdb71b692e (diff) |
Fix division by zero bug (#349)
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
Diffstat (limited to 'ggml/src/iqk/iqk_flash_attn.cpp')
-rw-r--r-- | ggml/src/iqk/iqk_flash_attn.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ggml/src/iqk/iqk_flash_attn.cpp b/ggml/src/iqk/iqk_flash_attn.cpp index 639b79af..0de68b94 100644 --- a/ggml/src/iqk/iqk_flash_attn.cpp +++ b/ggml/src/iqk/iqk_flash_attn.cpp @@ -154,7 +154,7 @@ extern "C" IQK_API bool iqk_flash_attn_noalibi(int type_q, int type_mask, float } if (neq3 == 1 && rk2 > 1 && rk2 == rv2 && neq1 == 1 && nth >= 1 && nek2*nek1 >= 32*nth) { - int nk = 32 * (nek2*nek1/(32*nth)); + int nk = std::max(1, 32 * (nek2*nek1/(32*nth))); int nkk = (nek1 + nk - 1)/nk; int nstep_k = nek2*nkk; auto result_size = (Dv + 16)*rk2*sizeof(float); |