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

[SYCL][ESIMD] Move ceil function into functional/common.hpp #931

Merged
merged 2 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions SYCL/ESIMD/api/functional/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ using shared_allocator = sycl::usm_allocator<DataT, sycl::usm::alloc::shared>;
template <typename DataT>
using shared_vector = std::vector<DataT, shared_allocator<DataT>>;

// Divides a on b and returns integer value not less than result of division
// given remainder.
constexpr int round_up_int_division(int a, int b) {
return ((a % b) > 0) ? (a / b + 1) : (a / b);
}

// Provides verification that provided device has necessary aspects to interact
// with current data type.
template <typename T>
Expand Down
11 changes: 2 additions & 9 deletions SYCL/ESIMD/api/functional/functions/functions_1d_select.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@

namespace esimd_test::api::functional::functions {

namespace details {

constexpr int ceil(int a, int b) {
return ((a % b) > 0) ? (a / b + 1) : (a / b);
}

} // namespace details

using use_offset = std::true_type;
using do_not_use_offset = std::true_type;

Expand Down Expand Up @@ -238,7 +230,8 @@ bool run_test_for_types(sycl::queue &queue) {
constexpr int zero_offset_value = 0;
constexpr int small_offset_value = 1;
constexpr int large_offset_value =
desired_simd_large_size - details::ceil(2 * desired_simd_large_size, 3);
desired_simd_large_size -
round_up_int_division(2 * desired_simd_large_size, 3);

const auto small_size = get_dimensions<desired_simd_small_size>();
const auto great_size = get_dimensions<desired_simd_large_size>();
Expand Down