[PATCH] D69498: IR: Invert convergent attribute handling

Sameer Sahasrabuddhe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 23 19:27:13 PDT 2021


sameerds added a comment.

In D69498#2712706 <https://reviews.llvm.org/D69498#2712706>, @nhaehnle wrote:

> In D69498#2711396 <https://reviews.llvm.org/D69498#2711396>, @foad wrote:
>
>> I don't have much to add to the conversation except to point out that this definition defines `noconvergent` in terms of divergent control flow, but the langref itself doesn't define what divergent control flow //is//, which makes it an incomplete spec. (Perhaps I'm just restating @arsenm's objections.) This seems unsatisfactory to me but I have no idea what to do about it. I agree with @sameerds that the current definition of `convergent` is too restrictive because in practice we really do want to be able to move convergent calls past uniform control flow.
>
> That is one of the things that D85603 <https://reviews.llvm.org/D85603> addresses. I suspect Sameer was assuming the language from there in the background.
>
> I agree with Matt that it would be best to avoid too much TTI dependence. The existing situation with the intrinsics is already a bit of a strange one. I wonder if it is possible to move to a world where isSourceOfDivergence need not be target-dependent. (This requires e.g. new attributes on function arguments as well as new information about address spaces in the data layout, plus some new attributes to define intrinsic data flow. Likely beyond the scope of this patch.)

In general, yes, it is great to avoid dependence on TTI. But this particular instance is actually a dependence on DA. The fact that DA depends on TTI is a separate problem. But I think that's a natural fallout of the fact that LLVM is not (and should not be) in the business of defining an execution model for multiple threads. Every optimization that affects control flow needs to be able to reason about an execution model that LLVM itself does not define. So what we end up with is an approximate model in the form of information gleaned from the frontend as well as the target. Neither source is "more correct" or "less ideal" than the other.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69498/new/

https://reviews.llvm.org/D69498



More information about the cfe-commits mailing list