[PATCH] D26437: Use -fno-unit-at-a-time and -funit-at-a-time

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 13 10:32:12 PST 2016


rampitec added a comment.

In https://reviews.llvm.org/D26437#593794, @jlebar wrote:

> In https://reviews.llvm.org/D26437#593762, @rampitec wrote:
>
> > I have created a discardable barrier intrinsic and used it directly in the sub_group_barrier implementation. As expected that helped conformance test to pass.
>
>
> You still plan to modify clang to insert this intrinsic during codegen at the top of every function marked with the convergent attribute, right?


No, not really. It is inserted manually at the top of the sub_group_barrier implementation. It is still needed to be there because otherwise the attribute will be removed from sub_group_barrier (and one more wrapper of it by the way). Other library convergent functions do not need it because they already have calls to something convergent, this is only sub_group_barrier special. It may happen of course we will identify more cases over the time.

> You folks need to figure out the semantics for the convergent attribute in opencl, but I think it makes very little sense to require that convergent functions both (a) have the attribute and (b) have the nop barrier intrinsic.  You should choose one or the other approach.

They have attribute and such barrier call. In CUDA you add attribute to every function automatically, in this case library functions are marked explicitly. In both cases there must be a convergent call inside or else IPO will remove that attribute.

>> Marking all functions as convergent seems to be an overkill to me
> 
> Again, I urge you to think about this in terms of the semantics of your programming language.  Am I allowed to wrap a convergent function?

Yes.

> If I am allowed to do so, must I mark the wrapper (and its wrapper, and so on) with the convergent attribute?

Yes.

> This suggests maybe you don't expect end-users to use this attribute in their code?

I do not think we want to require people to use it, there is nothing in the language standard to require it. When we do library we can take care of it manually.
One drawback I see here is a relatively big user function (not a wrapper) calling a barrier. If a call site would be cloned into a divergent control flow it may create problem. In such situation it should make sense to add convergent attribute to such user function. When I'm speaking about the overkill I mean I would expect such marking to be added bottom to top in the call stack, not bulk added and then removed top to bottom. Was this considered?


Repository:
  rL LLVM

https://reviews.llvm.org/D26437





More information about the llvm-commits mailing list