Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Fixed issues in unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OuadiElfarouki committed Feb 29, 2024
1 parent 48545a0 commit 155781d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
30 changes: 16 additions & 14 deletions test/blas_test_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
combination, name_generator) \
class class_name##Float \
: public ::testing::TestWithParam<combination_t<float>> {}; \
TEST_P(class_name##Float, test) { test_function(GetParam()); }; \
TEST_P(class_name##Float, test) { test_function<float>(GetParam()); }; \
INSTANTIATE_TEST_SUITE_P(test_suite, class_name##Float, combination<float>, \
name_generator<float>);

Expand All @@ -63,7 +63,7 @@
combination, name_generator) \
class class_name##Double \
: public ::testing::TestWithParam<combination_t<double>> {}; \
TEST_P(class_name##Double, test) { test_function(GetParam()); }; \
TEST_P(class_name##Double, test) { test_function<double>(GetParam()); }; \
INSTANTIATE_TEST_SUITE_P(test_suite, class_name##Double, \
combination<double>, name_generator<double>);
#else
Expand All @@ -81,7 +81,9 @@
combination, name_generator) \
class class_name##Half \
: public ::testing::TestWithParam<combination_t<cl::sycl::half>> {}; \
TEST_P(class_name##Half, test) { test_function(GetParam()); }; \
TEST_P(class_name##Half, test) { \
test_function<cl::sycl::half>(GetParam()); \
}; \
INSTANTIATE_TEST_SUITE_P(test_suite, class_name##Half, \
combination<cl::sycl::half>, \
name_generator<cl::sycl::half>);
Expand Down Expand Up @@ -177,17 +179,17 @@
* @param combination Combinations object
* @param name_generator Function used to generate test names
*/
#define BLAS_REGISTER_GEMM_TEST_CUSTOM_NAME(test_suite, class_name, \
test_function, combination_t, \
combination, name_generator) \
BLAS_REGISTER_TEST_FLOAT_CUSTOM_NAME(test_suite, class_name##Float, \
test_function<float>, combination_t, \
combination, name_generator); \
BLAS_REGISTER_TEST_DOUBLE_CUSTOM_NAME(test_suite, class_name##Double, \
test_function<double>, combination_t, \
combination, name_generator); \
BLAS_REGISTER_TEST_HALF_FLOAT_CUSTOM_NAME( \
test_suite, class_name##Half, test_function<cl::sycl::half>, \
#define BLAS_REGISTER_GEMM_TEST_CUSTOM_NAME(test_suite, class_name, \
test_function, combination_t, \
combination, name_generator) \
BLAS_REGISTER_TEST_FLOAT_CUSTOM_NAME(test_suite, class_name##Float, \
test_function, combination_t, \
combination, name_generator); \
BLAS_REGISTER_TEST_DOUBLE_CUSTOM_NAME(test_suite, class_name##Double, \
test_function, combination_t, \
combination, name_generator); \
BLAS_REGISTER_TEST_HALF_FLOAT_CUSTOM_NAME( \
test_suite, class_name##Half, test_function<cl::sycl::half>, \
combination_t, combination, name_generator);

#ifdef BLAS_ENABLE_COMPLEX
Expand Down
6 changes: 6 additions & 0 deletions test/unittest/blas3/blas3_gemm_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ inline void verify_gemm(
blas::helper::copy_to_host(q, m_c_gpu, c_m_gpu.data(), buffer_size_c);
sb_handle.wait(event);

// Cast gemm output to match reference library's output type
std::vector<scalar_in_t> c_m_gpu_in(buffer_size_c);
for (int i = 0; i < buffer_size_c; i++) {
c_m_gpu_in[i] = static_cast<scalar_in_t>(c_m_gpu.at(i));
}

const bool isAlmostEqual = utils::compare_vectors(c_m_gpu_in, c_m_cpu);
ASSERT_TRUE(isAlmostEqual);

Expand Down

0 comments on commit 155781d

Please sign in to comment.