[cfe-dev] Extent of CUDA support in clang as of 2.9-rc1

Tan Chee Eng tance.e6p3f2 at gmail.com
Fri Mar 18 16:12:51 PDT 2011


Hi,

Thank you, Peter and Gabriel. About the test scripts, yes, I would very
thankful if you could pass me those scripts.

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...


Regards,
Chee Eng

On Sat, Mar 19, 2011 at 12:47 AM, Peter Collingbourne <peter at pcc.me.uk>wrote:

> On Fri, Mar 18, 2011 at 11:54:06PM +0800, Tan Chee Eng wrote:
> > Hi,
> >
> > I'm working on a CUDA source to source compiler which is using clang as
> it's
> > frontend. I've read some of the messages on this mailing list which seems
> to
> > indicate that CUDA support is on the way, and looking through the source
> for
> > 2.9-rc1 shows signs that the AST should be able to handle at least some
> CUDA
> > semantics.
> >
> > Unfortunately, when I do pass some CUDA code through my program, it clang
> > throws parse errors on tokens such as __global__ and __shared__. In my
> > initialization, I've set LangOptions.CUDA = 1. Did I miss something out,
> or
> > is CUDA support in clang still incomplete? I've spent the better part of
> the
> > last day looking through the docs and source trying to figure it out, and
> > any help or pointers in the right direction would be very much
> appreciated.
>
> Hi Chee,
>
> The CUDA support in Clang is dependent on a set of runtime library
> headers, and is currently designed to handle NVIDIA's headers, which
> contains macro definitions resembling:
>
> #define __global__ __attribute__((global))
>
> You can see a partial emulation of these definitions in the test
> suite header file test/SemaCUDA/cuda.h.
>
> Furthermore, CUDA support is incomplete and consists of only parsing
> and basic semantic checks.  I have a patch series lined up covering
> further semantic checks and code generation support, but this is
> also incomplete.  However, what exists at the moment may suffice for
> a source to source compiler, if you know that the input program is
> valid and that you do not need LLVM code generation.
>
> If you are interested, I can send some test scripts I have been
> using to test Clang against the NVIDIA headers, which may allow you
> to parse code that uses these headers.
>
> I have asked the release manager to disable CUDA support in 2.9 due
> to its incomplete state, so if you would like to use CUDA I would
> recommend that you follow SVN trunk.
>
> Thanks,
> --
> Peter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110319/6fbf4344/attachment.html>


More information about the cfe-dev mailing list