<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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Cambria",serif;
        color:#1F497D;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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="RU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D;mso-fareast-language:EN-US">In the
<i>“if (omp_in_parallel())”</i> part, OpenMP worksharing constructs such as sections cannot be used. The problem is that worksharing constructs cannot be nested, and it’s quite likely that the outer parallel region already runs one. Therefore, tasks are the
 only option.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D;mso-fareast-language:EN-US">In the
<i>“else”</i> part, the parallel region is created by PSTL, so worksharing can be used; tasks can be used as well.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D;mso-fareast-language:EN-US">If the same approach (tasks) is used in both cases, repetition can be avoided if the relevant code is separated into a function.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D">- Alexey<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Dvorskiy, Mikhail <mikhail.dvorskiy@intel.com>
<br>
<b>Sent:</b> Monday, September 28, 2020 12:44 PM<br>
<b>To:</b> Christopher Nelson <nadiasvertex@gmail.com>; Kukanov, Alexey <Alexey.Kukanov@intel.com>; Pavlov, Evgeniy <evgeniy.pavlov@intel.com><br>
<b>Cc:</b> Louis Dionne <ldionne@apple.com>; Thomas Rodgers <trodgers@redhat.com>; Libc++ Dev <libcxx-dev@lists.llvm.org>; Pavlov, Evgeniy <evgeniy.pavlov@intel.com><br>
<b>Subject:</b> RE: [libcxx-dev] Parallel STL<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Hi Cristopher,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">1.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Briefly about Parallel design and execution policies  handling in particular:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Parallel STL design  is based on <i>pattern of bricks</i> approach and has a compile-time dispatching mechanism which is based on overload resolution of a couple of type-tags –
<i>is_parallel </i>and<i> is_vectror. </i>A set  of combinations of the tags gives four execution policies –
<i>seq, par, unseq, par_unseq</i>. A parallel backend doesn’t handle a passed execution policy  - that parameter may be usefull for some special back-ends. It doesn’t matter for Open MP backend. (See include<i>/pstl/internal/parallel_backend.h</i> for more
 details about OpenMP backend dispatching).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In other words, an implementation of each PSTL algorithm based on two
<i>patterns</i>  - <i>parallel </i>(chosen by <i>is_parallel  </i>type-tag) and <i>
serial </i>(chosen by <i>is_vector  </i>type-tag). <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Each <i>parallel pattern</i> may call <i>
serial brick</i> or <i>vector(unsequenced) brick</i>. It “gives” <i>par</i> and <i>
par_unseq</i> policies implementations.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Each <i>serial pattern</i> also may call <i>
serial brick</i> or <i>vector(unsequenced) brick</i>. It “gives” <i>seq</i> and <i>
unseq</i> policies implementations.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">2.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Yes, we missed to add a definition of “_Combiner” into this review. In that prototype It was moved to an utility file and another namespace… But it doesn’t matter. Just now you can find  “_Combiner” in
</span><a href="https://github.com/llvm/llvm-project/blob/master/pstl/include/pstl/internal/unseq_backend_simd.h"><span lang="EN-US">https://github.com/llvm/llvm-project/blob/master/pstl/include/pstl/internal/unseq_backend_simd.h</span></a><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">3. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In case of <i>omp_in_parallel</i>  to avoid oversubscription you should use a
<i>task API</i> instead of <i>sections</i>. A task doesn’t create a new thread. A task is added to a task pool and may be executed by the first “free” thread from the tread pool.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In <i>else</i> section, I think,  It would be prefer to use  a task API  as well, for better workload balance.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">P.S. + </span><a id="OWAAMF938DB7B87EE4118AA0E1DF6FC2CF9D4" href="mailto:Evgeniy.Pavlov@intel.com"><span lang="EN-US" style="font-family:"Calibri",sans-serif;text-decoration:none">@Pavlov, Evgeniy</span></a><span lang="EN-US">
 who wrote OpenMP backend prototype.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Mikhail Dvorskiy<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Christopher Nelson <</span><a href="mailto:nadiasvertex@gmail.com"><span lang="EN-US">nadiasvertex@gmail.com</span></a><span lang="EN-US">>
<br>
<b>Sent:</b> Sunday, September 27, 2020 10:24 PM<br>
<b>To:</b> Kukanov, Alexey <</span><a href="mailto:Alexey.Kukanov@intel.com"><span lang="EN-US">Alexey.Kukanov@intel.com</span></a><span lang="EN-US">><br>
<b>Cc:</b> Dvorskiy, Mikhail <</span><a href="mailto:mikhail.dvorskiy@intel.com"><span lang="EN-US">mikhail.dvorskiy@intel.com</span></a><span lang="EN-US">>; Louis Dionne <</span><a href="mailto:ldionne@apple.com"><span lang="EN-US">ldionne@apple.com</span></a><span lang="EN-US">>;
 Thomas Rodgers <</span><a href="mailto:trodgers@redhat.com"><span lang="EN-US">trodgers@redhat.com</span></a><span lang="EN-US">>; Libc++ Dev <</span><a href="mailto:libcxx-dev@lists.llvm.org"><span lang="EN-US">libcxx-dev@lists.llvm.org</span></a><span lang="EN-US">><br>
<b>Subject:</b> Re: [libcxx-dev] Parallel STL<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Hello,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I have followed the advice about taking over the review above, and have gotten to a place where I'm working on getting the existing code to compile cleanly. A few functions were not implemented, so I have forwarded them
 to the serial backend for now. Just to get compilation working.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I have a few questions:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">1. I notice that neither the TBB backend, nor the existing OpenMP backend code evaluates the execution policy to understand what to do. I may have misunderstood Louis Dionne, but it appears like the "sequential" mode
 is not handled at all if the user requests it. That seems wrong, so I must be missing something. I also notice that the execution modes are not enums, they are objects. However, when I try to overload on them in order to specialize for sequential, I get a
 compile error saying that the types are not fully defined. What is the design expectation for handling the different execution policies?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">2. The existing code refers to a type: <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<pre><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">using </span><span lang="EN-US" style="font-size:11.5pt;color:#080808">_CombinerType = __pstl::__internal::_Combiner<_Value, _Reduction>;<o:p></o:p></span></pre>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.5pt;font-family:"Courier New";color:#080808">_CombinerType
</span><span lang="EN-US" style="font-size:11.5pt;font-family:"Courier New";color:black">__result</span><span lang="EN-US" style="font-size:11.5pt;font-family:"Courier New";color:#080808">{__identity, &__reduction};</span><span lang="EN-US"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">However, this type does not exist in __pstl::__internal, at least so far as I can tell. Also, the D70530 code dump does not contain a definition of that object. Has this migrated? Should I provide my own implementation
 of it? <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">3. I have tried to implement a very, very simple function:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<pre><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">template </span><span lang="EN-US" style="font-size:11.5pt;color:#080808"><</span><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">class </span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_ExecutionPolicy</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">, </span><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">typename </span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F1</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">, </span><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">typename </span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F2</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">><br></span><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">void </span><span lang="EN-US" style="font-size:11.5pt;color:#00627A">__parallel_invoke</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">(</span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_ExecutionPolicy </span><span lang="EN-US" style="font-size:11.5pt;color:#080808">&&, </span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F1 </span><span lang="EN-US" style="font-size:11.5pt;color:#080808">&&__f1, </span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F2 </span><span lang="EN-US" style="font-size:11.5pt;color:#080808">&&__f2) {<br>    </span><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">if </span><span lang="EN-US" style="font-size:11.5pt;color:#080808">(omp_in_parallel()) {<br>        _PSTL_PRAGMA(omp sections) {<br>            _PSTL_PRAGMA(omp section)<br>            </span><span lang="EN-US" style="font-size:11.5pt;color:teal">std</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">::forward<</span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F1</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">>(__f1)();<br>            _PSTL_PRAGMA(omp section)<br>            </span><span lang="EN-US" style="font-size:11.5pt;color:teal">std</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">::forward<</span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F2</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">>(__f2)();<br>        }<br>    } </span><span lang="EN-US" style="font-size:11.5pt;color:#0033B3">else </span><span lang="EN-US" style="font-size:11.5pt;color:#080808">{<br>        _PSTL_PRAGMA(omp parallel)<br>        _PSTL_PRAGMA(omp sections) {<br>            _PSTL_PRAGMA(omp section)<br>            </span><span lang="EN-US" style="font-size:11.5pt;color:teal">std</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">::forward<</span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F1</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">>(__f1)();<br>            _PSTL_PRAGMA(omp section)<br>            </span><span lang="EN-US" style="font-size:11.5pt;color:teal">std</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">::forward<</span><span lang="EN-US" style="font-size:11.5pt;color:#371F80">_F2</span><span lang="EN-US" style="font-size:11.5pt;color:#080808">>(__f2)();<br>        }<br>    }<br>}<o:p></o:p></span></pre>
<p class="MsoNormal"><span lang="EN-US">Does this look sane? I have just started reading through the OpenMP documentation. This looks like it could be correct, but there is also the "omp task" directive, and it's not clear which of these is superior in this
 case. Also, this seems awfully repetitive. Is this just OpenMP?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Thanks!<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">On Wed, Sep 16, 2020 at 9:28 AM Kukanov, Alexey <</span><a href="mailto:Alexey.Kukanov@intel.com"><span lang="EN-US">Alexey.Kukanov@intel.com</span></a><span lang="EN-US">> wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D">Hi Cristopher,</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" 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: </span><a href="https://reviews.llvm.org/D70530" target="_blank"><span lang="EN-US" style="font-family:"Cambria",serif">https://reviews.llvm.org/D70530</span></a><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D">,
 but further work is postponed. If you are interested to continue, you are more than welcome, and we will help with guidance and feedback.</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D">Regards,</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" style="font-family:"Cambria",serif;color:#1F497D">- Alexey</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> libcxx-dev <</span><a href="mailto:libcxx-dev-bounces@lists.llvm.org" target="_blank"><span lang="EN-US">libcxx-dev-bounces@lists.llvm.org</span></a><span lang="EN-US">>
<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 <</span><a href="mailto:ldionne@apple.com" target="_blank"><span lang="EN-US">ldionne@apple.com</span></a><span lang="EN-US">><br>
<b>Cc:</b> Dvorskiy, Mikhail <</span><a href="mailto:mikhail.dvorskiy@intel.com" target="_blank"><span lang="EN-US">mikhail.dvorskiy@intel.com</span></a><span lang="EN-US">>;
<br>
<b>Subject:</b> Re: [libcxx-dev] Parallel STL<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Fantastic. I will study the serial backend and see what I can do!<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">On Tue, Sep 15, 2020 at 5:27 PM Louis Dionne <</span><a href="mailto:ldionne@apple.com" target="_blank"><span lang="EN-US">ldionne@apple.com</span></a><span lang="EN-US">>
 wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">+ Mikhail, who wrote most of the PSTL<o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-US"><o:p> </o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">On Sep 15, 2020, at 15:40, Christopher Nelson <</span><a href="mailto:nadiasvertex@gmail.com" target="_blank"><span lang="EN-US">nadiasvertex@gmail.com</span></a><span lang="EN-US">>
 wrote:<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">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></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">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></span></p>
</div>
</div>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">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></span></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">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></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">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></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">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></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Cheers,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Louis<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-US"><o:p> </o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">On Tue, Sep 15, 2020 at 2:50 PM Louis Dionne <</span><a href="mailto:ldionne@apple.com" target="_blank"><span lang="EN-US">ldionne@apple.com</span></a><span lang="EN-US">>
 wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-US">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><a href="mailto:libcxx-dev@lists.llvm.org" target="_blank"><span lang="EN-US">libcxx-dev@lists.llvm.org</span></a><span lang="EN-US">> 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><a href="mailto:libcxx-dev@lists.llvm.org" target="_blank"><span lang="EN-US">libcxx-dev@lists.llvm.org</span></a><span lang="EN-US"><br>
> </span><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 lang="EN-US"><o:p></o:p></span></p>
</blockquote>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>