forgot barrier in mt-matmul
[riscv-tests.git] / benchmarks / mt-matmul / matmul.c
1 #include "dataset.h"
2 #include "util.h"
3
4 //--------------------------------------------------------------------------
5 // single-thread, naive version
6 //
7 void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] )
8 {
9 int i, j, k;
10
11 for ( i = 0; i < lda; i++ )
12 {
13 for ( j = 0; j < lda; j++ )
14 {
15 for ( k = coreid; k < lda; k+=ncores )
16 {
17 C[i + j*lda] += A[j*lda + k] * B[k*lda + i];
18 }
19 barrier(ncores);
20 }
21 }
22 }