From: Bartowski Date: Sun, 15 Mar 2026 08:47:28 +0000 (-0400) Subject: ggml : guard against sumq2 being 0 in IQ4_NL (llama/20460) X-Git-Tag: v0.9.8~11 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=f3d6372f47119b560ea288fba0ce1b8db46ad8c6;p=pkg%2Fggml%2Fsources%2Fggml ggml : guard against sumq2 being 0 in IQ4_NL (llama/20460) --- diff --git a/src/ggml-quants.c b/src/ggml-quants.c index cdaded86..48695a61 100644 --- a/src/ggml-quants.c +++ b/src/ggml-quants.c @@ -4767,7 +4767,7 @@ static void quantize_row_iq4_nl_impl(const int super_block_size, const int block sumqx += w*q*xb[j]; sumq2 += w*q*q; } - d = sumqx/sumq2; + d = sumq2 > 0 ? sumqx/sumq2 : 0.f; float best = d*sumqx; for (int itry = -ntry; itry <= ntry; ++itry) { id = (itry + values[0])/max;