[libcxx-commits] [PATCH] D59791: [pstl] Add a serial backend for the PSTL

Mikhail Dvorskiy via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 26 02:27:34 PDT 2019


MikeDvorskiy added a comment.

Hi Louis,

Actually, there is a draft of Parallel STL back-end  API documentation. Probably, not so detailed, but there is. I sent it Thomas several month ago. I've just sent you as well.
M.b. make sense to put one into the repo?
And of course , don't hesitate writing directly me about Parallel STL  first to prevent wasting time for guessing)..

In essence. I think we don't need to write a special serial back-end if we want a serial execution by a parallel policy. According to PSTL design we can  just additional compile time dispatching om "pattern of bricks"  design level. It will do a re-direct to the serial patterns. See "is_parallelization_preferred". 
Furthermore, we can do just one change within "is_parallelization_preferred"  or even, within the parallel policy traits. But I tent to "is_parallelization_preferred" and avoid the policy traits modification.

For example,

  template <typename _ExecutionPolicy, typename... _IteratorTypes>
  auto is_parallelization_preferred(_ExecutionPolicy&& __exec)
      -> decltype(lazy_and(__exec.__allow_parallel(), typename is_random_access_iterator<_IteratorTypes...>::type()))
  {
  #if __PSTL_PAR_BACKEND_SERIAL
      return std::false_type();
  #else
      return internal::lazy_and(__exec.__allow_parallel(), typename is_random_access_iterator<_IteratorTypes...>::type());
  #endif
  }


Repository:
  rPSTL pstl

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

https://reviews.llvm.org/D59791





More information about the libcxx-commits mailing list