[libcxx-commits] [PATCH] D99836: [pstl] Implement OpenMP backend

Mikhail Dvorskiy via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 27 06:19:20 PDT 2021


MikeDvorskiy added inline comments.


================
Comment at: pstl/include/pstl/internal/parallel_backend_omp.h:342
+        // the only one; we manually generate the identity elements for each thread.
+        alignas(_Value) char __accums_storage[__num_threads * sizeof(_Value)];
+        _Value* __accums = reinterpret_cast<_Value*>(__accums_storage);
----------------
ISO C++ forbids variable length array.


================
Comment at: pstl/include/pstl/internal/parallel_backend_omp.h:552
+template <typename _RandomAccessIterator>
+struct _MinKItems
+{
----------------
1) What's a goal of the structure?  
2) I think better to don't introduce new stuff (struct _MinKItems), we can use std::vector instead (if we really need).


================
Comment at: pstl/include/pstl/internal/parallel_backend_omp.h:732
+    auto __size = static_cast<std::size_t>(std::distance(__xs, __xe));
+    std::atomic_bool* __status = new std::atomic_bool[__size];
+
----------------
I think a container, for example std::vector, is better causing RAII reason.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99836/new/

https://reviews.llvm.org/D99836



More information about the libcxx-commits mailing list