Skip to content

Commit

Permalink
Modify transform_reduce to call helper method + add comment back
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfidel committed Aug 6, 2024
1 parent dfdbb53 commit a697e86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/oneapi/dpl/pstl/hetero/dpcpp/unseq_backend_sycl.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ struct transform_reduce
void
vectorized_reduction_first(const _Size __start_idx, _Res& __res, const _Acc&... __acc) const
{
new (&__res.__v) _Tp(__unary_op(__start_idx, __acc...));
__res.__setup(_Tp(__unary_op(__start_idx, __acc...)));
_ONEDPL_PRAGMA_UNROLL
for (_Size __i = 1; __i < _VecSize; ++__i)
__res.__v = __binary_op(__res.__v, __unary_op(__start_idx + __i, __acc...));
Expand Down Expand Up @@ -251,7 +251,7 @@ struct transform_reduce
return;
if (__iters_per_work_item == 1)
{
new (&__res.__v) _Tp(__unary_op(__global_idx, __acc...));
__res.__setup(_Tp(__unary_op(__global_idx, __acc...)));
return;
}
const _Size __local_range = __item_id.get_local_range(0);
Expand Down Expand Up @@ -318,7 +318,7 @@ struct transform_reduce
// Scalar remainder
else if (__adjusted_global_id < __adjusted_n)
{
new (&__res.__v) _Tp(__unary_op(__adjusted_global_id, __acc...));
__res.__setup(_Tp(__unary_op(__adjusted_global_id, __acc...)));
const _Size __adjusted_global_id_plus_one = __adjusted_global_id + 1;
scalar_reduction_remainder(__adjusted_global_id_plus_one, __adjusted_n, __res, __acc...);
}
Expand Down
1 change: 1 addition & 0 deletions include/oneapi/dpl/pstl/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ struct __is_iterator_type<_T, std::void_t<typename std::iterator_traits<_T>::dif
template <typename _T>
static constexpr bool __is_iterator_type_v = __is_iterator_type<_T>::value;

// Storage helper since _Tp may not have a default constructor.
template <typename _Tp>
union __lazy_ctor_storage
{
Expand Down

0 comments on commit a697e86

Please sign in to comment.