[PATCH] D106859: [Sink] allow sinking convergent operations across uniform branches

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 17:23:55 PDT 2021


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/Sink.cpp:57-62
   if (auto *Call = dyn_cast<CallBase>(Inst)) {
-    // Convergent operations cannot be made control-dependent on additional
-    // values.
-    if (Call->isConvergent())
-      return false;
+    // Convergent operations cannot be sunk across divergent branches.
+    if (Call->isConvergent()) {
+      if (DI.hasDivergence())
+        return false;
+    }
----------------
This is reinterpreting the IR semantics based on target information. There is no defined link between divergence and convergent, and I'm not sure there should even be one. There are multiple target defined concepts of uniformity, and not all of them matter for convergent on AMDGPU. I think any kind of transform that wants to make this kind of assumption needs to be a specific divergence aware control flow optimizer


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106859



More information about the llvm-commits mailing list