[PATCH] D38113: OpenCL: Assume functions are convergent

Hal Finkel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 22 08:49:31 PDT 2017


hfinkel added a comment.

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.

> 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.


https://reviews.llvm.org/D38113





More information about the cfe-commits mailing list