ggml-cpu: fix SVE leftover path in ggml_vec_dot_f32 (llama/24699)
* ggml-cpu: fix SVE leftover path in ggml_vec_dot_f32 2D convolutions with kernel size 9 produced different results on SVE enabled ARM devices. After debugging it turned out that ggml_vec_dot_f32 was using data from inactive lanes. Use svmla_f32_m(pg, sum1, ax1, ay1) so inactive lanes retain sum1. * cont : clean-up --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This commit is contained in:
parent
02be871218
commit
5e7ef7e4b0
|
|
@ -75,12 +75,12 @@ void ggml_vec_dot_f32(int n, float * GGML_RESTRICT s, size_t bs, const float * G
|
||||||
ay1 = GGML_F32_VEC_LOAD(y + i);
|
ay1 = GGML_F32_VEC_LOAD(y + i);
|
||||||
sum1 = GGML_F32_VEC_FMA(sum1, ax1, ay1);
|
sum1 = GGML_F32_VEC_FMA(sum1, ax1, ay1);
|
||||||
}
|
}
|
||||||
// maximum number of leftover elements will be less that ggml_f32_epr. Apply predicated svmad on available elements only
|
// maximum number of leftover elements will be less that ggml_f32_epr. Apply predicated svmla on available elements only
|
||||||
if (np2 < n) {
|
if (np2 < n) {
|
||||||
svbool_t pg = svwhilelt_b32(np2, n);
|
svbool_t pg = svwhilelt_b32(np2, n);
|
||||||
ax1 = svld1_f32(pg, x + np2);
|
ax1 = svld1_f32(pg, x + np2);
|
||||||
ay1 = svld1_f32(pg, y + np2);
|
ay1 = svld1_f32(pg, y + np2);
|
||||||
sum1 = svmad_f32_m(pg, ax1, ay1, sum1);
|
sum1 = svmla_f32_m(pg, sum1, ax1, ay1);
|
||||||
}
|
}
|
||||||
// reduce sum1,sum2 to sum1
|
// reduce sum1,sum2 to sum1
|
||||||
GGML_F32_VEC_REDUCE(sumf, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum8);
|
GGML_F32_VEC_REDUCE(sumf, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum8);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue