Skip to content

Commit

Permalink
Untag dispatch <execution> (#2662)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGuteniev authored May 1, 2022
1 parent a10c471 commit b0b9a58
Showing 1 changed file with 14 additions and 44 deletions.
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

0 comments on commit b0b9a58

Please sign in to comment.