[PATCH] D85609: Transforms: add ConvergenceControlHeuristic pass

Anastasia Stulova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 05:51:45 PDT 2021


Anastasia added a comment.

In D85609#2685844 <https://reviews.llvm.org/D85609#2685844>, @nhaehnle wrote:

> Hi @Anastasia, thank you for your comments. I replied inline, but a high-level point upfront is that in many ways, this patch only exists because HLL don't really have well-defined semantics for convergent operations yet. Most of us have a shared mental model of what they should be for most high-level constructs, but intuition breaks down for the trickier corner cases. I made some proposals in the Khronos Memory Model TSG for how useful semantics could be added to HLL, taking the corner cases into account, but on my end all of this is on hold while I'm on leave.

Great! I will try to find more details there.



================
Comment at: llvm/lib/Transforms/Utils/ConvergenceControlHeuristic.cpp:18
+///  2. Otherwise, refer to an `entry` intrinsic if the containing function
+///     is convergent, and to an `anchor` intrinsic otherwise.
+///  3. In natural loops, refer to a `loop` heart intrinsic in the loop header.
----------------
nhaehnle wrote:
> Anastasia wrote:
> > I would quite like to get an example of HL code that needs an anchor. I am not very clear where it fits at the moment.
> It depends on the relevant definitions of the HL languages, which don't exist yet.
> 
> If you were to translate an algorithm from CUDA, you'd basically use an anchor wherever `__activemask()` is used.
> 
> An example of a piece of code that would leverage it is at https://github.com/nhaehnle/llvm-project/blob/controlflow-wip-v9-pre/llvm/docs/ConvergentOperations.rst#opportunistic-convergent-operations (the `@reserveSpaceInBuffer` example) -- it's not in a HLL, but again, that's because HLL don't really offer these controls yet as inherent language features.
I see, potentially some of the new extended subgroup functions in OpenCL could be using that intrinsics for example `sub_group_ballot`.
https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#_extended_subgroup_functions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85609



More information about the llvm-commits mailing list