[PATCH] Adding support for NoDuplicate function attribute in CLang
Marcello Maggioni
marcello at codeplay.com
Wed Nov 20 15:06:05 PST 2013
Hmm, I don't feel confortable in commenting on this, because I don't
have enough background myself on why the attribute has been added to
LLVM. I know about the OpenCL use case just because I'm specifically
working on that and the need for the NoDuplicate attribute popped out,
but I'm not aware of possible usages of the same in the pure C/C++ world.
I could immagine some hardware specific use scenario where in an
embedded system using built-ins exercising some hardware features that
have a similar functionality of a barrier (a synchronization primitive
of some sort) this could be useful, but nothing else.
Cheers,
Marcello
On 20/11/13 20:11, Aaron Ballman wrote:
> On Wed, Nov 20, 2013 at 2:25 PM, Marcello Maggioni
> <marcello at codeplay.com> wrote:
>> Sorry, I missed the mail.
>>
>> Hmm, well, ideally if the call through the pointer is duplicated ,and the
>> function call shouldn't be duplicated (like in some implementations of
>> "barrier()" in OpenCL) the result might be wrong (in the case of a barrier
>> the result is a dead-lock).
>> Of course, OpenCL itself doesn't have this problem because it doesn't have
>> function pointers ...
> Which brings me to my round-about question -- should this be exposed
> as an OpenCL-only attribute in the same way we do with CUDA
> attributes? Eg) only expose a GNU spelling for it, and check in Sema
> whether lang options are for OpenCL and warn if not compiling for
> OpenCL.
>
> It sounds like this is intended for OpenCL users and it will have
> little utility to non-OpenCL users (feel free to correct me if I'm
> wrong on this account).
>
> ~Aaron
More information about the cfe-commits
mailing list