[PATCH] Add support for CUDA unroll pragma

Mark Heffernan meheff at google.com
Mon Jul 14 10:33:34 PDT 2014


On Sun, Jul 13, 2014 at 4:44 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Mon, Jul 7, 2014 at 5:18 PM, Hal Finkel <hfinkel at anl.gov> wrote:
>> At least in CUDA mode, we may want to issue a warning for
>> non-literal-constants.
>
>
> That seems reasonable to me.
>
> Since we might want these two syntaxes to have different semantics, and
> since having duplicates is cheap (and makes our #pragma clang loop interface
> more consistent), I'd prefer to support both '#pragma unroll' and '#pragma
> clang loop unroll'.

Warning sound good to me.  One remaining issue has to do with pretty
printing.  We accept two #pragma unroll forms:

#pragma unroll N
#pragma unroll (N)

Currently, the patch keeps track of whether the parentheses are there
and pretty prints accordingly.  This makes the code a bit ugly, and
Aaron suggested canonicalizing to always output one of the forms and
drop keeping track of the parens.  I chatted with Eli offline about
this and it seems like this is right way to go given the weak
guarantees about pretty printing.  I'll go ahead and change the patch
accordingly.  Lemme know if that's a problem.

Thanks!

Mark



More information about the cfe-commits mailing list