Skip to content

Commit

Permalink
Fix dpc vectorization error when running with new compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Vika-F committed Jun 13, 2024
1 parent 24fa3d1 commit c110bd1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cpp/oneapi/dal/table/backend/csr_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*******************************************************************************/

#include "oneapi/dal/backend/common.hpp"
#include "oneapi/dal/table/backend/csr_kernels.hpp"
#include "oneapi/dal/table/backend/convert.hpp"

Expand Down Expand Up @@ -411,6 +412,10 @@ bool is_sorted(sycl::queue& queue,

sycl::buffer<std::int64_t, 1> count_buf(&count_descending_pairs, sycl::range<1>(1));

const auto count_m1 = count - 1LL;
const auto wg_size = dal::backend::device_max_wg_size(queue);
const auto local_size = (wg_size < count_m1) ? wg_size : count_m1;

// count the number of pairs of the subsequent elements in the data array that are sorted
// in desccending order using sycl::reduction
queue
Expand All @@ -419,9 +424,10 @@ bool is_sorted(sycl::queue& queue,
auto count_descending_reduction =
sycl::reduction(count_buf, cgh, sycl::ext::oneapi::plus<std::int64_t>());

cgh.parallel_for(sycl::range<1>{ dal::detail::integral_cast<std::size_t>(count - 1) },
cgh.parallel_for(sycl::nd_range<1>{ count_m1, local_size },
count_descending_reduction,
[=](sycl::id<1> i, auto& count_descending) {
[=](sycl::nd_item<1> idx, auto& count_descending) {
const auto i = idx.get_global_id(0);
if (data[i] > data[i + 1])
count_descending.combine(1);
});
Expand Down

0 comments on commit c110bd1

Please sign in to comment.