Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmake/prebuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,10 @@ endif ()
"#define DTB_DEFAULT_ENTRIES 128\n"
"#define DTB_SIZE 4096\n"
"#define L2_ASSOCIATIVE 4\n")
set(SGEMM_UNROLL_M 8)
set(SGEMM_UNROLL_N 4)
set(DGEMM_UNROLL_M 4)
set(DGEMM_UNROLL_N 4)
elseif ("${TCORE}" STREQUAL "LA64_GENERIC")
file(APPEND ${TARGET_CONF_TEMP}
"#define DTB_DEFAULT_ENTRIES 64\n")
Expand Down
1 change: 1 addition & 0 deletions utest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ else ()
test_gemv.c
test_trmv.c
test_gemm.c
test_matrix_packing.c
)
endif ()

Expand Down
2 changes: 1 addition & 1 deletion utest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ UTESTEXTBIN=openblas_utest_ext$(EXE)
include $(TOPDIR)/Makefile.system

OBJS=utest_main.o test_min.o test_amax.o test_ismin.o test_rotmg.o test_axpy.o test_dotu.o test_dsdot.o test_swap.o test_rot.o test_dnrm2.o test_zscal.o \
test_amin.o test_axpby.o test_gemv.o test_trmv.o test_gemm.o
test_amin.o test_axpby.o test_gemv.o test_trmv.o test_gemm.o test_matrix_packing.o
#test_rot.o test_swap.o test_axpy.o test_dotu.o test_dsdot.o test_fork.o
OBJS_EXT=utest_main.o $(DIR_EXT)/xerbla.o $(DIR_EXT)/common.o
OBJS_EXT+=$(DIR_EXT)/test_isamin.o $(DIR_EXT)/test_idamin.o $(DIR_EXT)/test_icamin.o $(DIR_EXT)/test_izamin.o
Expand Down
71 changes: 71 additions & 0 deletions utest/test_matrix_packing.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include "openblas_utest.h"
#include <cblas.h>

#ifndef NO_CBLAS

#define SYMM_PACKING(CBLAS, TYPE) \
do { \
TYPE a[64], b[32], c[32] = {0}; \
int i; \
for (i = 0; i < 64; ++i) { \
a[i] = i / 8 == i % 8 ? 2 : 1; \
} \
for (i = 0; i < 32; ++i) { \
b[i] = i + 1; \
} \
CBLAS(CblasRowMajor, CblasLeft, CblasLower, 8, 4, 1, a, 8, b, 4, \
0, c, 4); \
for (i = 0; i < 32; ++i) { \
ASSERT_TRUE(c[i] == i + 1 + 120 + 8 * (i % 4)); \
} \
} while (0)

#define TRMM_PACKING(CBLAS, TYPE) \
do { \
TYPE a[64], b[32], expected[32] = {0}; \
int i, j, k; \
for (i = 0; i < 64; ++i) { \
a[i] = i / 8 < i % 8 ? 0 : i / 8 == i % 8 ? 2 : 1; \
} \
for (i = 0; i < 32; ++i) { \
b[i] = i + 1; \
} \
for (i = 0; i < 8; ++i) { \
for (j = 0; j < 4; ++j) { \
for (k = 0; k <= i; ++k) { \
expected[i * 4 + j] += a[i * 8 + k] * b[k * 4 + j]; \
} \
} \
} \
CBLAS(CblasRowMajor, CblasLeft, CblasLower, CblasNoTrans, CblasNonUnit, \
8, 4, 1, a, 8, b, 4); \
for (i = 0; i < 32; ++i) { \
ASSERT_TRUE(b[i] == expected[i]); \
} \
} while (0)

#ifdef BUILD_DOUBLE
CTEST(matrix_packing, dsymm)
{
SYMM_PACKING(cblas_dsymm, double);
}

CTEST(matrix_packing, dtrmm)
{
TRMM_PACKING(cblas_dtrmm, double);
}
#endif

#ifdef BUILD_SINGLE
CTEST(matrix_packing, ssymm)
{
SYMM_PACKING(cblas_ssymm, float);
}

CTEST(matrix_packing, strmm)
{
TRMM_PACKING(cblas_strmm, float);
}
#endif

#endif
Loading