From 71fe89cca85b93915153c7e82ed3aa65c948c876 Mon Sep 17 00:00:00 2001 From: Dmitriy Sobolev Date: Mon, 4 Nov 2024 14:21:33 -0600 Subject: [PATCH] Allow passing a device-copyable comparator to sort Signed-off-by: Dmitriy Sobolev --- include/oneapi/dpl/pstl/hetero/dpcpp/sycl_traits.h | 10 ++++++++++ .../implementation_details/device_copyable.pass.cpp | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/include/oneapi/dpl/pstl/hetero/dpcpp/sycl_traits.h b/include/oneapi/dpl/pstl/hetero/dpcpp/sycl_traits.h index f498a587504..2d0e88fd34b 100644 --- a/include/oneapi/dpl/pstl/hetero/dpcpp/sycl_traits.h +++ b/include/oneapi/dpl/pstl/hetero/dpcpp/sycl_traits.h @@ -257,6 +257,9 @@ struct __write_to_id_if_else; template struct __early_exit_find_or; +template +struct __leaf_sorter; + } // namespace oneapi::dpl::__par_backend_hetero template @@ -313,6 +316,13 @@ struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backen { }; +template +struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backend_hetero::__leaf_sorter, _Range, + _Compare)> + : oneapi::dpl::__internal::__are_all_device_copyable<_Range, _Compare> +{ +}; + namespace oneapi::dpl::unseq_backend { diff --git a/test/general/implementation_details/device_copyable.pass.cpp b/test/general/implementation_details/device_copyable.pass.cpp index 8b137cc33e9..1a537c2863c 100644 --- a/test/general/implementation_details/device_copyable.pass.cpp +++ b/test/general/implementation_details/device_copyable.pass.cpp @@ -190,6 +190,11 @@ test_device_copyable() oneapi::dpl::__par_backend_hetero::__early_exit_find_or>, "__early_exit_find_or is not device copyable with device copyable types"); + static_assert( + sycl::is_device_copyable_v>, + "__leaf_sorter is not device copyable with device copyable types"); + //__not_pred static_assert(sycl::is_device_copyable_v>, "__not_pred is not device copyable with device copyable types"); @@ -423,6 +428,10 @@ test_non_device_copyable() noop_non_device_copyable>>, "__early_exit_find_or is device copyable with non device copyable types"); + static_assert(!sycl::is_device_copyable_v>, + "__leaf_sorter is device copyable with non device copyable types"); + //__not_pred static_assert(!sycl::is_device_copyable_v>, "__not_pred is device copyable with non device copyable types");