<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">+ llvm-dev<br>
</p>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> cfe-dev <cfe-dev-bounces@lists.llvm.org> on behalf of Anastasia Stulova via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Sent:</b> 29 October 2018 16:54<br>
<b>To:</b> clang developer list<br>
<b>Cc:</b> Nicholas Wilson; nd; Brian.Sumner@amd.com<br>
<b>Subject:</b> Re: [cfe-dev] [llvm-dev] [RfC] A proposal of adding SPIR-V Toolchain in Clang</font>
<div> </div>
</div>
<meta content="text/html; charset=iso-8859-1">
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Thanks to everyone who participated in the Round Table discussion
<span>during the LLVM Dev Meeting</span>. Below is a brief summary.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">First of all, a number of concerns were raised again regarding the backend implementation. The implementation effort of developing the backend is significant and it's not clear to the SPIR-V developers if it results
in the comparable or better quality generated binaries compared to the current solution using the IR translation [1]. This has been discussed earlier on llvm-dev as well [2], [3]. Another big concern was about the code duplication between the translation from/to
SPIR-V that would have to be separated out into different flows.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">The opinion of the developers attending the meeting was that we would prefer to continue using the translation tool [1]; but we would still like to improve the integration with LLVM as much as possible. There are a number
of options that we have discussed briefly: external translator tool invocation via fork of Clang, adding SPIR-V triple w/o any external tool, adding translator as an official tool to the LLVM project (suggested earlier [4]).</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">To address concerns and suggestions from the LLVM community on this thread I am planning to look at the following topics with some help from Neil Hickey (in CC), before getting back with an updated proposal:</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">A. <span>We will prototype a SPIR-V backend</span> using the Global ISel in order to understand further the development effort and the quality of the code produced by the backend (+ potentially compilation time) compared
to the simple IR translation.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">B. I will look at how external tools are currently used with LLVM and try to suggest reasonable flow/process for the translator tool [1] that we would like to integrate at least for the purpose of importing SPIR-V modules
to LLVM [5]. <br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Please, let me know if you would like to be involved with any of the investigation activities I am planning or if you have any additional information that should be considered.<br>
</p>
<p style="margin-top:0; margin-bottom:0"></p>
<div><br>
Cheers,<br>
Anastasia<br>
<br>
<div>[1] <a href="https://github.com/KhronosGroup/SPIRV-LLVM-Translator" class="x_OWAAutoLink">
https://github.com/KhronosGroup/SPIRV-LLVM-Translator</a></div>
[2] <a href="http://lists.llvm.org/pipermail/llvm-dev/2017-May/112651.html" class="x_OWAAutoLink">
http://lists.llvm.org/pipermail/llvm-dev/2017-May/112651.html</a><span><br>
[3] <a href="http://lists.llvm.org/pipermail/llvm-dev/2017-May/112550.html" class="x_OWAAutoLink">
http://lists.llvm.org/pipermail/llvm-dev/2017-May/112550.html</a></span><br>
<span></span></div>
<p></p>
<p style="margin-top:0; margin-bottom:0"><span>[4] <a href="https://lists.llvm.org/pipermail/llvm-dev/2018-February/121317.html" class="x_OWAAutoLink">
https://lists.llvm.org/pipermail/llvm-dev/2018-February/121317.html</a></span><br>
</p>
<p style="margin-top:0; margin-bottom:0"><a href="https://github.com/KhronosGroup/SPIRV-LLVM-Translator" class="x_OWAAutoLink"></a>[5] <a href="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/wiki/SPIRV-Toolchain-for-Clang" class="x_OWAAutoLink"></a><a href="http://lists.llvm.org/pipermail/cfe-dev/2018-September/059368.html" class="x_OWAAutoLink">http://lists.llvm.org/pipermail/cfe-dev/2018-September/059368.html</a><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Anastasia Stulova via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Sent:</b> 17 September 2018 10:00<br>
<b>To:</b> Nicholas Wilson<br>
<b>Cc:</b> llvm-dev@lists.llvm.org; nd; clang developer list; Brian.Sumner@amd.com<br>
<b>Subject:</b> Re: [llvm-dev] [RfC] A proposal of adding SPIR-V Toolchain in Clang</font>
<div> </div>
</div>
<meta content="text/html; charset=iso-8859-1">
<div dir="ltr">
<div id="x_x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div id="x_x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Hi Nicholas,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">A number of developers that are interested in the SPIR-V support will be attending the conference. Sounds good to have a round table. It is important to involve relevant developers outside of Khronos that are affected
too!</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">So far there are the following topics to address:</p>
<p style="margin-top:0; margin-bottom:0">- Generation of SPIR-V binaries in LLVM.</p>
<p style="margin-top:0; margin-bottom:0">- Importing and linking SPIR-V libraries/binaries.</p>
<p style="margin-top:0; margin-bottom:0">- Generic target in Clang for the next OpenCL C and C++ features.</p>
<p style="margin-top:0; margin-bottom:0">- Use of external tools.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">My only concern now is about the OpenCL C++ implementation that might be stalled while we are waiting for the decisions. But it's probably important to make sure we are going the right route to fit all requirements.<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Anastasia<br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Nicholas Wilson <iamthewilsonator@hotmail.com><br>
<b>Sent:</b> 17 September 2018 04:42:32<br>
<b>To:</b> Anastasia Stulova<br>
<b>Cc:</b> clang developer list; llvm-dev@lists.llvm.org; nd; Brian.Sumner@amd.com<br>
<b>Subject:</b> Re: [llvm-dev] [RfC] A proposal of adding SPIR-V Toolchain in Clang</font>
<div> </div>
</div>
<div class="x_x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_x_PlainText">Given the amount of discussion that has gone on (and in past threads) and the size of the proposal, should we do a roundtable at the dev meeting in October to make sure everyone is on the same page going forward? I would come along
for that if there is sufficient participation from Khronos to make good progress.<br>
<br>
Nic<br>
<br>
<br>
> On 10 Sep 2018, at 11:10 pm, Anastasia Stulova via llvm-dev <llvm-dev@lists.llvm.org> wrote:<br>
> <br>
> Hello,<br>
> <br>
> Since 2015 Khronos has switched to the new portable intermediate format SPIR-V, which has replaced the original SPIR. The advantage is that it offers higher portability across different toolchains. There was a talk about it at a Dev Meeting:<br>
> <a href="http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#17">
http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#17</a><br>
> <br>
> LLVM currently only supports SPIR format for OpenCL in Clang. Several Khronos vendors (ARM, AMD, Intel, Xilinx, Codeplay and others) are interested in adding support for SPIR-V, which should gradually replace the old SPIR once products are no longer shipped
with the old format. Here is the detailed description:<br>
> <a href="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/wiki/SPIRV-Toolchain-for-Clang">
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/wiki/SPIRV-Toolchain-for-Clang</a><br>
> <br>
> To summarize, the idea is to add a SPIR-V target triple to Clang that can be used to generate a SPIR-V binary for OpenCL code. There was a separate thread regarding generation of SPIR-V binary and the community suggested that a translator from LLVM IR to
SPIR-V can be used as an external tool, called llvm-spirv. This can be invoked similar to such tools as ptxas and fatbinary for the CUDA toolchain:<br>
> <a href="http://lists.llvm.org/pipermail/llvm-dev/2018-February/121440.html">http://lists.llvm.org/pipermail/llvm-dev/2018-February/121440.html</a><br>
> <br>
> An example of how Clang can be used to target SPIR-V:<br>
> <br>
> clang -c test.cl -target spirv[32|64]-unknown-unknown -o test.spv<br>
> <br>
> This will result in the following Clang actions:<br>
> <br>
> (1) clang -cc1 -triple spirv[32|64]-unknown-unknown test.cl -emit-llvm-bc -o test.bc<br>
> <br>
> (2) llvm-spirv test.bc -o test.spv<br>
> <br>
> SPIR-V generation is essential for completion of OpenCL C++ support in Clang, as newer OpenCL standards require frontend invocation to be performed offline, producing the SPIR-V binary that can be then loaded at application execution time. Besides that, it
will also allow Clang to be used as a complete standalone tool to generate portable binaries that can then be consumed by different proprietary toolchains. In addition, this will open a path to the LLVM backends for various languages and frontends that already
generate SPIR-V.<br>
> <br>
> A more detailed explanation of the complete design proposal is given in this Wiki page:<br>
> <a href="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/wiki/SPIRV-Toolchain-for-Clang">
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/wiki/SPIRV-Toolchain-for-Clang</a><br>
> <br>
> Looking forward to any feedback about the proposal or possible collaborations,<br>
> <br>
> Thanks!<br>
> <br>
> Anastasia<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> llvm-dev@lists.llvm.org<br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
</div>
</span></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>