Skip to content

Commit 79f1757

Browse files
committed
Guard against all weights in a super-block being zero
1 parent 3103568 commit 79f1757

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

k_quants.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,12 @@ void quantize_row_q6_K_reference(const float * restrict x, block_q6_K * restrict
10861086

10871087
}
10881088

1089+
if (!max_abs_scale) {
1090+
memset(&y[i], 0, sizeof(block_q6_K));
1091+
y[i].d = ggml_fp32_to_fp16(0.f);
1092+
continue;
1093+
}
1094+
10891095
float iscale = -128.f/max_scale;
10901096
y[i].d = ggml_fp32_to_fp16(1/iscale);
10911097
for (int ib = 0; ib < QK_K/16; ++ib) {

0 commit comments

Comments
 (0)