Skip to content

Commit

Permalink
fixing device copyable for helpers
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Hoeflinger <dan.hoeflinger@intel.com>
  • Loading branch information
danhoeflinger committed Jul 29, 2024
1 parent bd971db commit 5337317
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
29 changes: 29 additions & 0 deletions include/oneapi/dpl/pstl/hetero/dpcpp/sycl_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,40 @@ struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__internal::
namespace oneapi::dpl::__par_backend_hetero
{

template <typename _UnaryOp>
struct __gen_transform_input;

template <typename _Predicate>
struct __gen_count_pred;

template <typename _Predicate>
struct __gen_expand_count_pred;

template <typename _ExecutionPolicy, typename _Pred>
struct __early_exit_find_or;

} // namespace oneapi::dpl::__par_backend_hetero

template <typename _UnaryOp>
struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backend_hetero::__gen_transform_input,
_UnaryOp)>
: oneapi::dpl::__internal::__are_all_device_copyable<_UnaryOp>
{
};

template <typename _Predicate>
struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backend_hetero::__gen_count_pred, _Predicate)>
: oneapi::dpl::__internal::__are_all_device_copyable<_Predicate>
{
};

template <typename _Predicate>
struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backend_hetero::__gen_expand_count_pred,
_Predicate)>
: oneapi::dpl::__internal::__are_all_device_copyable<_Predicate>
{
};

template <typename _ExecutionPolicy, typename _Pred>
struct sycl::is_device_copyable<_ONEDPL_SPECIALIZE_FOR(oneapi::dpl::__par_backend_hetero::__early_exit_find_or,
_ExecutionPolicy, _Pred)>
Expand Down
29 changes: 29 additions & 0 deletions test/general/implementation_details/device_copyable.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ test_device_copyable()
oneapi::dpl::unseq_backend::__brick_reduce_idx<noop_device_copyable, int_device_copyable>>,
"__brick_reduce_idx is not device copyable with device copyable types");

//__gen_transform_input
static_assert(
sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__gen_transform_input<noop_device_copyable>>,
"__gen_transform_input is not device copyable with device copyable types");

//__gen_count_pred
static_assert(sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__gen_count_pred<noop_device_copyable>>,
"__gen_count_pred is not device copyable with device copyable types");

//__gen_expand_count_pred
static_assert(
sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__gen_expand_count_pred<noop_device_copyable>>,
"__gen_expand_count_pred is not device copyable with device copyable types");

// __early_exit_find_or
static_assert(
sycl::is_device_copyable_v<
Expand Down Expand Up @@ -343,6 +357,21 @@ test_non_device_copyable()
oneapi::dpl::unseq_backend::__brick_reduce_idx<noop_device_copyable, int_non_device_copyable>>,
"__brick_reduce_idx is device copyable with non device copyable types");

// //__gen_transform_input
static_assert(
!sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__gen_transform_input<noop_non_device_copyable>>,
"__gen_transform_input is device copyable with non device copyable types");

//__gen_count_pred
static_assert(
!sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__gen_count_pred<noop_non_device_copyable>>,
"__gen_count_pred is device copyable with non device copyable types");

//__gen_expand_count_pred
static_assert(!sycl::is_device_copyable_v<
oneapi::dpl::__par_backend_hetero::__gen_expand_count_pred<noop_non_device_copyable>>,
"__gen_expand_count_pred is device copyable with non device copyable types");

// __early_exit_find_or
static_assert(
!sycl::is_device_copyable_v<oneapi::dpl::__par_backend_hetero::__early_exit_find_or<policy_non_device_copyable,
Expand Down

0 comments on commit 5337317

Please sign in to comment.