Skip to content
Closed
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ec2d9db
refactor away redundant fill functor;
danhoeflinger Dec 19, 2025
d2e7ad7
fixing typo uninitialized_value_construct
danhoeflinger Dec 31, 2025
e2a89f1
revert formatting only changes
danhoeflinger Dec 31, 2025
9bd6615
fixing rebase
danhoeflinger Feb 20, 2026
f0c541c
formatting
danhoeflinger Feb 20, 2026
e14d992
formatting
danhoeflinger Feb 20, 2026
5b845ec
formatting
danhoeflinger Feb 25, 2026
c899892
move from algorithm to memory
danhoeflinger Feb 25, 2026
d94e5b9
reverting formatting only change
danhoeflinger Feb 25, 2026
854a06a
formatting fixes
danhoeflinger Feb 25, 2026
f1e0cd1
formatting
danhoeflinger Feb 25, 2026
4364736
adding memory_impl_hetero.h
danhoeflinger Feb 25, 2026
9f4e504
formatting, naming
danhoeflinger Feb 25, 2026
3a67d40
fix header
danhoeflinger Feb 25, 2026
9b8191b
refactor sycl_iter resolver (remove make_iter_mode)
danhoeflinger Dec 29, 2025
0fd8e76
fix trait (maintain good error msg)
danhoeflinger Dec 29, 2025
f2b2e7d
remove unused trait, rework comments
danhoeflinger Dec 31, 2025
b33e770
connecting no_init to accessors
danhoeflinger Dec 31, 2025
ddec100
formatting changes
danhoeflinger Dec 31, 2025
c894054
removing unnecessary comment
danhoeflinger Jan 2, 2026
7bfe401
adding static assertion for read + no_init
danhoeflinger Jan 2, 2026
1e123bd
fix rebase mistake
danhoeflinger Feb 25, 2026
22627b8
adjusting the SFINAE to allow user-friendly static assertions to trigger
danhoeflinger Feb 25, 2026
67cd47b
refactor away redundant fill functor;
danhoeflinger Dec 19, 2025
7f178b0
fixing typo uninitialized_value_construct
danhoeflinger Dec 31, 2025
724fb32
revert formatting only changes
danhoeflinger Dec 31, 2025
62db354
fixing rebase
danhoeflinger Feb 20, 2026
516b995
formatting
danhoeflinger Feb 20, 2026
c315942
formatting
danhoeflinger Feb 20, 2026
fc3af7f
formatting
danhoeflinger Feb 25, 2026
a9f4a9a
move from algorithm to memory
danhoeflinger Feb 25, 2026
39972a9
reverting formatting only change
danhoeflinger Feb 25, 2026
76cdfd3
formatting fixes
danhoeflinger Feb 25, 2026
0f229d5
formatting
danhoeflinger Feb 25, 2026
ed00490
adding memory_impl_hetero.h
danhoeflinger Feb 25, 2026
36f57e0
formatting, naming
danhoeflinger Feb 25, 2026
5364964
fix header
danhoeflinger Feb 25, 2026
47cffba
remove stale sycl_traits
danhoeflinger Feb 25, 2026
89aec8e
using fully qualified name
danhoeflinger Feb 25, 2026
0a56ec7
fix header copyright
danhoeflinger Mar 2, 2026
394ea4a
Merge branch 'dev/dhoeflin/unitialized_refactors' into dev/dhoeflin/r…
danhoeflinger Mar 4, 2026
1e5cbe7
Merge remote-tracking branch 'origin/main' into dev/dhoeflin/remove_m…
danhoeflinger Mar 11, 2026
c1efdff
::std -> std
danhoeflinger Mar 11, 2026
b20b931
address feedback
danhoeflinger Mar 12, 2026
a11e729
removing useless comments
danhoeflinger Mar 13, 2026
2a2396a
update to restore previous funcitonality from iter_mode_resolver
danhoeflinger Mar 13, 2026
bafe7f0
formatting
danhoeflinger Mar 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ __rng_data(const _Rng& __rng)
// sycl::accessor::operator[] are supported only with -fsycl-esimd-force-stateless-mem.
// Otherwise, all memory accesses through an accessor are done via explicit APIs
// TODO: rely on begin() once -fsycl-esimd-force-stateless-mem has been enabled by default
template <typename _T, sycl::access::mode _M>
template <typename _T, sycl::access::mode _M, bool _NoInit>
auto
__rng_data(const oneapi::dpl::__ranges::all_view<_T, _M>& __view)
__rng_data(const oneapi::dpl::__ranges::all_view<_T, _M, _NoInit>& __view)
{
return __view.accessor();
}
Expand Down
6 changes: 2 additions & 4 deletions include/oneapi/dpl/internal/async_impl/async_impl_hetero.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,8 @@ __pattern_fill_async(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&& __exec,
_ForwardIterator __last, const _T& __value)
{
return __pattern_walk1_async<__par_backend_hetero::access_mode::write, /*_IsNoInitRequested=*/true>(
__tag, ::std::forward<_ExecutionPolicy>(__exec),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__first),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__last),
fill_functor<_T>{__value});
__tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
oneapi::dpl::__internal::__brick_fill<__hetero_tag<_BackendTag>, _T>{__value});
}

//------------------------------------------------------------------------
Expand Down
17 changes: 0 additions & 17 deletions include/oneapi/dpl/pstl/algorithm_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ template <class _IsVector, class _ExecutionPolicy, class _RandomAccessIterator,
void
__pattern_walk1(__parallel_tag<_IsVector>, _ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Function);

template <class _Tag, class _ExecutionPolicy, class _ForwardIterator, class _Brick>
void
__pattern_walk_brick(_Tag, _ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick) noexcept;

template <class _IsVector, class _ExecutionPolicy, class _RandomAccessIterator, class _Brick>
void
__pattern_walk_brick(__parallel_tag<_IsVector>, _ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator,
_Brick);

//------------------------------------------------------------------------
// walk1_n
//------------------------------------------------------------------------
Expand All @@ -103,14 +94,6 @@ template <class _IsVector, class _ExecutionPolicy, class _RandomAccessIterator,
_RandomAccessIterator
__pattern_walk1_n(__parallel_tag<_IsVector>, _ExecutionPolicy&&, _RandomAccessIterator, _Size, _Function);

template <class _Tag, class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Brick>
_ForwardIterator
__pattern_walk_brick_n(_Tag, _ExecutionPolicy&&, _ForwardIterator, _Size, _Brick) noexcept;

template <class _IsVector, class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Brick>
_RandomAccessIterator
__pattern_walk_brick_n(__parallel_tag<_IsVector>, _ExecutionPolicy&&, _RandomAccessIterator, _Size, _Brick);

//------------------------------------------------------------------------
// walk2 (pseudo)
//
Expand Down
48 changes: 0 additions & 48 deletions include/oneapi/dpl/pstl/algorithm_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,30 +177,6 @@ __pattern_walk1(__parallel_tag<_IsVector>, _ExecutionPolicy&& __exec, _RandomAcc
});
}

template <class _Tag, class _ExecutionPolicy, class _ForwardIterator, class _Brick>
void
__pattern_walk_brick(_Tag, _ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last,
_Brick __brick) noexcept
{
static_assert(__is_serial_tag_v<_Tag> || __is_parallel_forward_tag_v<_Tag>);

__brick(__first, __last, typename _Tag::__is_vector{});
}

template <class _IsVector, class _ExecutionPolicy, class _RandomAccessIterator, class _Brick>
void
__pattern_walk_brick(__parallel_tag<_IsVector>, _ExecutionPolicy&& __exec, _RandomAccessIterator __first,
_RandomAccessIterator __last, _Brick __brick)
{
using __backend_tag = typename __parallel_tag<_IsVector>::__backend_tag;

__internal::__except_handler([&]() {
__par_backend::__parallel_for(
__backend_tag{}, ::std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__brick](_RandomAccessIterator __i, _RandomAccessIterator __j) { __brick(__i, __j, _IsVector{}); });
});
}

//------------------------------------------------------------------------
// walk1_n
//------------------------------------------------------------------------
Expand Down Expand Up @@ -239,30 +215,6 @@ __pattern_walk1_n(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec, _R
return __first + __n;
}

template <class _Tag, class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Brick>
_ForwardIterator
__pattern_walk_brick_n(_Tag, _ExecutionPolicy&&, _ForwardIterator __first, _Size __n, _Brick __brick) noexcept
{
static_assert(__is_serial_tag_v<_Tag> || __is_parallel_forward_tag_v<_Tag>);

return __brick(__first, __n, typename _Tag::__is_vector{});
}

template <class _IsVector, class _ExecutionPolicy, class _RandomAccessIterator, class _Size, class _Brick>
_RandomAccessIterator
__pattern_walk_brick_n(__parallel_tag<_IsVector>, _ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n,
_Brick __brick)
{
using __backend_tag = typename __parallel_tag<_IsVector>::__backend_tag;

return __internal::__except_handler([&]() {
__par_backend::__parallel_for(
__backend_tag{}, ::std::forward<_ExecutionPolicy>(__exec), __first, __first + __n,
[__brick](_RandomAccessIterator __i, _RandomAccessIterator __j) { __brick(__i, __j - __i, _IsVector{}); });
return __first + __n;
});
}

//------------------------------------------------------------------------
// walk2 (pseudo)
//
Expand Down
33 changes: 15 additions & 18 deletions include/oneapi/dpl/pstl/glue_memory_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#if _ONEDPL_HETERO_BACKEND
# include "hetero/algorithm_impl_hetero.h"
# include "hetero/memory_impl_hetero.h"
#endif

#include "memory_fwd.h"
Expand Down Expand Up @@ -147,13 +148,12 @@ uninitialized_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forward

if constexpr (oneapi::dpl::__internal::__trivial_uninitialized_fill<_ValueType, _Tp>)
{
oneapi::dpl::__internal::__pattern_walk_brick(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
oneapi::dpl::__internal::__brick_fill<decltype(__dispatch_tag), _ValueType>{_ValueType(__value)});
oneapi::dpl::__internal::__pattern_fill(__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
_ValueType(__value));
}
else
{
oneapi::dpl::__internal::__pattern_walk1(
oneapi::dpl::__internal::__pattern_uninitialized_walk1(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
oneapi::dpl::__internal::__op_uninitialized_fill<_Tp, std::decay_t<_ExecutionPolicy>>{__value});
}
Expand All @@ -169,13 +169,12 @@ uninitialized_fill_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size

if constexpr (oneapi::dpl::__internal::__trivial_uninitialized_fill<_ValueType, _Tp>)
{
return oneapi::dpl::__internal::__pattern_walk_brick_n(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __n,
oneapi::dpl::__internal::__brick_fill_n<decltype(__dispatch_tag), _ValueType>{_ValueType(__value)});
return oneapi::dpl::__internal::__pattern_fill_n(__dispatch_tag, std::forward<_ExecutionPolicy>(__exec),
__first, __n, _ValueType(__value));
}
else
{
return oneapi::dpl::__internal::__pattern_walk1_n(
return oneapi::dpl::__internal::__pattern_uninitialized_walk1_n(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __n,
oneapi::dpl::__internal::__op_uninitialized_fill<_Tp, std::decay_t<_ExecutionPolicy>>{__value});
}
Expand Down Expand Up @@ -243,7 +242,7 @@ uninitialized_default_construct(_ExecutionPolicy&& __exec, _ForwardIterator __fi
{
const auto __dispatch_tag = oneapi::dpl::__internal::__select_backend(__exec, __first);

oneapi::dpl::__internal::__pattern_walk1(
oneapi::dpl::__internal::__pattern_uninitialized_walk1(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
oneapi::dpl::__internal::__op_uninitialized_default_construct<std::decay_t<_ExecutionPolicy>>{});
}
Expand All @@ -263,7 +262,7 @@ uninitialized_default_construct_n(_ExecutionPolicy&& __exec, _ForwardIterator __
{
const auto __dispatch_tag = oneapi::dpl::__internal::__select_backend(__exec, __first);

return oneapi::dpl::__internal::__pattern_walk1_n(
return oneapi::dpl::__internal::__pattern_uninitialized_walk1_n(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __n,
oneapi::dpl::__internal::__op_uninitialized_default_construct<std::decay_t<_ExecutionPolicy>>{});
}
Expand All @@ -281,13 +280,12 @@ uninitialized_value_construct(_ExecutionPolicy&& __exec, _ForwardIterator __firs

if constexpr (oneapi::dpl::__internal::__trivial_uninitialized_value_construct<_ValueType>)
{
oneapi::dpl::__internal::__pattern_walk_brick(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
oneapi::dpl::__internal::__brick_fill<decltype(__dispatch_tag), _ValueType>{_ValueType()});
oneapi::dpl::__internal::__pattern_fill(__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
_ValueType());
}
else
{
oneapi::dpl::__internal::__pattern_walk1(
oneapi::dpl::__internal::__pattern_uninitialized_walk1(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
oneapi::dpl::__internal::__op_uninitialized_value_construct<std::decay_t<_ExecutionPolicy>>{});
}
Expand All @@ -303,13 +301,12 @@ uninitialized_value_construct_n(_ExecutionPolicy&& __exec, _ForwardIterator __fi

if constexpr (oneapi::dpl::__internal::__trivial_uninitialized_value_construct<_ValueType>)
{
return oneapi::dpl::__internal::__pattern_walk_brick_n(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __n,
oneapi::dpl::__internal::__brick_fill_n<decltype(__dispatch_tag), _ValueType>{_ValueType()});
return oneapi::dpl::__internal::__pattern_fill_n(__dispatch_tag, std::forward<_ExecutionPolicy>(__exec),
__first, __n, _ValueType());
}
else
{
return oneapi::dpl::__internal::__pattern_walk1_n(
return oneapi::dpl::__internal::__pattern_uninitialized_walk1_n(
__dispatch_tag, std::forward<_ExecutionPolicy>(__exec), __first, __n,
oneapi::dpl::__internal::__op_uninitialized_value_construct<std::decay_t<_ExecutionPolicy>>{});
}
Expand Down
84 changes: 9 additions & 75 deletions include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,43 +214,6 @@ __pattern_walk3(__hetero_tag<_BackendTag>, _ExecutionPolicy&& __exec, _ForwardIt
__f);
}

//------------------------------------------------------------------------
// walk_brick, walk_brick_n
//------------------------------------------------------------------------

template <typename _Name>
struct __walk_brick_wrapper;

template <typename _BackendTag, typename _ExecutionPolicy, typename _ForwardIterator, typename _Function>
void
__pattern_walk_brick(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&& __exec, _ForwardIterator __first,
_ForwardIterator __last, _Function __f)
{
if (__last - __first <= 0)
return;

__pattern_hetero_walk1<__par_backend_hetero::access_mode::read_write, false>(
__tag,
__par_backend_hetero::make_wrapped_policy<__walk_brick_wrapper>(::std::forward<_ExecutionPolicy>(__exec)),
__first, __last, __f);
}

template <typename _Name>
struct __walk_brick_n_wrapper;

template <typename _BackendTag, typename _ExecutionPolicy, typename _ForwardIterator, typename _Size,
typename _Function>
_ForwardIterator
__pattern_walk_brick_n(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __n,
_Function __f)
{
__pattern_hetero_walk1<__par_backend_hetero::access_mode::read_write, false>(
__tag,
__par_backend_hetero::make_wrapped_policy<__walk_brick_n_wrapper>(::std::forward<_ExecutionPolicy>(__exec)),
__first, __first + __n, __f);
return __first + __n;
}

//------------------------------------------------------------------------
// walk2_brick, walk2_brick_n
//------------------------------------------------------------------------
Expand Down Expand Up @@ -333,28 +296,14 @@ __pattern_walk3_transform_if(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&&
// fill
//------------------------------------------------------------------------

template <typename _SourceT>
struct fill_functor
{
_SourceT __value;
template <typename _TargetT>
void
operator()(_TargetT& __target) const
{
__target = __value;
}
};

template <typename _BackendTag, typename _ExecutionPolicy, typename _ForwardIterator, typename _T>
_ForwardIterator
__pattern_fill(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&& __exec, _ForwardIterator __first,
_ForwardIterator __last, const _T& __value)
{
__pattern_hetero_walk1<__par_backend_hetero::access_mode::write, /*_IsNoInitRequested=*/true>(
__tag, std::forward<_ExecutionPolicy>(__exec),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__first),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__last),
fill_functor<_T>{__value});
__tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
__brick_fill<__hetero_tag<_BackendTag>, _T>{__value});
return __last;
}

Expand Down Expand Up @@ -389,10 +338,7 @@ __pattern_generate(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&& __exec, _
_ForwardIterator __last, _Generator __g)
{
__pattern_hetero_walk1<__par_backend_hetero::access_mode::write, /*_IsNoInitRequested=*/true>(
__tag, std::forward<_ExecutionPolicy>(__exec),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__first),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__last),
generate_functor<_Generator>{__g});
__tag, std::forward<_ExecutionPolicy>(__exec), __first, __last, generate_functor<_Generator>{__g});
return __last;
}

Expand Down Expand Up @@ -968,9 +914,7 @@ __pattern_partition_copy(__hetero_tag<_BackendTag>, _ExecutionPolicy&& __exec, _
auto __keep1 = oneapi::dpl::__ranges::__get_sycl_range<__par_backend_hetero::access_mode::read>();
auto __buf1 = __keep1(__first, __last);

auto __zipped_res = __par_backend_hetero::zip(
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__result1),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__result2));
auto __zipped_res = __par_backend_hetero::zip(__result1, __result2);

auto __keep2 = oneapi::dpl::__ranges::__get_sycl_range<__par_backend_hetero::access_mode::write,
/*_IsNoInitRequested=*/true>();
Expand Down Expand Up @@ -1271,12 +1215,7 @@ __pattern_inplace_merge(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&& __ex
auto __copy_first = __buf.get();
auto __copy_last = __copy_first + __n;

__pattern_merge(
__tag, __exec, __par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read>(__first),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read>(__middle),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read>(__middle),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read>(__last),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::write>(__copy_first), __comp);
__pattern_merge(__tag, __exec, __first, __middle, __middle, __last, __copy_first, __comp);

//TODO: optimize copy back depending on Iterator, i.e. set_final_data for host iterator/pointer

Expand Down Expand Up @@ -1517,11 +1456,8 @@ __pattern_partial_sort(__hetero_tag<_BackendTag>, _ExecutionPolicy&& __exec, _It
if (__last - __first < 2)
return;

__par_backend_hetero::__parallel_partial_sort(
_BackendTag{}, ::std::forward<_ExecutionPolicy>(__exec),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read_write>(__first),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read_write>(__mid),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read_write>(__last), __comp)
__par_backend_hetero::__parallel_partial_sort(_BackendTag{}, ::std::forward<_ExecutionPolicy>(__exec), __first,
__mid, __last, __comp)
.__checked_deferrable_wait();
}

Expand Down Expand Up @@ -1618,10 +1554,8 @@ __pattern_partial_sort_copy(__hetero_tag<_BackendTag> __tag, _ExecutionPolicy&&
// the patterns: __pattern_hetero_walk2, __parallel_partial_sort and __pattern_hetero_walk2.

__par_backend_hetero::__parallel_partial_sort(
_BackendTag{}, __par_backend_hetero::make_wrapped_policy<__partial_sort_2>(__exec),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read_write>(__buf_first),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read_write>(__buf_mid),
__par_backend_hetero::make_iter_mode<__par_backend_hetero::access_mode::read_write>(__buf_last), __comp);
_BackendTag{}, __par_backend_hetero::make_wrapped_policy<__partial_sort_2>(__exec), __buf_first, __buf_mid,
__buf_last, __comp);

return __pattern_hetero_walk2<__par_backend_hetero::__deferrable_mode, __par_backend_hetero::access_mode::write,
/*_IsOutNoInitRequested=*/true>(
Expand Down
Loading