Skip to content

Commit

Permalink
maint: changes for 2025.0 compiler (#2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr-Solovev committed Aug 30, 2024
1 parent ac5ea85 commit 2a9918c
Show file tree
Hide file tree
Showing 27 changed files with 186 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,13 @@ result_t compute_kernel_csr_impl<Float>::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<Float>(cur_min, 0);
result_data_ptr[stat::max * column_count + col_idx] = sycl::max<Float>(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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cpp/oneapi/dal/algo/covariance/test/badargs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions cpp/oneapi/dal/algo/dbscan/test/badarg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ namespace oneapi::dal::dbscan::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;

Expand Down Expand Up @@ -64,8 +66,10 @@ class dbscan_badarg_test : public te::algo_fixture {
static constexpr std::array<float, bad_weight_element_count> 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));
Expand Down
8 changes: 6 additions & 2 deletions cpp/oneapi/dal/algo/kmeans/test/badarg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ namespace oneapi::dal::kmeans::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand Down Expand Up @@ -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));
Expand Down
16 changes: 10 additions & 6 deletions cpp/oneapi/dal/algo/linear_kernel/test/badargs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ namespace oneapi::dal::linear_kernel::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand Down Expand Up @@ -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();
Expand Down
16 changes: 10 additions & 6 deletions cpp/oneapi/dal/algo/linear_kernel/test/overflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ namespace oneapi::dal::linear_kernel::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand All @@ -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();
Expand Down
6 changes: 4 additions & 2 deletions cpp/oneapi/dal/algo/pca/backend/test/sign_flip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,17 @@ class sign_flip_test {
}
};

TEMPLATE_TEST_M(sign_flip_test, "flips if all negative", "[negative]", float, double) {
using data_types = std::tuple<float, double>;

TEMPLATE_LIST_TEST_M(sign_flip_test, "flips if all negative", "[negative]", data_types) {
auto data = this->get_negative_data();

sign_flip(data);

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);
Expand Down
8 changes: 6 additions & 2 deletions cpp/oneapi/dal/algo/pca/test/badarg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ namespace oneapi::dal::pca::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand Down Expand Up @@ -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));
Expand Down
8 changes: 6 additions & 2 deletions cpp/oneapi/dal/algo/pca/test/overflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ namespace oneapi::dal::pca::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand All @@ -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();
Expand Down
16 changes: 10 additions & 6 deletions cpp/oneapi/dal/algo/polynomial_kernel/test/badargs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ namespace oneapi::dal::polynomial_kernel::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand Down Expand Up @@ -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());
Expand Down
16 changes: 10 additions & 6 deletions cpp/oneapi/dal/algo/polynomial_kernel/test/overflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ namespace oneapi::dal::polynomial_kernel::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand All @@ -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());
Expand Down
8 changes: 6 additions & 2 deletions cpp/oneapi/dal/algo/rbf_kernel/test/badargs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ namespace oneapi::dal::rbf_kernel::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand Down Expand Up @@ -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));
Expand Down
13 changes: 7 additions & 6 deletions cpp/oneapi/dal/algo/rbf_kernel/test/overflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ namespace oneapi::dal::rbf_kernel::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand All @@ -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();
Expand Down
16 changes: 10 additions & 6 deletions cpp/oneapi/dal/algo/sigmoid_kernel/test/badargs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ namespace oneapi::dal::sigmoid_kernel::test {

namespace te = dal::test::engine;

template <typename Method>
template <typename TestType>
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;
Expand Down Expand Up @@ -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());
Expand Down
Loading

0 comments on commit 2a9918c

Please sign in to comment.