[PATCH] D26348: Allow convergent attribute for function arguments

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 12:37:21 PST 2016


hfinkel added inline comments.


================
Comment at: docs/LangRef.rst:1153
+    "whether and when each call site to this function is reached must be
+    uniform across multiple threads", the ``convergent`` attribute on function
+    arguments can be thought of as "the value of this argument at each
----------------
jlebar wrote:
> > While the ``convergent`` attribute on functions can be thought of as "whether and when each call site to this function is reached must be uniform across multiple threads",
> 
> I know this isn't meant to be normative, but I'm a little concerned by this language.  Specifically, our semantics say that the compiler is not allowed to *introduce* new sources of divergence to convergent calls, but it is also not allowed to *assume* that convergent calls are uniform.
> 
> I presume the same is true for convergent args -- the compiler cannot introduce divergence into the arg values, but it also cannot assume anything about the arg values as a consequence of their being marked convergent.
> 
> I know rewriting this to be precise might defeat the purpose of your summary here.  But could we add some weasel words so that people can't point to this as justification that divergent calls / args marked with `convergent` are LLVM UB?
This is a good point. We might want to say something like that there is some implementation-defined set of simultaneously-executing threads for which the restriction holds. Thus we won't be able to make an target-independent assumptions about the implied behavior.


https://reviews.llvm.org/D26348





More information about the llvm-commits mailing list