Skip to content

Commit 2e752c4

Browse files
committed
ggml : fix row condition for i8mm kernels
ggml-ci
1 parent c6bc739 commit 2e752c4

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

ggml/src/ggml-cpu/ggml-cpu-quants.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,11 +1813,13 @@ void ggml_vec_dot_q4_0_q8_0(int n, float * restrict s, size_t bs, const void * r
18131813
sumv0 = vmlaq_f32(sumv0,(vcvtq_f32_s32(vmmlaq_s32((vmmlaq_s32((vmmlaq_s32((vmmlaq_s32(vdupq_n_s32(0), l0, r0)),
18141814
l1, r1)), l2, r2)), l3, r3))), scale);
18151815
}
1816-
float32x4_t sumv1 = vextq_f32(sumv0, sumv0, 2);
1816+
1817+
float32x4_t sumv1 = vextq_f32 (sumv0, sumv0, 2);
18171818
float32x4_t sumv2 = vzip1q_f32(sumv0, sumv1);
18181819

1819-
vst1_f32(s, vget_low_f32(sumv2));
1820+
vst1_f32(s, vget_low_f32 (sumv2));
18201821
vst1_f32(s + bs, vget_high_f32(sumv2));
1822+
18211823
return;
18221824
}
18231825
#endif

ggml/src/ggml-cpu/ggml-cpu.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7560,14 +7560,6 @@ UseGgmlGemm2:;
75607560
// This is the size of the rest of the dimensions of the result
75617561
const int64_t nr1 = ne1 * ne2 * ne3;
75627562

7563-
// dot kernels can handle 1 row and col at a time, but mmla kernels can process 2 rows and cols
7564-
int64_t num_rows_per_vec_dot = vec_dot_num_rows;
7565-
// TODO: currently the mmla kernels support only even numbered rows/cols.
7566-
// this check can be removed once they are extended to support odd numbered rows/cols too
7567-
if ((nr0 % 2 != 0) || (ne11 % 2 != 0)) {
7568-
num_rows_per_vec_dot = 1;
7569-
}
7570-
75717563
// Now select a reasonable chunk size.
75727564
int chunk_size = 16;
75737565

@@ -7630,6 +7622,15 @@ UseGgmlGemm2:;
76307622
const int64_t ir1_start = dr1 * ith1;
76317623
const int64_t ir1_end = MIN(ir1_start + dr1, nr1);
76327624

7625+
// dot kernels can handle 1 row and col at a time, but mmla kernels can process 2 rows and cols
7626+
int64_t num_rows_per_vec_dot = vec_dot_num_rows;
7627+
7628+
// TODO: currently the mmla kernels support only even numbered rows/cols.
7629+
// this check can be removed once they are extended to support odd numbered rows/cols too
7630+
if ((nr0 % 2 != 0) || (ne11 % 2 != 0) || ((ir0_end - ir0_start) % 2 != 0) || ((ir1_end - ir1_start) % 2 != 0)) {
7631+
num_rows_per_vec_dot = 1;
7632+
}
7633+
76337634
ggml_compute_forward_mul_mat_one_chunk(params, dst, type, num_rows_per_vec_dot, ir0_start, ir0_end, ir1_start, ir1_end);
76347635

76357636
if (nth >= nchunk0 * nchunk1) {

0 commit comments

Comments
 (0)