diff --git a/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_csr_impl_dpc.cpp b/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_csr_impl_dpc.cpp index 3367947d26f..eaffff9b350 100644 --- a/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_csr_impl_dpc.cpp +++ b/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_csr_impl_dpc.cpp @@ -354,8 +354,13 @@ result_t compute_kernel_csr_impl::operator()(const bk::context_gpu& ctx, if (row_count != cur_row_count) { auto cur_min = result_data_ptr[stat::min * column_count + col_idx]; auto cur_max = result_data_ptr[stat::max * column_count + col_idx]; +#if __SYCL_COMPILER_VERSION >= 20240715 + result_data_ptr[stat::min * column_count + col_idx] = Float(sycl::fmin(cur_min, 0)); + result_data_ptr[stat::max * column_count + col_idx] = Float(sycl::fmax(cur_max, 0)); +#else result_data_ptr[stat::min * column_count + col_idx] = sycl::min(cur_min, 0); result_data_ptr[stat::max * column_count + col_idx] = sycl::max(cur_max, 0); +#endif cur_sum2_cent += Float(row_count - cur_row_count) * mean_val * mean_val; } result_data_ptr[stat::sum2_cent * column_count + col_idx] = cur_sum2_cent; diff --git a/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_dense_impl_dpc.cpp b/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_dense_impl_dpc.cpp index 3eaf2534aa9..4573bd8dff4 100644 --- a/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_dense_impl_dpc.cpp +++ b/cpp/oneapi/dal/algo/basic_statistics/backend/gpu/compute_kernel_dense_impl_dpc.cpp @@ -696,7 +696,11 @@ inline void merge_blocks_kernel(sycl::nd_item<1> item, if constexpr (!DefferedFin) { Float mrgvariance = mrgsum2cent / (mrgvectors - Float(1)); +#if __SYCL_COMPILER_VERSION >= 20240715 + Float mrgstdev = (Float)sycl::sqrt(mrgvariance); +#else Float mrgstdev = (Float)sqrt(mrgvariance); +#endif if constexpr (check_mask_flag(bs_list::sorm, List)) { rsorm_ptr[group_id] = mrgsum2 / mrgvectors; diff --git a/cpp/oneapi/dal/algo/covariance/test/badargs.cpp b/cpp/oneapi/dal/algo/covariance/test/badargs.cpp index 2d776173175..421d8be08e5 100644 --- a/cpp/oneapi/dal/algo/covariance/test/badargs.cpp +++ b/cpp/oneapi/dal/algo/covariance/test/badargs.cpp @@ -43,7 +43,7 @@ using cov_types = COMBINE_TYPES((float, double), (covariance::task::compute)); #define COVARIANCE_BADARG_TEST(name) \ - TEMPLATE_TEST_M(covariance_badarg_test, name, "[covariance][badarg]", cov_types) + TEMPLATE_LIST_TEST_M(covariance_badarg_test, name, "[covariance][badarg]", cov_types) COVARIANCE_BADARG_TEST("throws if input data is empty") { const auto covariance_desc = this->get_descriptor(); diff --git a/cpp/oneapi/dal/algo/dbscan/test/badarg.cpp b/cpp/oneapi/dal/algo/dbscan/test/badarg.cpp index 43e07196fb8..51788c327cb 100644 --- a/cpp/oneapi/dal/algo/dbscan/test/badarg.cpp +++ b/cpp/oneapi/dal/algo/dbscan/test/badarg.cpp @@ -26,9 +26,11 @@ namespace oneapi::dal::dbscan::test { namespace te = dal::test::engine; -template +template class dbscan_badarg_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count = 5; static constexpr std::int64_t bad_weight_element_count = 2; @@ -64,8 +66,10 @@ class dbscan_badarg_test : public te::algo_fixture { static constexpr std::array bad_weights_ = { 1.0, 1.0 }; }; +using dbscan_types = COMBINE_TYPES((float, double), (dbscan::method::brute_force)); + #define DBSCAN_BADARG_TEST(name) \ - TEMPLATE_TEST_M(dbscan_badarg_test, name, "[dbscan][badarg]", method::brute_force) + TEMPLATE_LIST_TEST_M(dbscan_badarg_test, name, "[dbscan][badarg]", dbscan_types) DBSCAN_BADARG_TEST("accepts positive min observations") { REQUIRE_NOTHROW(this->get_descriptor().set_min_observations(1)); diff --git a/cpp/oneapi/dal/algo/kmeans/test/badarg.cpp b/cpp/oneapi/dal/algo/kmeans/test/badarg.cpp index 481b032a387..a34d4a8674b 100644 --- a/cpp/oneapi/dal/algo/kmeans/test/badarg.cpp +++ b/cpp/oneapi/dal/algo/kmeans/test/badarg.cpp @@ -27,9 +27,11 @@ namespace oneapi::dal::kmeans::test { namespace te = dal::test::engine; -template +template class kmeans_badarg_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count = 8; static constexpr std::int64_t column_count = 2; static constexpr std::int64_t element_count = row_count * column_count; @@ -106,8 +108,10 @@ class kmeans_badarg_test : public te::algo_fixture { }; }; +using kmeans_types = COMBINE_TYPES((float, double), (kmeans::method::lloyd_dense)); + #define KMEANS_BADARG_TEST(name) \ - TEMPLATE_TEST_M(kmeans_badarg_test, name, "[kmeans][badarg]", method::lloyd_dense) + TEMPLATE_LIST_TEST_M(kmeans_badarg_test, name, "[kmeans][badarg]", kmeans_types) KMEANS_BADARG_TEST("accepts positive cluster_count") { REQUIRE_NOTHROW(this->get_descriptor().set_cluster_count(1)); diff --git a/cpp/oneapi/dal/algo/linear_kernel/test/badargs.cpp b/cpp/oneapi/dal/algo/linear_kernel/test/badargs.cpp index 13fd31307f7..10340ee02f7 100644 --- a/cpp/oneapi/dal/algo/linear_kernel/test/badargs.cpp +++ b/cpp/oneapi/dal/algo/linear_kernel/test/badargs.cpp @@ -26,9 +26,11 @@ namespace oneapi::dal::linear_kernel::test { namespace te = dal::test::engine; -template +template class linear_kernel_badarg_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 5; static constexpr std::int64_t row_count_y = 3; static constexpr std::int64_t column_count = 4; @@ -62,11 +64,13 @@ class linear_kernel_badarg_test : public te::algo_fixture { -2.0, -1.0, -2.0, -2.0 }; }; -#define LINEAR_KERNEL_BADARG_TEST(name) \ - TEMPLATE_TEST_M(linear_kernel_badarg_test, \ - name, \ - "[linear_kernel][badarg]", \ - linear_kernel::method::dense) +using lr_kernel_types = COMBINE_TYPES((float, double), (linear_kernel::method::dense)); + +#define LINEAR_KERNEL_BADARG_TEST(name) \ + TEMPLATE_LIST_TEST_M(linear_kernel_badarg_test, \ + name, \ + "[linear_kernel][badarg]", \ + lr_kernel_types) LINEAR_KERNEL_BADARG_TEST("throws if x data is empty") { const auto linear_kernel_desc = this->get_descriptor(); diff --git a/cpp/oneapi/dal/algo/linear_kernel/test/overflow.cpp b/cpp/oneapi/dal/algo/linear_kernel/test/overflow.cpp index b077823efb3..5ab53e1fe0c 100644 --- a/cpp/oneapi/dal/algo/linear_kernel/test/overflow.cpp +++ b/cpp/oneapi/dal/algo/linear_kernel/test/overflow.cpp @@ -25,9 +25,11 @@ namespace oneapi::dal::linear_kernel::test { namespace te = dal::test::engine; -template +template class linear_kernel_overflow_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 0x7FFFFFFFF; static constexpr std::int64_t row_count_y = 0x7FFFFFFFF; static constexpr std::int64_t column_count = 2; @@ -45,11 +47,13 @@ class linear_kernel_overflow_test : public te::algo_fixture { } }; -#define LINEAR_KERNEL_OVERFLOW_TEST(name) \ - TEMPLATE_TEST_M(linear_kernel_overflow_test, \ - name, \ - "[linear_kernel][overflow]", \ - linear_kernel::method::dense) +using lr_kernel_types = COMBINE_TYPES((float, double), (linear_kernel::method::dense)); + +#define LINEAR_KERNEL_OVERFLOW_TEST(name) \ + TEMPLATE_LIST_TEST_M(linear_kernel_overflow_test, \ + name, \ + "[linear_kernel][overflow]", \ + lr_kernel_types) LINEAR_KERNEL_OVERFLOW_TEST("compute throws if result values table leads to overflow") { const auto linear_kernel_desc = this->get_descriptor(); diff --git a/cpp/oneapi/dal/algo/pca/backend/test/sign_flip.cpp b/cpp/oneapi/dal/algo/pca/backend/test/sign_flip.cpp index bcdd6f14aa6..77518cc558d 100644 --- a/cpp/oneapi/dal/algo/pca/backend/test/sign_flip.cpp +++ b/cpp/oneapi/dal/algo/pca/backend/test/sign_flip.cpp @@ -56,7 +56,9 @@ class sign_flip_test { } }; -TEMPLATE_TEST_M(sign_flip_test, "flips if all negative", "[negative]", float, double) { +using data_types = std::tuple; + +TEMPLATE_LIST_TEST_M(sign_flip_test, "flips if all negative", "[negative]", data_types) { auto data = this->get_negative_data(); sign_flip(data); @@ -64,7 +66,7 @@ TEMPLATE_TEST_M(sign_flip_test, "flips if all negative", "[negative]", float, do this->check_if_flipped_data_positive(this->get_negative_data(), data); } -TEMPLATE_TEST_M(sign_flip_test, "does not flips if all positive", "[positive]", float, double) { +TEMPLATE_LIST_TEST_M(sign_flip_test, "does not flips if all positive", "[positive]", data_types) { auto data = this->get_positive_data(); sign_flip(data); diff --git a/cpp/oneapi/dal/algo/pca/test/badarg.cpp b/cpp/oneapi/dal/algo/pca/test/badarg.cpp index 6de97954418..170fc7cf62b 100644 --- a/cpp/oneapi/dal/algo/pca/test/badarg.cpp +++ b/cpp/oneapi/dal/algo/pca/test/badarg.cpp @@ -27,9 +27,11 @@ namespace oneapi::dal::pca::test { namespace te = dal::test::engine; -template +template class pca_badarg_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count = 8; static constexpr std::int64_t column_count = 2; static constexpr std::int64_t element_count = row_count * column_count; @@ -60,8 +62,10 @@ class pca_badarg_test : public te::algo_fixture { }; }; +using pca_types = COMBINE_TYPES((float, double), (pca::method::cov, pca::method::svd)); + #define PCA_BADARG_TEST(name) \ - TEMPLATE_TEST_M(pca_badarg_test, name, "[pca][badarg]", pca::method::cov, pca::method::svd) + TEMPLATE_LIST_TEST_M(pca_badarg_test, name, "[pca][badarg]", pca_types) PCA_BADARG_TEST("accepts non-negative component_count") { REQUIRE_NOTHROW(this->get_descriptor().set_component_count(0)); diff --git a/cpp/oneapi/dal/algo/pca/test/overflow.cpp b/cpp/oneapi/dal/algo/pca/test/overflow.cpp index cc5ca82015f..46c4d26fbcc 100644 --- a/cpp/oneapi/dal/algo/pca/test/overflow.cpp +++ b/cpp/oneapi/dal/algo/pca/test/overflow.cpp @@ -26,9 +26,11 @@ namespace oneapi::dal::pca::test { namespace te = dal::test::engine; -template +template class pca_overflow_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count = 8; static constexpr std::int64_t column_count = 2; static constexpr std::int64_t invalid_component_count = 0x7FFFFFFFFFFFFFFF; @@ -52,8 +54,10 @@ class pca_overflow_test : public te::algo_fixture { } }; // namespace oneapi::dal::pca::test +using pca_types = COMBINE_TYPES((float, double), (pca::method::cov, pca::method::svd)); + #define PCA_OVERFLOW_TEST(name) \ - TEMPLATE_TEST_M(pca_overflow_test, name, "[pca][overflow]", pca::method::cov, pca::method::svd) + TEMPLATE_LIST_TEST_M(pca_overflow_test, name, "[pca][overflow]", pca_types) PCA_OVERFLOW_TEST("train throws if component count leads to overflow") { const auto pca_desc = this->get_descriptor_with_invalid_component_count(); diff --git a/cpp/oneapi/dal/algo/polynomial_kernel/test/badargs.cpp b/cpp/oneapi/dal/algo/polynomial_kernel/test/badargs.cpp index 4b5fb0008ef..3ff318ce95d 100644 --- a/cpp/oneapi/dal/algo/polynomial_kernel/test/badargs.cpp +++ b/cpp/oneapi/dal/algo/polynomial_kernel/test/badargs.cpp @@ -26,9 +26,11 @@ namespace oneapi::dal::polynomial_kernel::test { namespace te = dal::test::engine; -template +template class polynomial_kernel_badarg_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 5; static constexpr std::int64_t row_count_y = 3; static constexpr std::int64_t column_count = 4; @@ -66,11 +68,13 @@ class polynomial_kernel_badarg_test : public te::algo_fixture { -2.0, -1.0, -2.0, -2.0 }; }; -#define POLYNOMIAL_KERNEL_BADARG_TEST(name) \ - TEMPLATE_TEST_M(polynomial_kernel_badarg_test, \ - name, \ - "[polynomial_kernel][badarg]", \ - polynomial_kernel::method::dense) +using pol_kernel_types = COMBINE_TYPES((float, double), (polynomial_kernel::method::dense)); + +#define POLYNOMIAL_KERNEL_BADARG_TEST(name) \ + TEMPLATE_LIST_TEST_M(polynomial_kernel_badarg_test, \ + name, \ + "[polynomial_kernel][badarg]", \ + pol_kernel_types) POLYNOMIAL_KERNEL_BADARG_TEST("accepts positive degree") { SKIP_IF(this->not_available_on_device()); diff --git a/cpp/oneapi/dal/algo/polynomial_kernel/test/overflow.cpp b/cpp/oneapi/dal/algo/polynomial_kernel/test/overflow.cpp index 4555f02acfc..90014940819 100644 --- a/cpp/oneapi/dal/algo/polynomial_kernel/test/overflow.cpp +++ b/cpp/oneapi/dal/algo/polynomial_kernel/test/overflow.cpp @@ -25,9 +25,11 @@ namespace oneapi::dal::polynomial_kernel::test { namespace te = dal::test::engine; -template +template class polynomial_kernel_overflow_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 0x7FFFFFFFF; static constexpr std::int64_t row_count_y = 0x7FFFFFFFF; static constexpr std::int64_t column_count = 2; @@ -49,11 +51,13 @@ class polynomial_kernel_overflow_test : public te::algo_fixture { } }; -#define POLYNOMIAL_KERNEL_OVERFLOW_TEST(name) \ - TEMPLATE_TEST_M(polynomial_kernel_overflow_test, \ - name, \ - "[polynomial_kernel][overflow]", \ - polynomial_kernel::method::dense) +using polynomial_kernel_types = COMBINE_TYPES((float, double), (polynomial_kernel::method::dense)); + +#define POLYNOMIAL_KERNEL_OVERFLOW_TEST(name) \ + TEMPLATE_LIST_TEST_M(polynomial_kernel_overflow_test, \ + name, \ + "[polynomial_kernel][overflow]", \ + polynomial_kernel_types) POLYNOMIAL_KERNEL_OVERFLOW_TEST("compute throws if result values table leads to overflow") { SKIP_IF(this->not_available_on_device()); diff --git a/cpp/oneapi/dal/algo/rbf_kernel/test/badargs.cpp b/cpp/oneapi/dal/algo/rbf_kernel/test/badargs.cpp index 37e76faef5a..02d5c3c71c4 100644 --- a/cpp/oneapi/dal/algo/rbf_kernel/test/badargs.cpp +++ b/cpp/oneapi/dal/algo/rbf_kernel/test/badargs.cpp @@ -26,9 +26,11 @@ namespace oneapi::dal::rbf_kernel::test { namespace te = dal::test::engine; -template +template class rbf_kernel_badarg_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 5; static constexpr std::int64_t row_count_y = 3; static constexpr std::int64_t column_count = 4; @@ -62,8 +64,10 @@ class rbf_kernel_badarg_test : public te::algo_fixture { -2.0, -1.0, -2.0, -2.0 }; }; +using rbf_kernel_types = COMBINE_TYPES((float, double), (rbf_kernel::method::dense)); + #define RBF_KERNEL_BADARG_TEST(name) \ - TEMPLATE_TEST_M(rbf_kernel_badarg_test, name, "[rbf_kernel][badarg]", rbf_kernel::method::dense) + TEMPLATE_LIST_TEST_M(rbf_kernel_badarg_test, name, "[rbf_kernel][badarg]", rbf_kernel_types) RBF_KERNEL_BADARG_TEST("accepts positive sigma") { REQUIRE_NOTHROW(this->get_descriptor().set_sigma(3)); diff --git a/cpp/oneapi/dal/algo/rbf_kernel/test/overflow.cpp b/cpp/oneapi/dal/algo/rbf_kernel/test/overflow.cpp index 0973606447a..27bb0682473 100644 --- a/cpp/oneapi/dal/algo/rbf_kernel/test/overflow.cpp +++ b/cpp/oneapi/dal/algo/rbf_kernel/test/overflow.cpp @@ -25,9 +25,11 @@ namespace oneapi::dal::rbf_kernel::test { namespace te = dal::test::engine; -template +template class rbf_kernel_overflow_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 0x7FFFFFFFF; static constexpr std::int64_t row_count_y = 0x7FFFFFFFF; static constexpr std::int64_t column_count = 2; @@ -45,11 +47,10 @@ class rbf_kernel_overflow_test : public te::algo_fixture { } }; -#define RBF_KERNEL_OVERFLOW_TEST(name) \ - TEMPLATE_TEST_M(rbf_kernel_overflow_test, \ - name, \ - "[rbf_kernel][overflow]", \ - rbf_kernel::method::dense) +using rbf_kernel_types = COMBINE_TYPES((float, double), (rbf_kernel::method::dense)); + +#define RBF_KERNEL_OVERFLOW_TEST(name) \ + TEMPLATE_LIST_TEST_M(rbf_kernel_overflow_test, name, "[rbf_kernel][overflow]", rbf_kernel_types) RBF_KERNEL_OVERFLOW_TEST("compute throws if result values table leads to overflow") { const auto rbf_kernel_desc = this->get_descriptor(); diff --git a/cpp/oneapi/dal/algo/sigmoid_kernel/test/badargs.cpp b/cpp/oneapi/dal/algo/sigmoid_kernel/test/badargs.cpp index 48cc8f310fb..56c9e290205 100644 --- a/cpp/oneapi/dal/algo/sigmoid_kernel/test/badargs.cpp +++ b/cpp/oneapi/dal/algo/sigmoid_kernel/test/badargs.cpp @@ -26,9 +26,11 @@ namespace oneapi::dal::sigmoid_kernel::test { namespace te = dal::test::engine; -template +template class sigmoid_kernel_badarg_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 5; static constexpr std::int64_t row_count_y = 3; static constexpr std::int64_t column_count = 4; @@ -66,11 +68,13 @@ class sigmoid_kernel_badarg_test : public te::algo_fixture { -2.0, -1.0, -2.0, -2.0 }; }; -#define SIGMOID_KERNEL_BADARG_TEST(name) \ - TEMPLATE_TEST_M(sigmoid_kernel_badarg_test, \ - name, \ - "[sigmoid_kernel][badarg]", \ - sigmoid_kernel::method::dense) +using sigmoid_kernel_types = COMBINE_TYPES((float, double), (sigmoid_kernel::method::dense)); + +#define SIGMOID_KERNEL_BADARG_TEST(name) \ + TEMPLATE_LIST_TEST_M(sigmoid_kernel_badarg_test, \ + name, \ + "[sigmoid_kernel][badarg]", \ + sigmoid_kernel_types) SIGMOID_KERNEL_BADARG_TEST("throws if x data is empty") { SKIP_IF(this->not_available_on_device()); diff --git a/cpp/oneapi/dal/algo/sigmoid_kernel/test/overflow.cpp b/cpp/oneapi/dal/algo/sigmoid_kernel/test/overflow.cpp index def94dc81a5..3d3cd482233 100644 --- a/cpp/oneapi/dal/algo/sigmoid_kernel/test/overflow.cpp +++ b/cpp/oneapi/dal/algo/sigmoid_kernel/test/overflow.cpp @@ -25,9 +25,11 @@ namespace oneapi::dal::sigmoid_kernel::test { namespace te = dal::test::engine; -template +template class sigmoid_kernel_overflow_test : public te::algo_fixture { public: + using Float = std::tuple_element_t<0, TestType>; + using Method = std::tuple_element_t<1, TestType>; static constexpr std::int64_t row_count_x = 0x7FFFFFFFF; static constexpr std::int64_t row_count_y = 0x7FFFFFFFF; static constexpr std::int64_t column_count = 2; @@ -49,11 +51,13 @@ class sigmoid_kernel_overflow_test : public te::algo_fixture { } }; -#define SIGMOID_KERNEL_OVERFLOW_TEST(name) \ - TEMPLATE_TEST_M(sigmoid_kernel_overflow_test, \ - name, \ - "[sigmoid_kernel][overflow]", \ - sigmoid_kernel::method::dense) +using sigmoid_kernel_types = COMBINE_TYPES((float, double), (sigmoid_kernel::method::dense)); + +#define SIGMOID_KERNEL_OVERFLOW_TEST(name) \ + TEMPLATE_LIST_TEST_M(sigmoid_kernel_overflow_test, \ + name, \ + "[sigmoid_kernel][overflow]", \ + sigmoid_kernel_types) SIGMOID_KERNEL_OVERFLOW_TEST("compute throws if result values table leads to overflow") { SKIP_IF(this->not_available_on_device()); diff --git a/cpp/oneapi/dal/backend/micromkl/macro.hpp b/cpp/oneapi/dal/backend/micromkl/macro.hpp index d4e8b484309..35b24d3e701 100644 --- a/cpp/oneapi/dal/backend/micromkl/macro.hpp +++ b/cpp/oneapi/dal/backend/micromkl/macro.hpp @@ -23,8 +23,8 @@ #error "This header cannot be included outside of micromkl module" #endif -#define STRINGIFY(x) #x -#define EXPAND(...) __VA_ARGS__ +#define STRINGIFY(x) #x +#define DAL_EXPAND(...) __VA_ARGS__ #ifdef ONEDAL_REF #define FUNC_NAME(prefix, name) name @@ -54,20 +54,20 @@ DISPATCH_FUNC_CPU(nominal_cpu, actual_cpu, prefix, name, argdecl, argcall) #if defined(TARGET_X86_64) -#define FUNC_AVX512(...) EXPAND(FUNC_CPU(avx512, avx512, __VA_ARGS__)) -#define FUNC_AVX2(...) EXPAND(FUNC_CPU(avx2, avx2, __VA_ARGS__)) +#define FUNC_AVX512(...) DAL_EXPAND(FUNC_CPU(avx512, avx512, __VA_ARGS__)) +#define FUNC_AVX2(...) DAL_EXPAND(FUNC_CPU(avx2, avx2, __VA_ARGS__)) #elif defined(TARGET_ARM) -#define FUNC_A8SVE(...) EXPAND(FUNC_CPU(sve, sve, __VA_ARGS__)) +#define FUNC_A8SVE(...) DAL_EXPAND(FUNC_CPU(sve, sve, __VA_ARGS__)) #elif defined(TARGET_RISCV64) -#define FUNC_RV64(...) EXPAND(FUNC_CPU(rv64, rv64, __VA_ARGS__)) +#define FUNC_RV64(...) DAL_EXPAND(FUNC_CPU(rv64, rv64, __VA_ARGS__)) #endif #ifdef __APPLE__ -#define FUNC_SSE42(...) EXPAND(FUNC_CPU(sse42, avx2, __VA_ARGS__)) -#define FUNC_SSE2(...) EXPAND(FUNC_CPU(sse2, avx2, __VA_ARGS__)) +#define FUNC_SSE42(...) DAL_EXPAND(FUNC_CPU(sse42, avx2, __VA_ARGS__)) +#define FUNC_SSE2(...) DAL_EXPAND(FUNC_CPU(sse2, avx2, __VA_ARGS__)) #else -#define FUNC_SSE42(...) EXPAND(FUNC_CPU(sse42, sse42, __VA_ARGS__)) -#define FUNC_SSE2(...) EXPAND(FUNC_CPU(sse2, sse2, __VA_ARGS__)) +#define FUNC_SSE42(...) DAL_EXPAND(FUNC_CPU(sse42, sse42, __VA_ARGS__)) +#define FUNC_SSE2(...) DAL_EXPAND(FUNC_CPU(sse2, sse2, __VA_ARGS__)) #endif #if defined(TARGET_X86_64) @@ -103,36 +103,36 @@ template void name argdecl(Float); #ifdef ONEDAL_CPU_DISPATCH_A8SVE -#define INSTANTIATE_A8SVE(...) EXPAND(INSTANTIATE_CPU(sve, __VA_ARGS__)) +#define INSTANTIATE_A8SVE(...) DAL_EXPAND(INSTANTIATE_CPU(sve, __VA_ARGS__)) #else #define INSTANTIATE_A8SVE(...) #endif #ifdef ONEDAL_CPU_DISPATCH_AVX512 -#define INSTANTIATE_AVX512(...) EXPAND(INSTANTIATE_CPU(avx512, __VA_ARGS__)) +#define INSTANTIATE_AVX512(...) DAL_EXPAND(INSTANTIATE_CPU(avx512, __VA_ARGS__)) #else #define INSTANTIATE_AVX512(...) #endif #ifdef ONEDAL_CPU_DISPATCH_AVX2 -#define INSTANTIATE_AVX2(...) EXPAND(INSTANTIATE_CPU(avx2, __VA_ARGS__)) +#define INSTANTIATE_AVX2(...) DAL_EXPAND(INSTANTIATE_CPU(avx2, __VA_ARGS__)) #else #define INSTANTIATE_AVX2(...) #endif #ifdef ONEDAL_CPU_DISPATCH_SSE42 -#define INSTANTIATE_SSE42(...) EXPAND(INSTANTIATE_CPU(sse42, __VA_ARGS__)) +#define INSTANTIATE_SSE42(...) DAL_EXPAND(INSTANTIATE_CPU(sse42, __VA_ARGS__)) #else #define INSTANTIATE_SSE42(...) #endif #ifdef ONEDAL_CPU_DISPATCH_RV64 -#define INSTANTIATE_RV64(...) EXPAND(INSTANTIATE_CPU(rv64, __VA_ARGS__)) +#define INSTANTIATE_RV64(...) DAL_EXPAND(INSTANTIATE_CPU(rv64, __VA_ARGS__)) #else #define INSTANTIATE_RV64(...) #endif -#define INSTANTIATE_SSE2(...) EXPAND(INSTANTIATE_CPU(sse2, __VA_ARGS__)) +#define INSTANTIATE_SSE2(...) DAL_EXPAND(INSTANTIATE_CPU(sse2, __VA_ARGS__)) #if defined(TARGET_X86_64) #define INSTANTIATE_FLOAT(name, Float, argdecl) \ diff --git a/cpp/oneapi/dal/backend/primitives/lapack/test/eigen.cpp b/cpp/oneapi/dal/backend/primitives/lapack/test/eigen.cpp index 663cc3caddd..6a6a0b44bbc 100644 --- a/cpp/oneapi/dal/backend/primitives/lapack/test/eigen.cpp +++ b/cpp/oneapi/dal/backend/primitives/lapack/test/eigen.cpp @@ -132,8 +132,10 @@ class sym_eigvals_test { static constexpr int seed_ = 7777; }; +using eigen_types = COMBINE_TYPES((float, double)); + #define SYM_EIGVALS_TEST(name) \ - TEMPLATE_TEST_M(sym_eigvals_test, name, "[sym_eigvals]", float, double) + TEMPLATE_LIST_TEST_M(sym_eigvals_test, name, "[sym_eigvals]", eigen_types) SYM_EIGVALS_TEST("check inplace sym_eigvals on symmetric positive-definite matrix") { const auto s = this->generate_symmetric_positive(); diff --git a/cpp/oneapi/dal/backend/primitives/optimizers/test/cg_solver_dpc.cpp b/cpp/oneapi/dal/backend/primitives/optimizers/test/cg_solver_dpc.cpp index 4989f0ca1fc..ea320f690a2 100644 --- a/cpp/oneapi/dal/backend/primitives/optimizers/test/cg_solver_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/optimizers/test/cg_solver_dpc.cpp @@ -108,14 +108,13 @@ class cg_solver_test : public te::float_algo_fixture { ndarray b_host_; }; -TEMPLATE_TEST_M(cg_solver_test, "test with stable matrix - double", "[cg-solver][gpu]", double) { - SKIP_IF(this->not_float64_friendly()); - SKIP_IF(this->get_policy().is_cpu()); - this->gen_input(); - this->test_cg_solver(); -} +using cg_solver_types = COMBINE_TYPES((float, double)); -TEMPLATE_TEST_M(cg_solver_test, "test with stable matrix - float", "[cg-solver][gpu]", float) { +TEMPLATE_LIST_TEST_M(cg_solver_test, + "test with stable matrix", + "[cg-solver][gpu]", + cg_solver_types) { + SKIP_IF(this->not_float64_friendly()); SKIP_IF(this->get_policy().is_cpu()); this->gen_input(); this->test_cg_solver(); diff --git a/cpp/oneapi/dal/backend/primitives/optimizers/test/newton_cg_dpc.cpp b/cpp/oneapi/dal/backend/primitives/optimizers/test/newton_cg_dpc.cpp index 62dd0140e28..f473dddf1f7 100644 --- a/cpp/oneapi/dal/backend/primitives/optimizers/test/newton_cg_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/optimizers/test/newton_cg_dpc.cpp @@ -219,38 +219,22 @@ class newton_cg_test : public te::float_algo_fixture { ndarray b_; }; -TEMPLATE_TEST_M(newton_cg_test, - "test newton-cg with stable matrix - float", - "[newton-cg][gpu]", - float) { - SKIP_IF(this->get_policy().is_cpu()); - this->gen_and_test_quadratic_function(); - this->test_newton_cg(); -} +using newton_cg_types = COMBINE_TYPES((float, double)); -TEMPLATE_TEST_M(newton_cg_test, - "test newton-cg with stable matrix - double", - "[newton-cg][gpu]", - double) { +TEMPLATE_LIST_TEST_M(newton_cg_test, + "test newton-cg with stable matrix", + "[newton-cg][gpu]", + newton_cg_types) { SKIP_IF(this->not_float64_friendly()); SKIP_IF(this->get_policy().is_cpu()); this->gen_and_test_quadratic_function(); this->test_newton_cg(); } -TEMPLATE_TEST_M(newton_cg_test, - "test newton-cg with logloss function - double", - "[newton-cg][gpu]", - double) { - SKIP_IF(this->not_float64_friendly()); - SKIP_IF(this->get_policy().is_cpu()); - this->gen_and_test_logistic_loss(); -} - -TEMPLATE_TEST_M(newton_cg_test, - "test newton-cg with logloss function - float", - "[newton-cg][gpu]", - float) { +TEMPLATE_LIST_TEST_M(newton_cg_test, + "test newton-cg with logloss function", + "[newton-cg][gpu]", + newton_cg_types) { SKIP_IF(this->not_float64_friendly()); SKIP_IF(this->get_policy().is_cpu()); this->gen_and_test_logistic_loss(); diff --git a/cpp/oneapi/dal/backend/primitives/sort/test/sort_dpc.cpp b/cpp/oneapi/dal/backend/primitives/sort/test/sort_dpc.cpp index 02fd315712d..8875f828975 100644 --- a/cpp/oneapi/dal/backend/primitives/sort/test/sort_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/sort/test/sort_dpc.cpp @@ -209,7 +209,9 @@ TEMPLATE_LIST_TEST_M(sort_with_indices_test, this->check_sort(val, ind); } -TEMPLATE_TEST_M(sort_test, "basic sort", "[sort]", std::int32_t, std::uint32_t) { +using sort_indices_types_int = COMBINE_TYPES((std::int32_t, std::uint32_t)); + +TEMPLATE_LIST_TEST_M(sort_test, "basic sort", "[sort]", sort_indices_types_int) { SKIP_IF(this->get_policy().is_cpu()); std::int64_t vector_count = GENERATE_COPY(1, 128); diff --git a/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp b/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp index f39d21251c3..0f0bb8e99dd 100644 --- a/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp +++ b/cpp/oneapi/dal/backend/primitives/stat/test/cov_dpc.cpp @@ -211,7 +211,9 @@ class cov_test : public te::float_algo_fixture { } }; -TEMPLATE_TEST_M(cov_test, "correlation on diagonal data", "[cor]", float, double) { +using cov_types = COMBINE_TYPES((float, double)); + +TEMPLATE_LIST_TEST_M(cov_test, "correlation on diagonal data", "[cor]", cov_types) { using float_t = TestType; using dim2_t = std::tuple; @@ -285,7 +287,9 @@ TEMPLATE_TEST_M(cov_test, "correlation on diagonal data", "[cor]", float, double } } -TEMPLATE_TEST_M(cov_test, "correlation on one-row table", "[cor]", float) { +using cov_types_one_row = COMBINE_TYPES((float)); + +TEMPLATE_LIST_TEST_M(cov_test, "correlation on one-row table", "[cor]", cov_types_one_row) { using float_t = TestType; // DPC++ GEMM used underneath correlation is not supported on GPU SKIP_IF(this->get_policy().is_cpu()); @@ -327,7 +331,8 @@ TEMPLATE_TEST_M(cov_test, "correlation on one-row table", "[cor]", float) { var_event.wait_and_throw(); this->check_constant_variance(vars, 1, 0.0); } -TEMPLATE_TEST_M(cov_test, "correlation on gold data", "[cor]", float, double) { + +TEMPLATE_LIST_TEST_M(cov_test, "correlation on gold data", "[cor]", cov_types) { using float_t = TestType; SKIP_IF(this->get_policy().is_cpu()); SKIP_IF(this->not_float64_friendly()); diff --git a/cpp/oneapi/dal/backend/primitives/test/ndarray.cpp b/cpp/oneapi/dal/backend/primitives/test/ndarray.cpp index 117b4f7a95a..6b3b56f6808 100644 --- a/cpp/oneapi/dal/backend/primitives/test/ndarray.cpp +++ b/cpp/oneapi/dal/backend/primitives/test/ndarray.cpp @@ -23,7 +23,9 @@ namespace oneapi::dal::backend::primitives::test { namespace la = dal::test::engine::linalg; -#define ENUMERATE_AXIS_COUNT_123 ((std::int64_t axis_count), axis_count), 1, 2, 3 +#define ENUMERATE_AXIS_COUNT_123 \ + ((typename T, std::int64_t axis_count), T, axis_count), (std::int64_t, 1), (std::int64_t, 2), \ + (std::int64_t, 3) class ndarray_test { public: @@ -139,7 +141,6 @@ TEST("ndarray has correct default strides in f-order", "[ndarray_base]") { TEMPLATE_SIG_TEST("can create empty ndview", "[ndview]", ENUMERATE_AXIS_COUNT_123) { const auto x = ndview{}; - REQUIRE(x.has_data() == false); REQUIRE(x.get_count() == 0); REQUIRE(x.get_data() == nullptr); diff --git a/cpp/oneapi/dal/table/test/homogen_serialization.cpp b/cpp/oneapi/dal/table/test/homogen_serialization.cpp index 8cb1131a5c8..08fd18e6f6a 100644 --- a/cpp/oneapi/dal/table/test/homogen_serialization.cpp +++ b/cpp/oneapi/dal/table/test/homogen_serialization.cpp @@ -130,12 +130,12 @@ TEST_M(empty_homogen_table_serialization_test, "serialize/deserialize empty homo check_table_serialization(empty_table); } -TEMPLATE_TEST_M(homogen_table_serialization_test, - "serialize/deserialize host homogen table", - "[host]", - float, - double, - std::int32_t) { +using homogen_table_types = COMBINE_TYPES((float, double, std::int32_t)); + +TEMPLATE_LIST_TEST_M(homogen_table_serialization_test, + "serialize/deserialize host homogen table", + "[host]", + homogen_table_types) { const std::int64_t row_count = GENERATE(1, 10, 1000); const std::int64_t column_count = GENERATE(1, 10, 100); const homogen_table original = this->get_host_backed_table(row_count, column_count); @@ -144,12 +144,10 @@ TEMPLATE_TEST_M(homogen_table_serialization_test, } #ifdef ONEDAL_DATA_PARALLEL -TEMPLATE_TEST_M(homogen_table_serialization_test, - "serialize/deserialize device homogen table", - "[host]", - float, - double, - std::int32_t) { +TEMPLATE_LIST_TEST_M(homogen_table_serialization_test, + "serialize/deserialize device homogen table", + "[host]", + homogen_table_types) { const std::int64_t row_count = GENERATE(1, 10, 1000); const std::int64_t column_count = GENERATE(1, 10, 100); const homogen_table original = this->get_device_backed_table(row_count, column_count); diff --git a/cpp/oneapi/dal/test/archives.cpp b/cpp/oneapi/dal/test/archives.cpp index 73262b3c613..745e82ec605 100644 --- a/cpp/oneapi/dal/test/archives.cpp +++ b/cpp/oneapi/dal/test/archives.cpp @@ -18,17 +18,16 @@ #include "oneapi/dal/detail/array_utils.hpp" #include "oneapi/dal/detail/archives.hpp" #include "oneapi/dal/test/engine/common.hpp" +#include "oneapi/dal/test/engine/fixtures.hpp" #include "oneapi/dal/test/engine/serialization.hpp" namespace oneapi::dal::test { namespace te = dal::test::engine; -TEMPLATE_TEST("can write to binary_ouput_archive", - "[binary_ouput_archive]", - float, - double, - std::int32_t) { +using archives_types = std::tuple; + +TEMPLATE_LIST_TEST("can write to binary_ouput_archive", "[binary_ouput_archive]", archives_types) { detail::binary_output_archive archive; SECTION("single value") { @@ -57,11 +56,7 @@ TEMPLATE_TEST("can write to binary_ouput_archive", } } -TEMPLATE_TEST("can read from binary_input_archive", - "[binary_input_archive]", - float, - double, - std::int32_t) { +TEMPLATE_LIST_TEST("can read from binary_input_archive", "[binary_input_archive]", archives_types) { SECTION("singe value") { const TestType original = TestType(3.14); @@ -95,11 +90,7 @@ TEMPLATE_TEST("can read from binary_input_archive", } } -TEMPLATE_TEST("serialize/deserialize array to binary archive", - "[array]", - float, - double, - std::int32_t) { +TEMPLATE_LIST_TEST("serialize/deserialize array to binary archive", "[array]", archives_types) { const std::int64_t count = 100; const auto original = array::empty(count); for (std::int64_t i = 0; i < count; i++) { @@ -123,7 +114,9 @@ TEMPLATE_TEST("serialize/deserialize array to binary archive", } } -TEST("binary_input_archive throws if truncated data buffer is provided", "[binary_input_archive]") { +TEMPLATE_LIST_TEST("binary_input_archive throws if truncated data buffer is provided", + "[binary_input_archive]", + archives_types) { const std::int64_t count = 100; const auto original = array::empty(count); for (std::int64_t i = 0; i < count; i++) { diff --git a/cpp/oneapi/dal/test/array_serialization.cpp b/cpp/oneapi/dal/test/array_serialization.cpp index df379a7eba9..b16e841bc41 100644 --- a/cpp/oneapi/dal/test/array_serialization.cpp +++ b/cpp/oneapi/dal/test/array_serialization.cpp @@ -26,7 +26,7 @@ namespace te = dal::test::engine; namespace la = te::linalg; template -class array_serialization_test : te::policy_fixture { +class array_serialization_test : te::algo_fixture { public: array get_empty_array() { return array{}; @@ -110,11 +110,12 @@ TEMPLATE_LIST_TEST_M(array_serialization_test, } #endif -TEMPLATE_TEST_M(array_serialization_test, - "deserialize array to wrong type", - "[badarg]", - float, - double) { +using array_types_float = std::tuple; + +TEMPLATE_LIST_TEST_M(array_serialization_test, + "deserialize array to wrong type", + "[badarg]", + array_types_float) { const std::int64_t count = 10; const auto host_array = this->get_host_backed_array(count); diff --git a/makefile b/makefile index 9cfd463f8bb..0def208b0e0 100644 --- a/makefile +++ b/makefile @@ -284,16 +284,6 @@ mklgpufpk.HEADERS := $(MKLGPUFPKDIR.include)/mkl_dal_sycl.hpp $(MKLGPUFPKDIR.inc include dev/make/deps.$(BACKEND_CONFIG).mk -#============================= oneAPI folders ===================================== -ifeq ($(if $(or $(OS_is_lnx),$(OS_is_win)),yes,),yes) -ONEAPIDIR := $(call topf,$$ONEAPI_ROOT) -ONEAPIDIR := $(if $(wildcard $(ONEAPIDIR)/compiler/latest),$(ONEAPIDIR)/compiler/latest,$(info ONEAPI_ROOT not defined)) -ONEAPIDIR.libia.prefix := $(if $(ONEAPIDIR),$(ONEAPIDIR)/$(if $(OS_is_win),windows,linux)/lib) - -libsycl := $(if $(OS_is_win),$(notdir $(wildcard $(ONEAPIDIR.libia.prefix)/sycl$d.lib $(ONEAPIDIR.libia.prefix)/sycl[0-9]$d.lib $(ONEAPIDIR.libia.prefix)/sycl[0-9][0-9]$d.lib))) -libsycl.default = sycl7$d.lib -endif - #=============================================================================== # Release library names #=============================================================================== @@ -781,7 +771,7 @@ $(WORKDIR.lib)/$(oneapi_y.dpc): LOPT += $(daaldep.rt.dpc) $(WORKDIR.lib)/$(oneapi_y.dpc): LOPT += $(if $(REQDBG),-flink-huge-device-code,) $(WORKDIR.lib)/$(oneapi_y.dpc): LOPT += $(if $(OS_is_win),-IMPLIB:$(@:%.$(MAJORBINARY).dll=%_dll.lib),) $(WORKDIR.lib)/$(oneapi_y.dpc): LOPT += $(if $(OS_is_win),$(WORKDIR.lib)/$(core_y:%.$(MAJORBINARY).dll=%_dll.lib)) -$(WORKDIR.lib)/$(oneapi_y.dpc): LOPT += $(if $(OS_is_win), $(if $(libsycl),$(libsycl),$(libsycl.default)) OpenCL.lib) +$(WORKDIR.lib)/$(oneapi_y.dpc): LOPT += $(if $(OS_is_win),sycl$d.lib OpenCL.lib) $(WORKDIR.lib)/$(oneapi_y.dpc): LOPT += $(mklgpufpk.LIBS_A) ifdef OS_is_win $(WORKDIR.lib)/$(oneapi_y.dpc:%.$(MAJORBINARY).dll=%_dll.lib): $(WORKDIR.lib)/$(oneapi_y.dpc)