[PATCH] D151987: TTI: Add function to hasBranchDivergence

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 14:17:52 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:404
+  /// all values can be assumed uniform in a particular function.
+  bool hasBranchDivergence(const Function *F = nullptr) const;
 
----------------
tra wrote:
> Does it mean that with nullptr argument the function reports whether the target has a concept of divergence, but if passed an actual function, ti would report whether the function has divergent IR?
> 
> I'd argue that for such different purposes we should have separate function calls.
> - `bool hasBranchDivergence()` would report whether target cares about divergence.
> -  `bool isAlwaysUniform(const Function *F)` would report whether a given function is divergent.
> 
No, this is backwards. This isn't and can't be a stateful declaration about the content of the function. This can only report divergent target executing in single threaded mode such that you can/should ignore any analysis of the function. Which is essentially this is acting like a target that doesn't care about divergence, which is the same concept.


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

https://reviews.llvm.org/D151987



More information about the llvm-commits mailing list