diff options
author | Henry Cook <hcook@eecs.berkeley.edu> | 2014-11-11 16:03:24 -0800 |
---|---|---|
committer | Henry Cook <hcook@eecs.berkeley.edu> | 2014-11-11 16:03:24 -0800 |
commit | 8d6a0e0da4c228659077e56fc3988e6b3d321dc4 (patch) | |
tree | 10801d276c763ad25dc0423abcd4d65983004f23 /benchmarks | |
parent | fda55d7c908f7679d468c38c853571027d3669c3 (diff) | |
download | riscv-tests-8d6a0e0da4c228659077e56fc3988e6b3d321dc4.zip riscv-tests-8d6a0e0da4c228659077e56fc3988e6b3d321dc4.tar.gz riscv-tests-8d6a0e0da4c228659077e56fc3988e6b3d321dc4.tar.bz2 |
blocked mt-matmul
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/mt-matmul/matmul.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/benchmarks/mt-matmul/matmul.c b/benchmarks/mt-matmul/matmul.c index c38914d..5d11fa3 100644 --- a/benchmarks/mt-matmul/matmul.c +++ b/benchmarks/mt-matmul/matmul.c @@ -1,22 +1,20 @@ #include "dataset.h" #include "util.h" -//-------------------------------------------------------------------------- -// single-thread, naive version -// void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] ) { int i, j, k; - - for ( i = 0; i < lda; i++ ) + int block = lda / ncores; + int start = block * coreid; + + for ( j = start; j < (start+block); j++ ) { - for ( j = 0; j < lda; j++ ) + for ( k = 0; k < lda; k++ ) { - for ( k = coreid; k < lda; k+=ncores ) + for ( i = 0; i < lda; i++ ) { C[i + j*lda] += A[j*lda + k] * B[k*lda + i]; } - barrier(ncores); } } } |