projects
/
riscv-tests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fda55d7
)
blocked mt-matmul
author
Henry Cook
<hcook@eecs.berkeley.edu>
Wed, 12 Nov 2014 00:03:24 +0000
(16:03 -0800)
committer
Henry Cook
<hcook@eecs.berkeley.edu>
Wed, 12 Nov 2014 00:03:24 +0000
(16:03 -0800)
benchmarks/mt-matmul/matmul.c
patch
|
blob
|
history
diff --git
a/benchmarks/mt-matmul/matmul.c
b/benchmarks/mt-matmul/matmul.c
index c38914d4d972b4c10b644d14d6e011eb4e8baea5..5d11fa3944f3f4af17f35c545129b8da8d283197 100644
(file)
--- a/
benchmarks/mt-matmul/matmul.c
+++ b/
benchmarks/mt-matmul/matmul.c
@@
-1,22
+1,20
@@
#include "dataset.h"
#include "util.h"
#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;
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];
}
{
C[i + j*lda] += A[j*lda + k] * B[k*lda + i];
}
- barrier(ncores);
}
}
}
}
}
}