[PATCH] D137142: [WIP] DivergenceAnalysis: Infer uniformity from assume calls

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 02:30:14 PST 2023


simoll added a comment.

In D137142#3902426 <https://reviews.llvm.org/D137142#3902426>, @nhaehnle wrote:

> I don't quite see the point of this change. For test cases like `@assume_ballot_eq_0`, what we really should be doing here is optimize the branch away entirely because the `llvm.assume` implies that `%cmp == 0`.
>
> It sounds like what we really want here is a sort of `llvm.assume.uniform` intrinsic. Or maybe an `llvm.amdgcn.is.uniform` intrinsic and then do `llvm.assume(llvm.amdgcn.is.uniform)`

Not a lot of time right now to follow up on this.. and as much as i dislike passerby comments:
For the DA in isolation, ideally, we'd have something like:

  %Y = llvm.assume.uniform(%X)
  foo(%Y) ; <- Rewritten to use %Y instead of %X.

The DA would automatically pick up on the uniformity without any changes.
The assume intrinsic is non-speculatable to keep the control dependences around.
Obfuscating the `%X -> foo` def-use chain may inflict some damage to other analyses, though.


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

https://reviews.llvm.org/D137142



More information about the llvm-commits mailing list