From 271af70eb26cc0fa73fba8a69c24071a27ef081d Mon Sep 17 00:00:00 2001 From: MikeDvorskiy Date: Thu, 28 Nov 2024 17:28:56 +0100 Subject: [PATCH] [oneDPL][ranges][merge] support size limit for output; + __parallel_merge sycl pattern support --- include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h | 2 +- .../oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h b/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h index b9cd154a04..8ab7042c66 100644 --- a/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h +++ b/include/oneapi/dpl/pstl/hetero/algorithm_ranges_impl_hetero.h @@ -54,7 +54,7 @@ template , _ExecutionPolicy&& __exec, _Function __f, _Ranges&&... __rngs) { - auto __n = oneapi::dpl::__ranges::__get_first_range_size(__rngs...); + auto __n = std::min({__rngs...}); if (__n > 0) { oneapi::dpl::__par_backend_hetero::__parallel_for(_BackendTag{}, ::std::forward<_ExecutionPolicy>(__exec), diff --git a/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge.h b/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge.h index 753e32816a..b1ee74ca04 100644 --- a/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge.h +++ b/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge.h @@ -142,7 +142,7 @@ struct __parallel_merge_submitter<_IdType, __internal::__optional_kernel_name<_N { const _IdType __n1 = __rng1.size(); const _IdType __n2 = __rng2.size(); - const _IdType __n = __n1 + __n2; + const _IdType __n = std::min<_IdType>(__n_1 + __n_2, std::ranges::size(__rng3)); assert(__n1 > 0 || __n2 > 0);