aboutsummaryrefslogtreecommitdiff
path: root/mt/aq_matmul.c
diff options
context:
space:
mode:
authorHenry Cook <hcook@eecs.berkeley.edu>2014-11-06 17:24:39 -0800
committerHenry Cook <hcook@eecs.berkeley.edu>2014-11-07 16:52:51 -0800
commitd537de7deffa6036dab573ff174b7f8c8e470437 (patch)
treeddc921eb337cda4889570f0251bdba85059a2531 /mt/aq_matmul.c
parent5afc6b9bc2e3685220cffb3da66ad9f5f1f7b14f (diff)
downloadriscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.zip
riscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.tar.gz
riscv-tests-d537de7deffa6036dab573ff174b7f8c8e470437.tar.bz2
Clean up canonical mt benchmarks and reorganize extra versions in /mt. All versions support support at least 1/2/4 threads.
Diffstat (limited to 'mt/aq_matmul.c')
-rw-r--r--mt/aq_matmul.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/mt/aq_matmul.c b/mt/aq_matmul.c
new file mode 100644
index 0000000..f2fb3e0
--- /dev/null
+++ b/mt/aq_matmul.c
@@ -0,0 +1,30 @@
+#include "stdlib.h"
+
+#include "util.h"
+
+#include "dataset.h"
+void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] )
+{
+
+ // ***************************** //
+ // **** ADD YOUR CODE HERE ***** //
+ // ***************************** //
+ //
+ // feel free to make a separate function for MI and MSI versions.
+
+ for (int i = coreid; i < lda; i+=ncores*2)
+ {
+ for (int j = 0; j < lda; j++)
+ {
+ for (int k = 0; k < lda; k++)
+ {
+ int A12 = A[j*lda + k];
+ int B1 = B[k*lda + i];
+ int B2 = B[k*lda + i + ncores];
+ C[i+j*lda] += A12 * B1;
+ C[i+ncores+j*lda] += A12 * B2;
+ //C[i+j*lda] += A[j*lda +k] * B[k*lda +i];
+ }
+ }
+ }
+}