<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Cambria;
        panose-1:2 4 5 3 5 4 6 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:56.7pt 42.5pt 56.7pt 85.05pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Cristopher,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please find the attachment  - Parallel Backend API documentation.<o:p></o:p></p>
<p class="MsoNormal">Don’t hesitate to ask questions regarding API or the mentioned OpenMP backend prototype.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
<p class="MsoNormal">Mikhail Dvorskiy<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Kukanov, Alexey <Alexey.Kukanov@intel.com> <br>
<b>Sent:</b> Wednesday, September 16, 2020 4:28 PM<br>
<b>To:</b> Christopher Nelson <nadiasvertex@gmail.com><br>
<b>Cc:</b> Dvorskiy, Mikhail <mikhail.dvorskiy@intel.com>; Louis Dionne <ldionne@apple.com>; Thomas Rodgers <trodgers@redhat.com>; Libc++ Dev <libcxx-dev@lists.llvm.org><br>
<b>Subject:</b> RE: [libcxx-dev] Parallel STL<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-family:"Cambria",serif;color:#1F497D">Hi Cristopher,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Cambria",serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Cambria",serif;color:#1F497D">One good way to contribute, I think, is to develop an OpenMP-based parallel backend. LLVM already supports OpenMP, so it resolves the dependency problem Louis mentioned. While it’s
 arguably not the best default engine in the long term, there is certainly some demand for it. The GCC community is also interested in it. Moreover, Mikhail and the team at Intel in collaboration with Thomas (CC’d) from GCC already developed a basic prototype:
<a href="https://reviews.llvm.org/D70530">https://reviews.llvm.org/D70530</a>, but further work is postponed. If you are interested to continue, you are more than welcome, and we will help with guidance and feedback.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Cambria",serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Cambria",serif;color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Cambria",serif;color:#1F497D">- Alexey<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> libcxx-dev <<a href="mailto:libcxx-dev-bounces@lists.llvm.org">libcxx-dev-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Christopher Nelson via libcxx-dev<br>
<b>Sent:</b> Wednesday, September 16, 2020 2:43 PM<br>
<b>To:</b> Louis Dionne <<a href="mailto:ldionne@apple.com">ldionne@apple.com</a>><br>
<b>Cc:</b> Dvorskiy, Mikhail <<a href="mailto:mikhail.dvorskiy@intel.com">mikhail.dvorskiy@intel.com</a>>;
<br>
<b>Subject:</b> Re: [libcxx-dev] Parallel STL<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Fantastic. I will study the serial backend and see what I can do!<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Sep 15, 2020 at 5:27 PM Louis Dionne <<span lang="RU"><a href="mailto:ldionne@apple.com"><span lang="EN-US">ldionne@apple.com</span></a></span>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">+ Mikhail, who wrote most of the PSTL<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Sep 15, 2020, at 15:40, Christopher Nelson <<span lang="RU"><a href="mailto:nadiasvertex@gmail.com" target="_blank"><span lang="EN-US">nadiasvertex@gmail.com</span></a></span>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">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).<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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".<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Louis<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Sep 15, 2020 at 2:50 PM Louis Dionne <<span lang="RU"><a href="mailto:ldionne@apple.com" target="_blank"><span lang="EN-US">ldionne@apple.com</span></a></span>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi,<br>
<br>
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.<br>
<br>
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.<br>
<br>
Louis<br>
<br>
> On Sep 8, 2020, at 08:25, Christopher Nelson via libcxx-dev <<span lang="RU"><a href="mailto:libcxx-dev@lists.llvm.org" target="_blank"><span lang="EN-US">libcxx-dev@lists.llvm.org</span></a></span>> wrote:<br>
> <br>
> Hello friends,<br>
> <br>
> 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.<br>
> <br>
> 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. :-)<br>
> <br>
> Thank you for your time,<br>
> -={C}=-<br>
> _______________________________________________<br>
> libcxx-dev mailing list<br>
> <span lang="RU"><a href="mailto:libcxx-dev@lists.llvm.org" target="_blank"><span lang="EN-US">libcxx-dev@lists.llvm.org</span></a></span><br>
> <span lang="RU"><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" target="_blank"><span lang="EN-US">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</span></a></span><o:p></o:p></p>
</blockquote>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>