From afbd7c2b0d8ba2091cfc9ad1ecd95c9a5677996c Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Wed, 18 Mar 2026 21:38:39 +0100 Subject: [PATCH 1/2] Reduce expected accuracy compared to naive code and silence matrix element printout --- test/compare_sgemm_shgemm.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/compare_sgemm_shgemm.c b/test/compare_sgemm_shgemm.c index 7a97a06697..8f75cb78c2 100644 --- a/test/compare_sgemm_shgemm.c +++ b/test/compare_sgemm_shgemm.c @@ -122,12 +122,16 @@ main (int argc, char *argv[]) (float)AA[k * j + l] * (float)BB[i + l * n]; } if (!is_close(CC[i * m + j], C[i * m + j], 0.01, 0.001)) { - fprintf(stderr,"CC %f C %f \n",(float)CC[i*m+j],C[i*m+j]); - ret++; +#ifdef DEBUG + fprintf(stderr,"CC %f C %f \n",(float)CC[i*m+j],C[i*m+j]); +#endif + ret++; } - if (!is_close(CC[i * m + j], DD[i * m + j], 0.001, 0.0001)) { - fprintf(stderr,"CC %f DD %f \n",(float)CC[i*m+j],(float)DD[i*m+j]); - ret++; + if (!is_close(CC[i * m + j], DD[i * m + j], 0.01, 0.001)) { +#ifdef DEBUG + fprintf(stderr,"CC %f DD %f \n",(float)CC[i*m+j],(float)DD[i*m+j]); +#endif + ret++; } } } From e5793d84065df0e7724976eb24974562847da34b Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Wed, 18 Mar 2026 21:46:48 +0100 Subject: [PATCH 2/2] Split failure count between comparison to SGEMM and naive loop --- test/compare_sgemm_bgemm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/compare_sgemm_bgemm.c b/test/compare_sgemm_bgemm.c index 1fe4501e37..5ffd7eaabe 100644 --- a/test/compare_sgemm_bgemm.c +++ b/test/compare_sgemm_bgemm.c @@ -42,6 +42,7 @@ main (int argc, char *argv[]) blasint x, y; blasint one = 1; int ret = 0; + int ret2 = 0; int loop = BGEMM_LARGEST; char transA = 'N', transB = 'N'; float alpha = 1.0, beta = 1.0; @@ -143,6 +144,7 @@ main (int argc, char *argv[]) printf("Mismatch at i=%d, j=%d, k=%d: CC=%.6f, DD=%.6f\n", i, j, k, float16to32(CC[i * m + j]), truncate_float32_to_bfloat16(DD[i * m + j])); #endif + ret2++; ret++; } @@ -158,7 +160,7 @@ main (int argc, char *argv[]) } if (ret != 0) { - fprintf(stderr, "BGEMM FAILURES: %d\n", ret); + fprintf(stderr, "BGEMM FAILURES: %d (%d of which in comparison to naive loop)\n", ret,ret2); return 1; }