diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2018-09-16 20:01:18 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2018-09-16 20:01:18 +0200 |
commit | 83ba3d4b7ba3a9cb5fbd2c1ad2bb14b2addd39fb (patch) | |
tree | 58900a63158d08e76342b46372fcc59015b4d3ca /test | |
parent | b7d833901213d03fe5e7f10c15741f55c6c1eb54 (diff) | |
parent | c163868e1822a97750b4380f0d9cdd38369f9f0b (diff) |
Merge branch 'master' into convgemm_multi_kernel
Diffstat (limited to 'test')
-rw-r--r-- | test/correctness/misc/preprocessor.cpp | 14 | ||||
-rw-r--r-- | test/correctness/testblas.cpp | 2 | ||||
-rw-r--r-- | test/routines/levelx/xomatcopy.hpp | 4 | ||||
-rw-r--r-- | test/test_utilities.cpp | 10 | ||||
-rw-r--r-- | test/test_utilities.hpp | 4 |
5 files changed, 31 insertions, 3 deletions
diff --git a/test/correctness/misc/preprocessor.cpp b/test/correctness/misc/preprocessor.cpp index c5d115d3..4d6fa114 100644 --- a/test/correctness/misc/preprocessor.cpp +++ b/test/correctness/misc/preprocessor.cpp @@ -221,7 +221,7 @@ size_t RunPreprocessor(int argc, char *argv[], const bool silent, const Precisio ; if (TestKernel(device, context, "TransposePadMatrix", transpose_pad_sources, precision)) { passed++; } else { errors++; } - // GEMM (in-direct) + // GEMM (in-direct) GEMMK==0 const auto gemm_sources = "#define KWI 2\n" "#define MWG 16\n" @@ -234,6 +234,18 @@ size_t RunPreprocessor(int argc, char *argv[], const bool silent, const Precisio ; if (TestKernel(device, context, "Xgemm", gemm_sources, precision)) { passed++; } else { errors++; } + // GEMM (in-direct) GEMMK==1 + const auto gemm_sources_gemmk1 = + "#define MWG 16\n" + "#define NWG 16\n" + "#define GEMMK 1\n" + #include "../src/kernels/level3/xgemm_part1.opencl" + #include "../src/kernels/level3/xgemm_part2.opencl" + #include "../src/kernels/level3/xgemm_part3.opencl" + #include "../src/kernels/level3/xgemm_part4.opencl" + ; + if (TestKernel(device, context, "Xgemm", gemm_sources_gemmk1, precision)) { passed++; } else { errors++; } + // GEMM (direct) const auto gemm_direct_sources = "#define KWID 2\n" diff --git a/test/correctness/testblas.cpp b/test/correctness/testblas.cpp index 3c92565e..d28aba40 100644 --- a/test/correctness/testblas.cpp +++ b/test/correctness/testblas.cpp @@ -239,7 +239,7 @@ void TestBlas<T,U>::TestRegular(std::vector<Arguments<U>> &test_vector, const st } // Tests the error count (should be zero) - TestErrorCount(errors, get_id1_(args)*get_id2_(args), args); + TestErrorCount(errors, get_id1_(args)*get_id2_(args) + kCanarySize, args); } TestEnd(); } diff --git a/test/routines/levelx/xomatcopy.hpp b/test/routines/levelx/xomatcopy.hpp index ea35dbe2..4a93b29d 100644 --- a/test/routines/levelx/xomatcopy.hpp +++ b/test/routines/levelx/xomatcopy.hpp @@ -45,7 +45,9 @@ StatusCode RunReference(const Arguments<T> &args, BuffersHost<T> &buffers_host) const auto b_two = (b_rotated) ? id1 : id2; const auto a_index = a_two * args.a_ld + a_one + args.a_offset; const auto b_index = b_two * args.b_ld + b_one + args.b_offset; - buffers_host.b_mat[b_index] = args.alpha * buffers_host.a_mat[a_index]; + auto a_value = buffers_host.a_mat[a_index]; + if (args.a_transpose == Transpose::kConjugate) { a_value = ComplexConjugate(a_value); } + buffers_host.b_mat[b_index] = args.alpha * a_value; } } return StatusCode::kSuccess; diff --git a/test/test_utilities.cpp b/test/test_utilities.cpp index 59ec949d..c43200b9 100644 --- a/test/test_utilities.cpp +++ b/test/test_utilities.cpp @@ -31,6 +31,16 @@ template <> bool IsCloseToZero(const double2 value) { return IsCloseToZero(value // ================================================================================================= +// Performs a complex conjugate if complex +template <typename T> T ComplexConjugate(const T value) { return value; } +template half ComplexConjugate(const half); +template float ComplexConjugate(const float); +template double ComplexConjugate(const double); +template <> float2 ComplexConjugate(const float2 value) { return float2{value.real(), -value.imag()}; } +template <> double2 ComplexConjugate(const double2 value) { return double2{value.real(), -value.imag()}; } + +// ================================================================================================= + template <typename T, typename U> void DeviceToHost(const Arguments<U> &args, Buffers<T> &buffers, BuffersHost<T> &buffers_host, Queue &queue, const std::vector<std::string> &names) { diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp index 42660bdb..7bf5e65f 100644 --- a/test/test_utilities.hpp +++ b/test/test_utilities.hpp @@ -70,6 +70,10 @@ struct BuffersHost { // ================================================================================================= +template <typename T> T ComplexConjugate(const T value); + +// ================================================================================================= + // Converts a value (e.g. an integer) to a string. This also covers special cases for CLBlast // data-types such as the Layout and Transpose data-types. template <typename T> |