Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 9660970

Browse files
authored
[SYCL][ESIMD] Move round_up_int_division function into functional/common.hpp (#931)
* [SYCL][ESIMD] Move round_up_int_division function into functional/common.hpp Because we are going to use it in different files
1 parent 0c98489 commit 9660970

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

SYCL/ESIMD/api/functional/common.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ using shared_allocator = sycl::usm_allocator<DataT, sycl::usm::alloc::shared>;
5555
template <typename DataT>
5656
using shared_vector = std::vector<DataT, shared_allocator<DataT>>;
5757

58+
// Divides a on b and returns integer value not less than result of division
59+
// given remainder.
60+
constexpr int round_up_int_division(int a, int b) {
61+
return ((a % b) > 0) ? (a / b + 1) : (a / b);
62+
}
63+
5864
// Provides verification that provided device has necessary aspects to interact
5965
// with current data type.
6066
template <typename T>

SYCL/ESIMD/api/functional/functions/functions_1d_select.hpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@
2424

2525
namespace esimd_test::api::functional::functions {
2626

27-
namespace details {
28-
29-
constexpr int ceil(int a, int b) {
30-
return ((a % b) > 0) ? (a / b + 1) : (a / b);
31-
}
32-
33-
} // namespace details
34-
3527
using use_offset = std::true_type;
3628
using do_not_use_offset = std::true_type;
3729

@@ -238,7 +230,8 @@ bool run_test_for_types(sycl::queue &queue) {
238230
constexpr int zero_offset_value = 0;
239231
constexpr int small_offset_value = 1;
240232
constexpr int large_offset_value =
241-
desired_simd_large_size - details::ceil(2 * desired_simd_large_size, 3);
233+
desired_simd_large_size -
234+
round_up_int_division(2 * desired_simd_large_size, 3);
242235

243236
const auto small_size = get_dimensions<desired_simd_small_size>();
244237
const auto great_size = get_dimensions<desired_simd_large_size>();

0 commit comments

Comments
 (0)