minor mt updates
[riscv-tests.git] / mt / bs_matmul.c
1 #include "stdlib.h"
2
3 #include "util.h"
4
5 #include "dataset.h"
6 void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] )
7 {
8 int i,j,k,a,b,a1,a2,a3,c;
9 for (j=coreid; j<lda; j+=4*ncores){
10 a=j*lda;
11 a1=(j+1*ncores)*lda;
12 a2=(j+2*ncores)*lda;
13 a3=(j+3*ncores)*lda;
14 for (k=0;k<lda; k++)
15 {
16 b = k*lda;
17 for (i=0;i<lda;i++){
18 c = B[b+i];
19 C[i+a]+=A[a+k]*c;
20 C[i+a1]+=A[a1+k]*c;
21 C[i+a2]+=A[a2+k]*c;
22 C[i+a3]+=A[a3+k]*c;
23 }
24 }
25 }
26 }