[llvm-dev] RFC: Convergent as an attribute for function arguments
Nicolai Hähnle via llvm-dev
llvm-dev at lists.llvm.org
Mon Nov 7 02:30:20 PST 2016
On 31.10.2016 19:37, Justin Lebar wrote:
> For one thing I'm in favor of having fewer annotations rather than
> more, so if we can do this in a reasonable way without introducing the
> notion of co-convergent calls, I think that would be a win. The one
> convergent annotation is difficult enough for the GPU folks to grok
> and then keep in cache, and everyone who works on llvm has to pay the
> cost of keeping their passes compliant with these annotations.
I now put an RFC implementation at https://reviews.llvm.org/D26348. The
commit message contains a brief recap of what this is for.
The LangRef language there has a proposal to help reduce the cognitive
burden: if you think of the convergent attribute for functions as saying
that "whether/when the function is called must be uniform across
threads", then the convergent attribute for function _arguments_ is
saying that "the actual argument that the function is called with must
be uniform across threads".
The consequences for how this restricts transforms are different, but
the mental model is the same and I think effectively correct for both
meanings. (As a minor bonus, the code delta is smaller if the same term
is used for both ;-)). Please correct me if I'm missing something!
The one thing that I'm not quite happy with is that there's no clean
formalization of what the restriction really is. There's an okay-ish
attempt in the LangRef diff of the patch, but to be honest I'd rather
just leave that out if nothing better can be found. The difficulty I'm
grappling with is that this involves both data flow and control flow,
and I don't know how to express the combination properly without
importing the whole semantics of a SIMT/SPMD-style execution model.
Thanks,
Nicolai
More information about the llvm-dev
mailing list