<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;}
/* 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;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@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="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">HI Jeff, <o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">thanks for your answers. Comments are inlined
</span><span lang="EN-US" style="font-family:"Segoe UI Emoji",sans-serif;mso-fareast-language:EN-US">😉</span><span lang="EN-US" style="mso-fareast-language:EN-US">
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>Von:</b> Jeff Hammond [mailto:jeff.science@gmail.com] <br>
<b>Gesendet:</b> Dienstag, 6. Februar 2018 07:06<br>
<b>An:</b> Haidl, Michael <michael.haidl@uni-muenster.de><br>
<b>Cc:</b> cfe-dev@lists.llvm.org<br>
<b>Betreff:</b> Re: [cfe-dev] [RFC] Upstreaming PACXX (Programing Accelerators with C++)<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">This is cool.  I'm very glad to see your PhD research was done in a production environment and that you are open-sourcing it.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">PACXX looks a lot like SYCL.  Have you considered whether it can be evolved into a high-quality implementation of the SYCL standard API?  There's a lot of value in implementing a standardized API with multiple implementations.  I've used
 ComputeCpp, triSYCL, and sycl-gtx recently, and each has limitations that could be overcome by having SYCL support in Clang/LLVM.<o:p></o:p></p>
<p class="MsoNormal"><b><i><span lang="EN-US">[Haidl, Michael] <o:p></o:p></span></i></b></p>
<p class="MsoNormal"><span lang="EN-US">SYCL and PACXX share the same goal. When I started my work SYCL was just a preliminary draft and came a little bit to late for me. I think building SYCL on top of PACXX should be possible and an open source implementation
 of SYCL in Clang/LLVM would really be a good thing. <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Your contribution of a good SYCL implementation would be really valuable, since there appears to be no implementation that both performs well and is open-source. 
</span>I completely understand if you have no time in turn PACXX into SYCL, but if you have technical arguments against doing so even if time permitted, I think they'd be useful to share, although perhaps not in this forum.<o:p></o:p></p>
<p class="MsoNormal"><b><i>[Haidl, Michael] <o:p></o:p></i></b></p>
<p class="MsoNormal"><span lang="EN-US">I don’t see any showstoppers of building the SYCL interface on top of the PACXX runtime. I knot SYCL a little bit and the standard seems a lot more restrictive than what PACXX can do, e.g., SYCL enforces standard-type
 layout for types used in a kernel which is not the case for PACXX since host and device compiler are the same and there are no differences between the host layout of a type and the device side.
<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">On a practical level, PACXX seems to require some software hardening.  I tried to follow the docs and build it locally, but had some issues (GitHub issues were created, so I'll omit details here) and ultimately failed to compile your example
 program.  I'd love to be able to try it out, since I've recently evaluated SYCL and Boost.Compute using <a href="https://github.com/ParRes/Kernels">https://github.com/ParRes/Kernels</a>, and it seems like PACXX is a peer of these.<o:p></o:p></p>
</div>
<p class="MsoNormal"><b><i><span lang="EN-US">[Haidl, Michael] </span></i></b><span lang="EN-US">I noticed your issues and I will look into it.
<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">Best,<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">Jeff<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal">On Sun, Feb 4, 2018 at 11:50 PM, Haidl, Michael via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">HI LLVM comunity,<br>
<br>
after 3 years of development, various talks on LLVM-HPC and EuroLLVM and other scientific conferences I want to present my PhD research topic to the lists.<br>
<br>
The main goal for my research was to develop a single-source programming model equal to CUDA or SYCL for accelerators supported by LLVM (e.g., Nvidia GPUs). PACXX uses Clang as front-end for code generation and comes with a runtime library (PACXX-RT) to execute
 kernels on the available hardware. Currently, PACXX supports Nvidia GPUs through the NVPTX Target and CUDA, CPUs through MCJIT (including whole function vectorization thanks to RV [1]) and has an experimental back-end for AMD GPUs using the AMDGPU Target and
 ROCm.<br>
<br>
The main idea behind PACXX is the use of the LLVM IR as kernel code representation which is integrated into the executable together with the PACXX-RT. At runtime of the program the PACXX-RT compiles the IR to the final MC level and hands it over to the device.
 Since, PACXX does currently not enforce any major restrictions on the C++ code we managed to run (almost) arbitrary C++ code on GPUs including range-v3 [2, 3].<br>
<br>
A short vector addition example using PACXX:<br>
<br>
using namespace pacxx::v2;<br>
int main(int argc, char *argv[]) {<br>
   // get the default executor<br>
   auto &exec = Executor::get();<br>
    size_t size = 128;<br>
    std::vector<int> a(size, 1);<br>
    std::vector<int> b(size, 2);<br>
    std::vector<int> c(size, 0);<br>
<br>
    // allocate device side memory<br>
    auto &da = exec.allocate<int>(a.size());<br>
    auto &db = exec.allocate<int>(b.size());<br>
    auto &dc = exec.allocate<int>(c.size());<br>
    // copy data to the accelerator<br>
    da.upload(a);<br>
    db.upload(b);<br>
    dc.upload(c);<br>
    // get the raw pointer<br>
    auto pa = da.get();<br>
    auto pb = db.get();<br>
    auto pc = dc.get();<br>
<br>
    // define the computation<br>
    auto vadd = [=](auto &config) {<br>
      auto i = config.get_global(0);<br>
      if (i < size)<br>
       pc[i] = pa[i] + pb[i];<br>
    };<br>
<br>
    // launch and synchronize<br>
    std::promise<void> promise;<br>
    auto future = exec.launch(vadd, {{1}, {128}}, promise);<br>
    future.wait();<br>
    // copy back the data<br>
    dc.download(c);<br>
}<br>
<br>
Recently, I open sourced PACXX on github [3] under the same license LLVM is currently using.<br>
Since my PhD is now in its final stage I wanted to ask if there is interest in having such an SPMD programming model upstreamed.<br>
PACXX is currently on par with release_60 and only requires minor modifications to Clang, e.g., a command line switch, C++ attributes, some diagnostics and metadata generation during code gen.<br>
The PACXX-RT can be integrated into the LLVM build system and may remain a standalone project. (BTW, may I ask to add PACXX to the LLVM projects?).<br>
<br>
Looking forward for your feedback.<br>
<br>
Cheers,<br>
Michael Haidl<br>
<br>
[1] <a href="https://github.com/cdl-saarland/rv" target="_blank">https://github.com/cdl-saarland/rv</a><br>
[2] <a href="https://github.com/ericniebler/range-v3" target="_blank">https://github.com/ericniebler/range-v3</a><br>
[3] <a href="https://dl.acm.org/authorize?N20051" target="_blank">https://dl.acm.org/authorize?N20051</a><br>
[4] <a href="https://github.com/pacxx/pacxx-llvm" target="_blank">https://github.com/pacxx/pacxx-llvm</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Jeff Hammond<br>
<a href="mailto:jeff.science@gmail.com" target="_blank">jeff.science@gmail.com</a><br>
<a href="http://jeffhammond.github.io/" target="_blank">http://jeffhammond.github.io/</a><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>