Skip to content

Commit f97f770

Browse files
vasilytricbb-sycl
authored andcommitted
[SYCL][ESIMD] Move round_up_int_division function into functional/common.hpp (intel#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 dc146c0 commit f97f770

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
@@ -63,6 +63,12 @@ using shared_allocator = sycl::usm_allocator<DataT, sycl::usm::alloc::shared>;
6363
template <typename DataT>
6464
using shared_vector = std::vector<DataT, shared_allocator<DataT>>;
6565

66+
// Divides a on b and returns integer value not less than result of division
67+
// given remainder.
68+
constexpr int round_up_int_division(int a, int b) {
69+
return ((a % b) > 0) ? (a / b + 1) : (a / b);
70+
}
71+
6672
// Provides verification that provided device has necessary aspects to interact
6773
// with current data type.
6874
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)