Skip to content

Commit 969c5e8

Browse files
Cherry pick #1932 to release branch (#1943)
Signed-off-by: Dmitriy Sobolev <[email protected]> Co-authored-by: Dmitriy Sobolev <[email protected]>
1 parent 89994fa commit 969c5e8

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_merge_sort.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <type_traits> // std::decay_t, std::integral_constant
2525

2626
#include "sycl_defs.h" // __dpl_sycl::__local_accessor, __dpl_sycl::__group_barrier
27+
#include "sycl_traits.h" // SYCL traits specialization for some oneDPL types.
2728
#include "../../utils.h" // __dpl_bit_floor, __dpl_bit_ceil
2829
#include "parallel_backend_sycl_merge.h" // __find_start_point, __serial_merge
2930

include/oneapi/dpl/pstl/hetero/dpcpp/sycl_traits.h

+10
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ struct __write_to_id_if_else;
257257
template <typename _ExecutionPolicy, typename _Pred>
258258
struct __early_exit_find_or;
259259

260+
template <typename _Range, typename _Compare>
261+
struct __leaf_sorter;
262+
260263
} // namespace oneapi::dpl::__par_backend_hetero
261264

262265
template <typename _UnaryOp>
@@ -312,6 +315,13 @@ struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backen
312315
{
313316
};
314317

318+
template <typename _Range, typename _Compare>
319+
struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backend_hetero::__leaf_sorter, _Range,
320+
_Compare)>
321+
: oneapi::dpl::__internal::__are_all_device_copyable<_Range, _Compare>
322+
{
323+
};
324+
315325
namespace oneapi::dpl::unseq_backend
316326
{
317327

test/general/implementation_details/device_copyable.pass.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ test_device_copyable()
185185
oneapi::dpl::__par_backend_hetero::__early_exit_find_or<policy_non_device_copyable, noop_device_copyable>>,
186186
"__early_exit_find_or is not device copyable with device copyable types");
187187

188+
// __leaf_sorter
189+
// Note that the use of noop_device_copyable/noop_non_device_copyable is valid in this context because
190+
// sycl::is_device_copyable specialization for __leaf_sorter does not require instantiation of
191+
// __leaf_sorter with the provided types. See [temp.inst]/1 of C++17 spec for the details.
192+
static_assert(
193+
sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__leaf_sorter<noop_device_copyable,
194+
noop_device_copyable>>,
195+
"__leaf_sorter is not device copyable with device copyable types");
196+
188197
//__not_pred
189198
static_assert(sycl::is_device_copyable_v<oneapi::dpl::__internal::__not_pred<noop_device_copyable>>,
190199
"__not_pred is not device copyable with device copyable types");
@@ -413,6 +422,11 @@ test_non_device_copyable()
413422
noop_non_device_copyable>>,
414423
"__early_exit_find_or is device copyable with non device copyable types");
415424

425+
// __leaf_sorter
426+
static_assert(!sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__leaf_sorter<noop_device_copyable,
427+
noop_non_device_copyable>>,
428+
"__leaf_sorter is device copyable with non device copyable types");
429+
416430
//__not_pred
417431
static_assert(!sycl::is_device_copyable_v<oneapi::dpl::__internal::__not_pred<noop_non_device_copyable>>,
418432
"__not_pred is device copyable with non device copyable types");

0 commit comments

Comments
 (0)