<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Thanks, Eli and Jingyue. I just thought to fake them that way. Plus, consider corresponding <div>semantics of CUDA syntax when processing AST. </div><div><br><div><div>Hope to see you guys at google next summer. :) <div><br></div><div>Pengcheng<br><div><br><div><div>On Oct 6, 2014, at 6:46 PM, Eli Bendersky <<a href="mailto:eliben@google.com">eliben@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 6, 2014 at 3:36 PM, Jingyue Wu <span dir="ltr"><<a href="mailto:jingyue@google.com" target="_blank">jingyue@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Eli, <br><br>Lacking of real support for threadIdx, blockIdx, etc. may be fine for Pengcheng (?) because he's doing CUDA->AST->CUDA transformation. <span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Yep, I think this is what I wrote below suggests. The linked header creates fake declarations of these globals, which is good enough for Clang's parsing.</div><div><br></div><div>Eli</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><div></div><div>Jingyue</div><br></font></span><div class="gmail_quote"><div><div class="h5">On Mon Oct 06 2014 at 3:21:11 PM Eli Bendersky <<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 6, 2014 at 11:25 AM, lipengcheng <span dir="ltr"><<a href="https://urldefense.proofpoint.com/v1/url?u=http://mailto:pli%40cs.rochester.edu&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=uCB6%2BIbeBWRMZqs%2B6BtY9ZPvLRQLB3nVYqkh0i2fkkA%3D%0A&s=fb5c4112f4733ea88dcf6f71e5454df3fb108af5a657a38e52a6e0bfbac41011" target="_blank">pli@cs.rochester.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">Thanks, Eli.<div><br></div><div>May I know what your initial support is? Can you please open it to me?</div><div>I don’t need too strong CUDA support, say generating CUDA code to LLVM</div><div>IR. What I only need to do is to parse CUDA code to Clang AST, and then</div><div>translate it back .</div><div><br></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>So this part should already work, if you're careful. The main missing parts for just parsing the CUDA source into the AST are:</div><div><br></div><div>1. Real support for the threadIdx, blockIdx, etc. special globals</div><div>2. Various header definitions for __global__ & friends, CUDA builtins, etc.</div><div><br></div><div>If all you need is to *parse*, then a simple header like <a href="https://urldefense.proofpoint.com/v1/url?u=https://gist.github.com/eliben/b014ac17cbe5a452803f&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=uCB6%2BIbeBWRMZqs%2B6BtY9ZPvLRQLB3nVYqkh0i2fkkA%3D%0A&s=2d9719353c5102fec52c164e3cf7a04c32f063166ba55d31e0f51324118acbf7" target="_blank">https://gist.github.com/eliben/b014ac17cbe5a452803f</a> should do the trick.</div><div><br></div><div>Then you can do:</div><div><br></div><div>$ clang -cc1 -ast-dump -x cuda -include <path-to-header-file-in-gist> <a href="https://urldefense.proofpoint.com/v1/url?u=http://cuda-input-file.cu&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=uCB6%2BIbeBWRMZqs%2B6BtY9ZPvLRQLB3nVYqkh0i2fkkA%3D%0A&s=5255e413588a883a9d5a6e310a4e9845713a9bc1c9110878df3d61552bf17c6d" target="_blank">cuda-input-file.cu</a></div><div><br></div><div>And this should dump the AST. If you need to support more CUDA builtins (and/or runtime functions), you should add them to the header, *or* try to get Clang to parse the NVIDIA CUDA headers.</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Eli</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div></div><div>Thanks,</div><div>Pengcheng</div><div><br><div><div>On Oct 6, 2014, at 12:34 PM, Eli Bendersky <<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>> wrote:</div><br><blockquote type="cite">
<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 6, 2014 at 6:40 AM, lipengcheng <span dir="ltr"><<a href="https://urldefense.proofpoint.com/v1/url?u=http://mailto:pli%40cs.rochester.edu&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=Ndab2z%2B8lUH2UWs3LWtnM9Cai6wVRsOxorwsUutFIqM%3D%0A&s=b573ee104d18abf760999f0d33766404caaf2d891bf0bcb90fd60c8cadd7232b" target="_blank">pli@cs.rochester.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">> Hi there,<br>
><br>
> May I ask what’s the status of supporting CUDA on Clang?<br>
> Are there any incomplete patches to use for CUDA? I am doing<br>
> a source-to-source translation work for CUDA based on Clang.<br>
><br>
> Thanks,<br>
> Pengcheng<br><br></blockquote><div><br></div><div>Hi Pengcheng,</div><div><br></div><div>CUDA is still only partially supported. This has been discussed a few times this year:</div><div><br></div><div><a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-September/038979.html&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=Ndab2z%2B8lUH2UWs3LWtnM9Cai6wVRsOxorwsUutFIqM%3D%0A&s=49732052e1fd12cadb980beea32db56ab3523a57d889cf839753864eed1a8b28" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-September/038979.html</a><br></div><div><a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-March/035782.html&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=Ndab2z%2B8lUH2UWs3LWtnM9Cai6wVRsOxorwsUutFIqM%3D%0A&s=4e85032739b5ab7b3bc84963f894a88d40ccd6d71b27630a6b17221e44aec8ee" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-March/035782.html</a><br></div><div><br></div><div>Things haven't changed significantly since then. Patches welcome!</div><div>Eli</div><div><br></div><div> </div></div><br></div></div>
</blockquote></div><br></div></div></blockquote></div></div></div></div></div><span class="">
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="https://urldefense.proofpoint.com/v1/url?u=http://mailto:cfe-dev%40cs.uiuc.edu&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=uCB6%2BIbeBWRMZqs%2B6BtY9ZPvLRQLB3nVYqkh0i2fkkA%3D%0A&s=7a00761a37b143fb5629e63f3343997970070a6a727d755d9c77c637bcb3d0b5" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="https://urldefense.proofpoint.com/v1/url?u=http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev&k=p4Ly7qpEBiYPBVenR9G2iQ%3D%3D%0A&r=8jiWUOA7YNYuE%2FO4heswhF5KaS3dN4VEfeX8hooBpaw%3D%0A&m=uCB6%2BIbeBWRMZqs%2B6BtY9ZPvLRQLB3nVYqkh0i2fkkA%3D%0A&s=034864c592888fe01680b55e2601d9e2c24ed3283c83ce0e93dbe4111f57a62e" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</span></blockquote></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div></div></div></div></div></body></html>