Skip to content

Commit

Permalink
add likely reproducer for flame/blis#514
Browse files Browse the repository at this point in the history
  • Loading branch information
devinamatthews authored and h-vetinari committed Jul 1, 2021
1 parent 922dbd7 commit 7a2bff3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions recipe/debug_blis.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <blis.h>

#include <assert.h>
#include <math.h>

int main(int argc, char** argv)
{
double M[5][3] = {{ 0, 1, 2},
{ 3, 4, 5},
{ 6, 7, 8},
{ 9,10,11},
{12,13,14}};
double C[5][5];
int m = 5, n = 5, k = 3;
double one = 1.0, zero = 0.0;

for (int i = 0;i < m;i++)
for (int j = 0;j < n;j++)
C[i][j] = NAN;

bli_dgemm(BLIS_NO_TRANSPOSE, BLIS_TRANSPOSE, m, n, k,
&one, &M[0][0], 3, 1,
&M[0][0], 3, 1,
&zero, &C[0][0], 5, 1);

for (int i = 0;i < m;i++)
for (int j = 0;j < n;j++)
{
double ref = 0;
for (int p = 0;p < k;p++)
ref += M[i][p]*M[j][p];
assert(fabs(ref - C[i][j]) < 1e-14);
}

return 0;
}

0 comments on commit 7a2bff3

Please sign in to comment.