[PATCH] Add support for CUDA unroll pragma

Richard Smith richard at metafoo.co.uk
Sun Jul 13 16:44:37 PDT 2014


On Mon, Jul 7, 2014 at 5:18 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> ----- Original Message -----
> > From: "Mark Heffernan" <meheff at google.com>
> > To: "Richard Smith" <richard at metafoo.co.uk>
> > Cc: reviews+D4297+public+26d6caf125d429ed at reviews.llvm.org, "Aaron
> Ballman" <aaron.ballman at gmail.com>, "llvm cfe"
> > <cfe-commits at cs.uiuc.edu>
> > Sent: Monday, July 7, 2014 6:12:00 PM
> > Subject: Re: [PATCH] Add support for CUDA unroll pragma
> >
> >
> >
> >
> >
> > On Tue, Jul 1, 2014 at 5:36 PM, Richard Smith < richard at metafoo.co.uk
> > > wrote:
> >
> >
> >
> >
> >
> >
> >
> > One question: you list the unroll count as 'n'. Must that be a
> > constant integer? The clang pragma intends to allow an arbitrary
> > integer constant expression there. That might be a good reason for
> > us to introduce our own syntax for it, if we're providing a slightly
> > more general form.
> >
> >
> >
> > nvcc (CUDA) only supports a literal integer constant. icc seems to
> > support only literal constants as well. xlc supports integer
> > constant expressions. Given xlc and icc share the same syntax
> > ("#pragma unroll (_value_)") there is no way to be perfectly
> > compatible with both icc and xlc so I'm inclined to support
> > expressions in "#pragma unroll" as planned with the other loop
> > pragmas and just be more permissive than nvcc and icc.
>
> 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'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140713/f1eae3a9/attachment.html>


More information about the cfe-commits mailing list