[Mlir-commits] [mlir] [mlir][acc] Add acc.on_device op (PR #208096)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jul 8 06:05:35 PDT 2026
================
@@ -3713,6 +3713,33 @@ def OpenACC_WaitOp : OpenACC_Op<"wait", [AttrSizedOperandSegments]> {
let hasVerifier = 1;
}
+//===----------------------------------------------------------------------===//
+// acc_on_device runtime call
+//===----------------------------------------------------------------------===//
+
+def OpenACC_OnDeviceOp : OpenACC_Op<"on_device", [NoMemoryEffect]> {
----------------
jeanPerier wrote:
Mmh, I think you will need to indicate some kind of memory effect here (maybe by defining a resource for the acc runtime that is not addressable in the runtime).
Technically this operation will read memory, it will read the present table inside the acc runtime.
I do not think non speculatibility is enough here because it only tells that the operation may crash if evaluated, not that its effect may differ depending on where the operation is.
A concrete example is that if you have:
```
%b1 = acc.on_device %addr // evaluate to false
%token = acc.declare_enter dataOperands(%addr)
%b2 = acc.on_device %addr // evaluate to true
```
I think that MLIR CSE will merged %b1 and %b2 while they evaluate to different runtime values.
https://github.com/llvm/llvm-project/pull/208096
More information about the Mlir-commits
mailing list