Hi,<div><br></div><div>Thank you, Peter and Gabriel. About the test scripts, yes, I would very thankful if you could pass me those scripts. </div><div><br></div><div>Also, I hope you don't mind a further question (I'm relatively new to CUDA): The runtime library headers which you mentioned, are they included in the NVIDIA's CUDA toolkit? Or are they from somewhere else? I attempted to look for them, but could not find them. Even Google wasn't very forthcoming...</div>
<div><br></div><div><br></div><div>Regards,</div><div>Chee Eng</div><div><br><div class="gmail_quote">On Sat, Mar 19, 2011 at 12:47 AM, Peter Collingbourne <span dir="ltr"><<a href="mailto:peter@pcc.me.uk">peter@pcc.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">On Fri, Mar 18, 2011 at 11:54:06PM +0800, Tan Chee Eng wrote:<br>
> Hi,<br>
><br>
> I'm working on a CUDA source to source compiler which is using clang as it's<br>
> frontend. I've read some of the messages on this mailing list which seems to<br>
> indicate that CUDA support is on the way, and looking through the source for<br>
> 2.9-rc1 shows signs that the AST should be able to handle at least some CUDA<br>
> semantics.<br>
><br>
> Unfortunately, when I do pass some CUDA code through my program, it clang<br>
> throws parse errors on tokens such as __global__ and __shared__. In my<br>
> initialization, I've set LangOptions.CUDA = 1. Did I miss something out, or<br>
> is CUDA support in clang still incomplete? I've spent the better part of the<br>
> last day looking through the docs and source trying to figure it out, and<br>
> any help or pointers in the right direction would be very much appreciated.<br>
<br>
</div></div>Hi Chee,<br>
<br>
The CUDA support in Clang is dependent on a set of runtime library<br>
headers, and is currently designed to handle NVIDIA's headers, which<br>
contains macro definitions resembling:<br>
<br>
#define __global__ __attribute__((global))<br>
<br>
You can see a partial emulation of these definitions in the test<br>
suite header file test/SemaCUDA/cuda.h.<br>
<br>
Furthermore, CUDA support is incomplete and consists of only parsing<br>
and basic semantic checks. I have a patch series lined up covering<br>
further semantic checks and code generation support, but this is<br>
also incomplete. However, what exists at the moment may suffice for<br>
a source to source compiler, if you know that the input program is<br>
valid and that you do not need LLVM code generation.<br>
<br>
If you are interested, I can send some test scripts I have been<br>
using to test Clang against the NVIDIA headers, which may allow you<br>
to parse code that uses these headers.<br>
<br>
I have asked the release manager to disable CUDA support in 2.9 due<br>
to its incomplete state, so if you would like to use CUDA I would<br>
recommend that you follow SVN trunk.<br>
<br>
Thanks,<br>
--<br>
<font color="#888888">Peter<br>
</font></blockquote></div><br></div>