Remove deprecated uarch counters; support RVC for benchmarks
[riscv-tests.git] / mt / ar_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
9 // ***************************** //
10 // **** ADD YOUR CODE HERE ***** //
11 // ***************************** //
12 //
13 // feel free to make a separate function for MI and MSI versions.
14
15 int i, j, k, B_t[32*32], x, y;
16 int ALoc, BLoc, CLoc;
17 // int ii = 0, done = 0;
18 //for(x = coreid*(lda/ncores); x < (coreid+1)*(lda/ncores) && x < lda; x++) {
19 for (x = 0; x < lda; x++) {
20 for(y = 0; y < lda; y++) {
21 B_t[y*lda + x] = B[x*lda + y];
22 }
23 }
24 // for ( ii = lda/4 ; ii < lda ; ii += lda/4)
25 //{
26 // for ( i = coreid*(ii/ncores); i < (coreid+1)*(ii/ncores) && i < ii; i++ )
27 for ( i = coreid*(lda/ncores); i < (coreid+1)*(lda/ncores) && i < lda; i++ )
28 {
29 ALoc = i*lda;
30 for ( j = 0; j < lda; j++ )
31 {
32 BLoc = j*lda;
33 CLoc = i*lda + j;
34 for ( k = 0; k < lda; k++ )
35 {
36 C[CLoc] += A[ALoc + k] * B_t[BLoc + k];
37 }
38 }
39 }
40 //}
41 }