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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 09:00:06 PDT 2022


jdoerfert added a comment.

I generally think this is worthwhile. As you noted, there are still problems but we could move this part ahead I think.

> warning: the argument to '__builtin_assume' has side effects that will be discarded

`__builtin_assume` is dropped if we cannot show that the expression is side-effect free as part of the lowering. The expression you used has arbitrary side-effects, I think (there is no godbold for HIP):
https://github.com/llvm/llvm-project/blob/6c8995649afac04a9eb0e71affd997e493c9b93a/clang/lib/Sema/OpenCLBuiltins.td#L1718

That said, multiple ways around this, easiest for now:

  int assumption = sub_group_all(P != NULL);
  __builtin_assume(assumption);





================
Comment at: llvm/lib/Analysis/DivergenceAnalysis.cpp:154
+    if (BK == TargetTransformInfo::BallotKind::All) {
+      assert(BallotVal == &V);
+      return true;
----------------
I'm not super sure this must hold. I'd just check it.


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

https://reviews.llvm.org/D137142



More information about the llvm-commits mailing list