[llvm] [LLVM] New NoDivergenceSource function attribute (PR #111832)
Tim Renouf via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 08:06:33 PDT 2024
================
@@ -2082,6 +2082,16 @@ example:
function call, use of ``longjmp``, or other means. It is a compiler hint that
is used at module level to improve dataflow analysis, dropped during linking,
and has no effect on functions defined in the current module.
+``nodivergencesource``
+ A call to this function is not a source of divergence. In uniformity
+ analysis, a *source of divergence* is an instruction that generates
+ divergence even if its inputs are uniform. A call with no further information
+ would normally be considered a source of divergence; setting this attribute
+ on a function means that a call to it is not a source of divergence.
+
+ This is useful where known-name calls are being used as an extension
+ mechanism for instructions, as for example in `llvm-dialects
+ <https://github.com/GPUOpen-Drivers/llvm-dialects>`.
----------------
trenouf wrote:
OK I'll drop it. But here is some further explanation:
LLVM IR does not let you add your own new instructions, unlike MLIR. llvm-dialects is a scheme for adding your own new instructions, somewhat like MLIR dialects, using similar tablegen declarations. A dialect op is implemented as a call to a function declaration with a known name, e.g. `@lgc.load.descriptor` for the `LoadDescriptorOp` in dialect lgc. We want to be able to configure such known-name declarations to not be a source of divergence (same as you can use attributes to configure how it interacts with memory, etc).
Another known-name-calls extension mechanism for instructions is the `@dx.op.*` calls in DXIL. That is just an example; it is not our goal to use this attribute with DXIL ops.
https://github.com/llvm/llvm-project/pull/111832
More information about the llvm-commits
mailing list