diff options
author | Mikhail Dvorskiy <mikhail.dvorskiy@intel.com> | 2021-10-27 18:51:36 +0300 |
---|---|---|
committer | Mikhail Dvorskiy <mikhail.dvorskiy@intel.com> | 2021-10-27 18:52:41 +0300 |
commit | 8f5cb64c7147c27953933dbaea107454ff066ed1 (patch) | |
tree | 86242982f959d35c38b6be6c049777186588c32e | |
parent | 64d1617d18cb8b6f9511d0eda481fc5a5d0ebddf (diff) | |
download | llvm-8f5cb64c7147c27953933dbaea107454ff066ed1.tar.gz |
[pstl] A hot fix for a reduction parallel pattern of OpenMP backend
Reviewed By: nadiasvertex, ldionne
Differential Revision: https://reviews.llvm.org/D112125
-rw-r--r-- | pstl/include/pstl/internal/omp/parallel_reduce.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pstl/include/pstl/internal/omp/parallel_reduce.h b/pstl/include/pstl/internal/omp/parallel_reduce.h index 71fc8a261bbd..f0b5afc459f5 100644 --- a/pstl/include/pstl/internal/omp/parallel_reduce.h +++ b/pstl/include/pstl/internal/omp/parallel_reduce.h @@ -23,6 +23,11 @@ _Value __parallel_reduce_body(_RandomAccessIterator __first, _RandomAccessIterator __last, _Value __identity, _RealBody __real_body, _Reduction __reduce) { + if (__should_run_serial(__first, __last)) + { + return __real_body(__first, __last, __identity); + } + auto __middle = __first + ((__last - __first) / 2); _Value __v1(__identity), __v2(__identity); __parallel_invoke_body( |