[libcxx-commits] [PATCH] D150277: [libc++][PSTL] Move the already implemented functions to the new dispatching scheme

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 10 13:54:38 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/include/__algorithm/pstl_any_all_none_of.h:42-44
+        return std::find_if(__policy, __first, __last, [&](__iter_reference<_ForwardIterator> __value) {
+                 return __pred(__value);
+               }) != __last;
----------------
I think you can just use `std::find_if(__policy, __first, __last, __pred)` here.


================
Comment at: libcxx/include/__algorithm/pstl_backend.h:45
+  template <class _ExecutionPolicy, class _Iterator, class _Predicate>
+  bool __pstl_any_of(_Backend, _Iterator __first, _iterator __last, _Predicate __pred);
+
----------------
Also `all_of` and `none_of`?


================
Comment at: libcxx/include/__algorithm/pstl_backends/cpu_backend.h:19
   void __parallel_for(_RandomAccessIterator __first, _RandomAccessIterator __last, _Functor __func);
 
   TODO: Document the parallel backend
----------------
You should add `cancel_execution` here.


================
Comment at: libcxx/include/__algorithm/pstl_backends/cpu_backend.h:23
 
+#include <__algorithm/pstl_backends/cpu_backends/fill.h>
+#include <__algorithm/pstl_backends/cpu_backends/find_if.h>
----------------
We should include `any_of`.


================
Comment at: libcxx/include/__algorithm/pstl_backends/cpu_backends/fill.h:38
+_LIBCPP_HIDE_FROM_ABI void
+__pstl_fill(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
+  if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
----------------
Missing `__cpu_backend_tag`


================
Comment at: libcxx/include/__algorithm/pstl_backends/cpu_backends/find_if.h:9
+
+#ifndef _LIBCPP___ALGORITHM_PSTL_BACKENDS_FIND_IF_H
+#define _LIBCPP___ALGORITHM_PSTL_BACKENDS_FIND_IF_H
----------------
`_LIBCPP___ALGORITHM_PSTL_BACKENDS_FIND_IF_H` => `_LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKENDS_FIND_IF_H`


================
Comment at: libcxx/include/__algorithm/pstl_fill.h:13
+#include <__algorithm/pstl_for_each.h>
+#include <__algorithm/pstl_frontend_dispatch.h>
 #include <__config>
----------------
You also need `__algorithm/fill.h` right?


================
Comment at: libcxx/include/__algorithm/pstl_find.h:19
 #include <__type_traits/remove_cvref.h>
+#include <__type_traits/void_t.h>
 #include <__utility/terminate_on_exception.h>
----------------
I don't think you need that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150277



More information about the libcxx-commits mailing list