Skip to content

Commit 8d6238f

Browse files
authored
Merge pull request #5687 from martin-frbg/issue5686-1
Improve tests for SHGEMM and BGEMM
2 parents adba2c3 + e5793d8 commit 8d6238f

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

test/compare_sgemm_bgemm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ main (int argc, char *argv[])
4242
blasint x, y;
4343
blasint one = 1;
4444
int ret = 0;
45+
int ret2 = 0;
4546
int loop = BGEMM_LARGEST;
4647
char transA = 'N', transB = 'N';
4748
float alpha = 1.0, beta = 1.0;
@@ -143,6 +144,7 @@ main (int argc, char *argv[])
143144
printf("Mismatch at i=%d, j=%d, k=%d: CC=%.6f, DD=%.6f\n",
144145
i, j, k, float16to32(CC[i * m + j]), truncate_float32_to_bfloat16(DD[i * m + j]));
145146
#endif
147+
ret2++;
146148
ret++;
147149
}
148150

@@ -158,7 +160,7 @@ main (int argc, char *argv[])
158160
}
159161

160162
if (ret != 0) {
161-
fprintf(stderr, "BGEMM FAILURES: %d\n", ret);
163+
fprintf(stderr, "BGEMM FAILURES: %d (%d of which in comparison to naive loop)\n", ret,ret2);
162164
return 1;
163165
}
164166

test/compare_sgemm_shgemm.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,16 @@ main (int argc, char *argv[])
122122
(float)AA[k * j + l] * (float)BB[i + l * n];
123123
}
124124
if (!is_close(CC[i * m + j], C[i * m + j], 0.01, 0.001)) {
125-
fprintf(stderr,"CC %f C %f \n",(float)CC[i*m+j],C[i*m+j]);
126-
ret++;
125+
#ifdef DEBUG
126+
fprintf(stderr,"CC %f C %f \n",(float)CC[i*m+j],C[i*m+j]);
127+
#endif
128+
ret++;
127129
}
128-
if (!is_close(CC[i * m + j], DD[i * m + j], 0.001, 0.0001)) {
129-
fprintf(stderr,"CC %f DD %f \n",(float)CC[i*m+j],(float)DD[i*m+j]);
130-
ret++;
130+
if (!is_close(CC[i * m + j], DD[i * m + j], 0.01, 0.001)) {
131+
#ifdef DEBUG
132+
fprintf(stderr,"CC %f DD %f \n",(float)CC[i*m+j],(float)DD[i*m+j]);
133+
#endif
134+
ret++;
131135
}
132136
}
133137
}

0 commit comments

Comments
 (0)