Skip to content

Commit ba6f6be

Browse files
committed
imatrix : don't use FMA explicitly
This should make comparisons between the formats easier because this matches the behavior of the previous version.
1 parent 2c09450 commit ba6f6be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/imatrix/imatrix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ bool IMatrixCollector::collect_imatrix(struct ggml_tensor * t, bool ask, void *
180180
e.counts[ex]++;
181181

182182
for (int j = 0; j < (int)src1->ne[0]; ++j) {
183-
e.values[e_start + j] = std::fma(x[j], x[j], e.values[e_start + j]);
183+
e.values[e_start + j] += x[j] * x[j];
184184
if (!std::isfinite((float)e.values[e_start + j])) {
185185
LOG_ERR("%f detected in %s\n", (float)e.values[e_start + j], wname.c_str());
186186
exit(1);
@@ -220,7 +220,7 @@ bool IMatrixCollector::collect_imatrix(struct ggml_tensor * t, bool ask, void *
220220
const float * x = (const float *) (data + row * src1->nb[1]);
221221
e.counts[0]++;
222222
for (int j = 0; j < (int)src1->ne[0]; ++j) {
223-
e.values[j] = std::fma(x[j], x[j], e.values[j]);
223+
e.values[j] += x[j] * x[j];
224224
if (!std::isfinite((float)e.values[j])) {
225225
LOG_ERR("%f detected in %s\n", (float)e.values[j], wname.c_str());
226226
exit(1);

0 commit comments

Comments
 (0)