Skip to content

Commit

Permalink
#EDITS: test suite updates
Browse files Browse the repository at this point in the history
  • Loading branch information
akielaries committed Feb 27, 2024
1 parent f5731cb commit 9f7edff
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 54 deletions.
33 changes: 0 additions & 33 deletions include/linalg/_dgemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,6 @@ class DGEMM {
static double DGEMM_BUFF_C[BLOCK_SZ_MR * BLOCK_SZ_NR]
__attribute__((aligned(16)));

/**
* @brief Performs matrix-matrix multiplication (DGEMM) using an
* assembly implementation It computes the product of matrices A and B,
* scaled by alpha and beta, and stores the result in matrix C
*
* @param A Pointer to the first matrix (A) in row-major order
* @param B Pointer to the second matrix (B) in row-major order
* @param C Pointer to the result matrix (C) in row-major order
* @param nextA Pointer to the next matrix A
* @param nextB Pointer to the next matrix B
* @param kl Value representing the remaining columns of matrix A
* @param kb Value representing the remaining rows of matrix B
* @param incRowC Increment for moving to the next row of matrix C
* @param incColC Increment for moving to the next column of matrix C
* @param alpha Scalar value to scale the product of matrices A and B
* @param beta Scalar value to scale matrix C before adding the product
*
* @note This calls an Assembly implementation depending on detected
* host system. x86 (SSE, AVX2) and ARM NEON supported
*/
/*void dgemm_kernel_asm(const double *A,
const double *B,
double *C,
const double *nextA,
const double *nextB,
long kl,
long kb,
long incRowC,
long incColC,
double alpha,
double beta);
*/

/**
* @brief Packs micro panels of size BLOCK_SZ_MR rows by k columns from A
* without padding
Expand Down
20 changes: 20 additions & 0 deletions modules/linalg/dgemm_arr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ extern "C" {
#endif

// ASM micro kernel function
/**
* @brief Performs matrix-matrix multiplication (DGEMM) using an
* assembly implementation It computes the product of matrices A and B,
* scaled by alpha and beta, and stores the result in matrix C
*
* @param A Pointer to the first matrix (A) in row-major order
* @param B Pointer to the second matrix (B) in row-major order
* @param C Pointer to the result matrix (C) in row-major order
* @param nextA Pointer to the next matrix A
* @param nextB Pointer to the next matrix B
* @param kl Value representing the remaining columns of matrix A
* @param kb Value representing the remaining rows of matrix B
* @param incRowC Increment for moving to the next row of matrix C
* @param incColC Increment for moving to the next column of matrix C
* @param alpha Scalar value to scale the product of matrices A and B
* @param beta Scalar value to scale matrix C before adding the product
*
* @note This calls an Assembly implementation depending on detected
* host system. x86 (SSE, AVX2) and ARM NEON supported
*/
extern void dgemm_kernel_asm(const double *A,
const double *B,
double *C,
Expand Down
4 changes: 0 additions & 4 deletions modules/linalg/dgemm_asm.h

This file was deleted.

2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_arr_f64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const double TOLERANCE = 1e-3;
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"

namespace {

Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_arr_f90.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
namespace {

TEST(FORTRAN90MatrixArrayTestI32, AdditionPerformanceComparison) {
Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_arr_i16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
namespace {

TEST(MatrixArrayTestI16, AdditionComparisonSmall) {
Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_arr_i32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
namespace {

TEST(MatrixArrayTestI32, AdditionComparisonSmall) {
Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_arr_i8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
namespace {

TEST(MatrixArrayTestI8, AdditionComparisonSmall) {
Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_arr_naive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
namespace {
TEST(MatrixArrayTest, BasicTest) {
INFO_COUT << "MATRIX (as Arrays) NAIVE" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_vector_f64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
namespace {

TEST(MatrixVectorTestF64, AdditionComparisonSmall) {
Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_matrix_vector_i32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using namespace gpmp;
#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
namespace {

// test case to compare the results of the intrinsics implementation with the
Expand Down
4 changes: 2 additions & 2 deletions tests/linalg/t_mtx.f90
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ subroutine test_mtx_add()
do i = 1, nrows
do j = 1, ncols
if (c(i, j) /= a(i, j) + b(i, j)) then
print *, ''//achar(27)//'[31m [!] LINALG MTX ADD (FLOAT) FAILED'//achar(27)//'[0m'
print *, ''//achar(27)//'[34m [!] LINALG MTX ADD (FLOAT) FAILED'//achar(27)//'[0m'
failed = .true.
exit
end if
Expand All @@ -76,7 +76,7 @@ subroutine test_mtx_add()
do i = 1, nrows
do j = 1, ncols
if (c(i, j) /= a(i, j) + b(i, j)) then
print *, ''//achar(27)//'[31m [!] LINALG MTX ADD (INT) FAILED'//achar(27)//'[0m'
print *, ''//achar(27)//'[34m [!] LINALG MTX ADD (INT) FAILED'//achar(27)//'[0m'
failed = .true.
exit
end if
Expand Down
4 changes: 2 additions & 2 deletions tests/linalg/t_vector_vector_f64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

const double TOLERANCE = 1e-3;

#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define TEST_COUT std::cout << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
TEST(VectorVectorTestF64, Addition) {
INFO_COUT << "Vector (as Vectors) FLOAT64" << std::endl;

Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_vector_vector_i16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const double TOLERANCE = 1e-3;

#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
/*****************************************************************************/
/** VECTOR<INT32> TESTS */

Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_vector_vector_i32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const double TOLERANCE = 1e-3;

#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
/*****************************************************************************/
/** VECTOR<INT32> TESTS */

Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_vector_vector_i64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const double TOLERANCE = 1e-3;

#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
/*****************************************************************************/
/** VECTOR<INT32> TESTS */

Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_vector_vector_i8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const double TOLERANCE = 1e-3;

#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
/*****************************************************************************/
/** VECTOR<INT8> TESTS */

Expand Down
2 changes: 1 addition & 1 deletion tests/linalg/t_vector_vector_naive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const double TOLERANCE = 1e-3;

#define TEST_COUT std::cerr << "\033[32m[ ] [ INFO ] \033[0m"
#define INFO_COUT \
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;31m\033[1m"
std::cerr << "\033[32m[ ] [ INFO ] \033[0m\033[1;34m\033[1m"
TEST(VectorVectorTestDouble, Addition) {
INFO_COUT << "Vector (as Vectors) NAIVE" << std::endl;

Expand Down

0 comments on commit 9f7edff

Please sign in to comment.