[Mlir-commits] [mlir] [mlir][acc] Add acc.on_device op (PR #208096)

Ivan R. Ivanov llvmlistbot at llvm.org
Wed Jul 8 07:58:11 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]> {
+  let summary = "acc_on_device intrinsic operation";
+
+  let description = [{
+    Represents a call to the OpenACC `acc_on_device` runtime function.
+    Returns whether the current thread is executing on the given device type.
+
+    Example:
+
+    ```mlir
+    %host = arith.constant 1 : i32
+    %on_host = acc.on_device %host : i32 -> i1
+    ```
+  }];
+
+  let arguments = (ins I32:$deviceType);
----------------
ivanradanov wrote:

That sounds good, I changed it to `IntOrIndex`. Thanks.

https://github.com/llvm/llvm-project/pull/208096


More information about the Mlir-commits mailing list