[PATCH] D38113: OpenCL: Assume functions are convergent

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 07:13:13 PDT 2017


Anastasia added a comment.

In https://reviews.llvm.org/D38113#878852, @hfinkel wrote:

> In https://reviews.llvm.org/D38113#877874, @Anastasia wrote:
>
> > The problem of adding this attribute conservatively for all functions is that it prevents some optimizations to happen. I agree to commit this as a temporary fix to guarantee correctness of generated code.
>
>
> This is one of those unfortunate things we had to do for correctness in CUDA, and the situation seems the same here. When we're not doing separate compilation (which I imagine we're also generally not doing for OpenCL complication), I'm under the impression that the attribute removal is fairly effective.


I agree both communities would benefit so it feels like it might be worth the effort.

> 
> 
>> But if we ask to add the `convergent` attribute into the spec we can avoid doing this in the compiler?
> 
> But even if you do that, would that not be in a future version of OpenCL? If so, for code complying to current standards, you'd need this behavior.

Yes, the fix is needed anyway to provide backwards compatibility.


https://reviews.llvm.org/D38113





More information about the cfe-commits mailing list