Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untag dispatch <execution> #2662

Merged
Merged
Changes from all commits
Commits
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
58 changes: 14 additions & 44 deletions stl/inc/execution
Original file line number Diff line number Diff line change
Expand Up @@ -4424,33 +4424,18 @@ _FwdIt2 exclusive_scan(_ExPo&&, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdI
return _Dest;
}

template <class _FwdIt1, class _FwdIt2, class _BinOp, class _Ty>
_FwdIt2 _Inclusive_scan_per_chunk(
_FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _Ty& _Val, _No_init_tag) {
// Local-sum for parallel inclusive_scan; writes local inclusive prefix sums into _Dest and stores overall sum in
// _Val.
// pre: _Val is *uninitialized* && _First != _Last
_Construct_in_place(_Val, *_First);
for (;;) {
*_Dest = _Val;
++_Dest;
++_First;
if (_First == _Last) {
return _Dest;
}

_Val = _Reduce_op(_STD move(_Val), *_First);
}
}

template <class _FwdIt1, class _FwdIt2, class _BinOp, class _Ty, class _Ty_fwd,
enable_if_t<!is_same_v<_No_init_tag, remove_const_t<remove_reference_t<_Ty_fwd>>>, int> = 0>
template <class _FwdIt1, class _FwdIt2, class _BinOp, class _Ty, class _Ty_fwd>
_FwdIt2 _Inclusive_scan_per_chunk(
_FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _Ty& _Val, _Ty_fwd&& _Predecessor) {
// local-sum for parallel inclusive_scan; writes local inclusive prefix sums into _Dest and stores overall sum in
// _Val.
// pre: _Val is *uninitialized* && _First != _Last
_Construct_in_place(_Val, _Reduce_op(_STD forward<_Ty_fwd>(_Predecessor), *_First));
if constexpr (is_same_v<_No_init_tag, remove_const_t<remove_reference_t<_Ty_fwd>>>) {
_Construct_in_place(_Val, *_First);
} else {
_Construct_in_place(_Val, _Reduce_op(_STD forward<_Ty_fwd>(_Predecessor), *_First));
}

for (;;) {
*_Dest = _Val;
++_Dest;
Expand Down Expand Up @@ -4756,33 +4741,18 @@ _FwdIt2 transform_exclusive_scan(_ExPo&&, const _FwdIt1 _First, const _FwdIt1 _L
return _Dest;
}

template <class _FwdIt1, class _FwdIt2, class _BinOp, class _UnaryOp, class _Ty>
_FwdIt2 _Transform_inclusive_scan_per_chunk(_FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op,
_UnaryOp _Transform_op, _Ty& _Val, _No_init_tag) {
// Local-sum for parallel transform_inclusive_scan; writes local inclusive prefix sums into _Dest and stores overall
// sum in _Val.
// pre: _Val is *uninitialized* && _First != _Last
_Construct_in_place(_Val, _Transform_op(*_First));
for (;;) {
*_Dest = _Val;
++_Dest;
++_First;
if (_First == _Last) {
return _Dest;
}

_Val = _Reduce_op(_STD move(_Val), _Transform_op(*_First));
}
}

template <class _FwdIt1, class _FwdIt2, class _BinOp, class _UnaryOp, class _Ty, class _Ty_fwd,
enable_if_t<!is_same_v<_No_init_tag, remove_const_t<remove_reference_t<_Ty_fwd>>>, int> = 0>
template <class _FwdIt1, class _FwdIt2, class _BinOp, class _UnaryOp, class _Ty, class _Ty_fwd>
_FwdIt2 _Transform_inclusive_scan_per_chunk(_FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op,
_UnaryOp _Transform_op, _Ty& _Val, _Ty_fwd&& _Predecessor) {
// local-sum for parallel transform_inclusive_scan; writes local inclusive prefix sums into _Dest and stores overall
// sum in _Val
// pre: _Val is *uninitialized* && _First != _Last
_Construct_in_place(_Val, _Reduce_op(_STD forward<_Ty_fwd>(_Predecessor), _Transform_op(*_First)));
if constexpr (is_same_v<_No_init_tag, remove_const_t<remove_reference_t<_Ty_fwd>>>) {
_Construct_in_place(_Val, _Transform_op(*_First));
} else {
_Construct_in_place(_Val, _Reduce_op(_STD forward<_Ty_fwd>(_Predecessor), _Transform_op(*_First)));
}

for (;;) {
*_Dest = _Val;
++_Dest;
Expand Down