[PATCH] D85603: IR: Add convergence control operand bundle and intrinsics
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 13 08:10:46 PDT 2021
nhaehnle added a comment.
Hi @jholewinski, sorry for missing your comment earlier. It's been a while! I still need to work through the rest of the comments here, but there's a pretty crucial point here that seems to have been missed:
In D85603#2422804 <https://reviews.llvm.org/D85603#2422804>, @jholewinski wrote:
> Things are less clear when you consider odd looping structures, for example:
>
> entry:
> entry_token = llvm.experimental.convergence.anchor();
> if (cond1) goto head1;
> else goto head2;
>
> head1:
> head1_loop_token = llvm.experimental.convergence.loop() [ "convergencectrl"(entry_token) ]
> cond2 = ...;
> if cond2 goto tail1;
> else goto tail2;
>
> head2:
> head2_loop_token = llvm.experimental.convergence.loop() [ "convergencectrl"(entry_token) ]
> break_cond = ...
> if break_cond goto exit;
> else goto head2b;
>
> head2b:
> cond3 = ...;
> if cond3 goto tail2;
> else goto tail1;
>
> tail1:
> cond4 = subgroupOp(...); // What does this anchor to?
> if cond4 goto head1;
> else goto head2;
>
> tail2:
> cond5 = subgroupOp(...); // What does this anchor to?
> if cond5 goto head2;
> else goto head1;
>
> exit:
> ...
Regardless of the question about `subgroupOp`, this example is not valid IR: it breaks the static rule that "Every cycle in the CFG that contains two different uses of a convergence token T must also contain the definition of T."Specifically, there are two uses of `entry_token`, in `head1` and `head2`, and a cycle `head1 -> tail1 -> head2 -> head2b -> tail1 -> head1` that goes through both of them without going through the definition of `entry_token`.
Roughly speaking, an irreducible loop can contain at most one loop intrinsic that refers to a token from outside the irreducible loop.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85603/new/
https://reviews.llvm.org/D85603
More information about the llvm-commits
mailing list