[libcxx-dev] Parallel STL

Louis Dionne via libcxx-dev libcxx-dev at lists.llvm.org
Tue Sep 15 14:27:55 PDT 2020

+ Mikhail, who wrote most of the PSTL

> On Sep 15, 2020, at 15:40, Christopher Nelson <nadiasvertex at gmail.com> wrote:
> Okay, that makes sense. I can see how you might want to use Grand Central Dispatch on macOS, and the Windows system thread pool on Windows. I'm not really sure what that means for Linux, though. Other than maybe pthreads, which is not great.
> Is there any documentation on what is needed to create a backend? Or are there perhaps already plans in motion? I don't want to step on any toes, but I would love to have a usable pstl on macOS and Linux for the next LLVM release.
> We use libc++ on Linux as well as macOS. Depending on what's involved, I might be able to contribute a backend for those two platforms.

You're not stepping on any toes, far from that. If we have backends with satisfactory performance and we're confident about ABI stability, I don't see a reason why we wouldn't ship the PSTL as soon as we have those. One big issue to shipping it so far has been that the only backends are serial (not great to ship that), and the other one relies on an external dependency (TBB).

Mikhail might be able to provide documentation. We should check it into the PSTL repository. I meant to write such documentation when I wrote the serial backend, but never got around to writing something that was enough to check in. You can see the minimal API needed to implement a backend here: pstl/include/pstl/internal/parallel_backend_serial.h. It's the serial backend, which tries to be as trivial as possible.

Are you familiar with libc++ contribution? If so, contributing to PSTL works basically the same -- just send a Phabricator review and I'll review it. We can also chat on Slack in the Cpplang workspace and I can give some guidance -- look for "ldionne".


> On Tue, Sep 15, 2020 at 2:50 PM Louis Dionne <ldionne at apple.com <mailto:ldionne at apple.com>> wrote:
> Hi,
> Long story short, the PSTL is pretty much ready to be shipped with LLVM. I did the integration between it and libc++, and it all worked last time I checked. I think the next step would be to change whatever LLVM scripts are used to create releases to also install the PSTL, which is the part I haven't had time to look into yet.
> That being said, the PSTL will then default to using the Serial backend, which isn't very useful. We could decide to ship a different backend if we wanted, however I think what makes sense is to use a backend specific to the platform we're running on instead of adding a dependency to LLVM.
> Louis
> > On Sep 8, 2020, at 08:25, Christopher Nelson via libcxx-dev <libcxx-dev at lists.llvm.org <mailto:libcxx-dev at lists.llvm.org>> wrote:
> > 
> > Hello friends,
> > 
> > I have spent some time looking at the mailing archives and git logs for the parallel STL. I'm not clear what state it is in, since the oneAPI/tbb seems to be production ready and comes with the parallel STL. Also, it appears the GCC has shipped a PSTL based on the same code that clang is using.
> > 
> > I was wondering if someone could clarify for me what state the PSTL is in, and if there is some work needed to help get it over the finish line I may be able to help. I'm very interested in using it in our production software, so I'm a motivated helper. :-)
> > 
> > Thank you for your time,
> > -={C}=-
> > _______________________________________________
> > libcxx-dev mailing list
> > libcxx-dev at lists.llvm.org <mailto:libcxx-dev at lists.llvm.org>
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20200915/d671e33a/attachment.html>

More information about the libcxx-dev mailing list