From 1c810a1d2b80856c4adc6edbad2b1d2453b348ee Mon Sep 17 00:00:00 2001 From: Christos Choutouridis Date: Sun, 17 May 2020 17:09:48 +0300 Subject: [PATCH] Q6: step 3 --- Q6-cache/info.txt | 3 ++- Q6-cache/src/main.c | 1 + Q6-cache/src/matmul.c | 38 ++++++++++++++++++++++++++++++++++++++ Q6-cache/src/matmul.h | 1 + 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Q6-cache/info.txt b/Q6-cache/info.txt index 3b0d10e..5e8e145 100644 --- a/Q6-cache/info.txt +++ b/Q6-cache/info.txt @@ -12,6 +12,7 @@ Βήμα 1: Λόγος διάμεσων χρόνων: 20.265193309 +Βήμα 2: Λόγος διάμεσων χρόνων: 6.719256593 (s=8) Βήμα 2: Λόγος διάμεσων χρόνων: 24.61113257 (s=1024) -Βήμα 3: Λόγος διάμεσων χρόνων: xxxx \ No newline at end of file +Βήμα 3: Λόγος διάμεσων χρόνων: 4.667896091 (s=8) \ No newline at end of file diff --git a/Q6-cache/src/main.c b/Q6-cache/src/main.c index 09460ff..6c0a1bb 100644 --- a/Q6-cache/src/main.c +++ b/Q6-cache/src/main.c @@ -49,6 +49,7 @@ mMult_ft multSelect (char* order) { else if (! strcmp ((const char*)order, "jki")) return matrixMult_jki; else if (! strcmp ((const char*)order, "kij")) return matrixMult_kij; else if (! strcmp ((const char*)order, "kji")) return matrixMult_kji; + else if (! strcmp ((const char*)order, "ikj8")) return matrixMult_ikj8; else return matrixMult_ijk; } diff --git a/Q6-cache/src/matmul.c b/Q6-cache/src/matmul.c index 0f495e0..2cc43f5 100644 --- a/Q6-cache/src/matmul.c +++ b/Q6-cache/src/matmul.c @@ -273,6 +273,44 @@ void matrixMult_kji_block(float * const C, float const * const A, float const * C[ sub2ind(I+i,J+j,n) ] += A[ sub2ind(I+i,K+k,n) ] * B[ sub2ind(K+k,J+j,n) ]; } +/*! + * Square Matrix multiplication in unrolling block of 8 - ikj + * \param C pointer to output matrix + * \param A pointer to input matrix A + * \param B pointer to input matrix B + * \param n Size of matrices (both sizes) + * \param s The block size + * \return none + */ +void matrixMult_ikj8(float * const C, float const * const A, float const * const B, int const n) { + for (int I =0; I