[cfe-dev] CUDA patch series 2 (was Re: Proposal: CUDA support; outline, initial patches)

Peter Collingbourne peter at pcc.me.uk
Wed Nov 24 20:49:00 PST 2010


On Sun, Nov 21, 2010 at 05:58:20AM +0000, Peter Collingbourne wrote:
> With a Clang-based driver, we can do better, by parsing the source
> file once to produce a single AST,
       
After further investigation, I determined that this won't work.
CUDA (at least the NVIDIA SDK headers) depends on certain macros and
declarations being subtly different for host and device code.

The new strategy is to parse the source file twice, once for the host and
once for the device.  CodeGen would still be responsible for filtering
declarations.

This new patch series is built on top of the old series and replaces
patch 11 (which was based on the mistaken assumption that the type
qualifiers weren't attributes hiding behind a #define) and implements:

 - Initial support for device, global, host, constant, shared and
   launch_bounds attributes.  The attributes are recognised and added
   to the AST but no significant semantic analysis (e.g. checking
   for incompatible combinations) is performed.

 - CodeGen support for filtering declarations based on attributes.
   A new flag, -fcuda-is-device, is added to the frontend to select
   between host and device generation.
 
 - Added initial PTX target to Basic and CodeGen.  This target sets up
   the correct calling conventions for device vs global functions,
   but not much else.

Any reviews are much appreciated.

Thanks,
-- 
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Basic-Sema-initial-support-for-CUDA-location-attribu.patch
Type: text/x-diff
Size: 9316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101125/b306471a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Basic-Sema-Add-launch_bounds-attribute.patch
Type: text/x-diff
Size: 4395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101125/b306471a/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Frontend-add-CodeGenOptions-CUDAIsDevice.patch
Type: text/x-diff
Size: 1128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101125/b306471a/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-CodeGen-have-EmitGlobal-act-on-CUDAIsDevice.patch
Type: text/x-diff
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101125/b306471a/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Frontend-add-fcuda-is-device-flag.patch
Type: text/x-diff
Size: 1425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101125/b306471a/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Basic-add-PTXTargetInfo.patch
Type: text/x-diff
Size: 3362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101125/b306471a/attachment-0005.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-CodeGen-add-PTXTargetCodeGenInfo.patch
Type: text/x-diff
Size: 2133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101125/b306471a/attachment-0006.patch>


More information about the cfe-dev mailing list