Skip to content

Commit b887d2f

Browse files
authored
ggml : fix GGML_F32_VEC_FMA argument order in ggml_vec_mad1_f32 (#16307)
* fix GGML_F32_VEC_FMA argument order in ggml_vec_mad1_f32 * add test that fails on simd
1 parent bd0af02 commit b887d2f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ggml/src/ggml-cpu/vec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ inline static void ggml_vec_mad1_f32(const int n, float * y, const float * x, co
610610
for (int i = 0; i < np; i += GGML_F32_STEP) {
611611
for (int j = 0; j < GGML_F32_ARR; j++) {
612612
ay[j] = GGML_F32_VEC_LOAD(x + i + j*GGML_F32_EPR);
613-
ay[j] = GGML_F32_VEC_FMA(ay[j], vs, vb);
613+
ay[j] = GGML_F32_VEC_FMA(vb, ay[j], vs);
614614

615615
GGML_F32_VEC_STORE(y + i + j*GGML_F32_EPR, ay[j]);
616616
}

tests/test-backend-ops.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6155,6 +6155,7 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
61556155
test_cases.emplace_back(new test_add1());
61566156
test_cases.emplace_back(new test_scale());
61576157
test_cases.emplace_back(new test_scale(GGML_TYPE_F32, {10, 10, 10, 10}, 2.0f, 1.0f));
6158+
test_cases.emplace_back(new test_scale(GGML_TYPE_F32, {100, 10, 10, 10}, 2.0f, 1.0f));
61586159
test_cases.emplace_back(new test_softcap(GGML_TYPE_F32, {10, 10, 10, 10}, 50.0f));
61596160
test_cases.emplace_back(new test_silu_back());
61606161

0 commit comments

Comments
 (0)