summaryrefslogtreecommitdiff
path: root/pstl/include
diff options
context:
space:
mode:
authorMikhail Dvorskiy <mikhail.dvorskiy@intel.com>2020-03-17 16:03:02 -0400
committerLouis Dionne <ldionne@apple.com>2020-03-17 16:22:24 -0400
commit36b8d02c8df4d2c9afd687c69d9adfc50afec220 (patch)
tree069ad8471e39846373e70173c360a6a3677161fa /pstl/include
parentc48442c9f38836c69d7b90dddf27eea549a4f14c (diff)
downloadllvm-36b8d02c8df4d2c9afd687c69d9adfc50afec220.tar.gz
[pstl] A hot fix for exclusive_scan (+ lost enable_if in declaration)
It fixes an ambiguity issue in case of a user has a custom policy and calls a version of exclusive_scan with binary operation. Differential Revision: https://reviews.llvm.org/D62719
Diffstat (limited to 'pstl/include')
-rw-r--r--pstl/include/pstl/internal/glue_numeric_defs.h2
-rw-r--r--pstl/include/pstl/internal/glue_numeric_impl.h18
2 files changed, 14 insertions, 6 deletions
diff --git a/pstl/include/pstl/internal/glue_numeric_defs.h b/pstl/include/pstl/internal/glue_numeric_defs.h
index f997b542362e..86cd38b34b13 100644
--- a/pstl/include/pstl/internal/glue_numeric_defs.h
+++ b/pstl/include/pstl/internal/glue_numeric_defs.h
@@ -60,7 +60,7 @@ exclusive_scan(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIte
_ForwardIterator2 __result, _Tp __init);
template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Tp, class _BinaryOperation>
-_ForwardIterator2
+__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
exclusive_scan(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last,
_ForwardIterator2 __result, _Tp __init, _BinaryOperation __binary_op);
diff --git a/pstl/include/pstl/internal/glue_numeric_impl.h b/pstl/include/pstl/internal/glue_numeric_impl.h
index 18b337133515..241b8a3bebc7 100644
--- a/pstl/include/pstl/internal/glue_numeric_impl.h
+++ b/pstl/include/pstl/internal/glue_numeric_impl.h
@@ -101,17 +101,25 @@ __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardItera
exclusive_scan(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last,
_ForwardIterator2 __result, _Tp __init)
{
- return transform_exclusive_scan(std::forward<_ExecutionPolicy>(__exec), __first, __last, __result, __init,
- std::plus<_Tp>(), __pstl::__internal::__no_op());
+ using namespace __pstl;
+ return __internal::__pattern_transform_scan(
+ std::forward<_ExecutionPolicy>(__exec), __first, __last, __result, __pstl::__internal::__no_op(), __init,
+ std::plus<_Tp>(), /*inclusive=*/std::false_type(),
+ __internal::__is_vectorization_preferred<_ExecutionPolicy, _ForwardIterator1, _ForwardIterator2>(__exec),
+ __internal::__is_parallelization_preferred<_ExecutionPolicy, _ForwardIterator1, _ForwardIterator2>(__exec));
}
template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Tp, class _BinaryOperation>
-_ForwardIterator2
+__pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2>
exclusive_scan(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last,
_ForwardIterator2 __result, _Tp __init, _BinaryOperation __binary_op)
{
- return transform_exclusive_scan(std::forward<_ExecutionPolicy>(__exec), __first, __last, __result, __init,
- __binary_op, __pstl::__internal::__no_op());
+ using namespace __pstl;
+ return __internal::__pattern_transform_scan(
+ std::forward<_ExecutionPolicy>(__exec), __first, __last, __result, __pstl::__internal::__no_op(), __init,
+ __binary_op, /*inclusive=*/std::false_type(),
+ __internal::__is_vectorization_preferred<_ExecutionPolicy, _ForwardIterator1, _ForwardIterator2>(__exec),
+ __internal::__is_parallelization_preferred<_ExecutionPolicy, _ForwardIterator1, _ForwardIterator2>(__exec));
}
// [inclusive.scan]