[Mlir-commits] [mlir] [mlir][OpenACC][NFC] Fix declare operation examples (PR #234523)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Oct 22 01:01:37 PDT 2026


https://github.com/leovancekang created https://github.com/llvm/llvm-project/pull/234523

Several declare examples fail to parse or verify with the current dialect.

Use the current dataClause syntax and enum names, specify pointee types, and add the missing terminators to the global constructor and destructor examples.

>From 32277a7f62bc7ca6d931618f74b7c823579271d8 Mon Sep 17 00:00:00 2001
From: leovancekang <leovancekang at outlook.com>
Date: Thu, 22 Oct 2026 15:52:49 +0800
Subject: [PATCH] [mlir][OpenACC][NFC] Fix declare operation examples

Several declare examples fail to parse or verify with the current dialect.

Use the current dataClause syntax and enum names, specify pointee types,
and add the missing terminators to the global constructor and destructor
examples.
---
 mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index 53f42a3e8ab44b..e1ea0e11fa7783 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -3230,7 +3230,7 @@ def OpenACC_DeclareEnterOp : OpenACC_Op<"declare_enter",
     Example showing `acc declare create(a)`:
 
     ```mlir
-    %0 = acc.create varPtr(%a : !llvm.ptr) -> !llvm.ptr
+    %0 = acc.create varPtr(%a : !llvm.ptr) varType(i32) -> !llvm.ptr
     acc.declare_enter dataOperands(%0 : !llvm.ptr)
     ```
   }];
@@ -3262,9 +3262,9 @@ def OpenACC_DeclareExitOp : OpenACC_Op<"declare_exit",
     Example showing `acc declare device_resident(a)`:
 
     ```mlir
-    %0 = acc.getdeviceptr varPtr(%a : !llvm.ptr) -> !llvm.ptr {dataClause = #acc.data_clause<declare_device_resident>}
+    %0 = acc.getdeviceptr varPtr(%a : !llvm.ptr) varType(i32) dataClause(acc_declare_device_resident) -> !llvm.ptr
     acc.declare_exit dataOperands(%0 : !llvm.ptr)
-    acc.delete accPtr(%0 : !llvm.ptr) {dataClause = #acc.data_clause<declare_device_resident>}
+    acc.delete accPtr(%0 : !llvm.ptr) dataClause(acc_declare_device_resident)
     ```
   }];
 
@@ -3302,8 +3302,9 @@ def OpenACC_GlobalConstructorOp : OpenACC_Op<"global_ctor",
     }
     acc.global_ctor @acc_constructor {
       %0 = llvm.mlir.addressof @globalvar : !llvm.ptr
-      %1 = acc.create varPtr(%0 : !llvm.ptr) -> !llvm.ptr
+      %1 = acc.create varPtr(%0 : !llvm.ptr) varType(i32) -> !llvm.ptr
       acc.declare_enter dataOperands(%1 : !llvm.ptr)
+      acc.terminator
     }
     ```
   }];
@@ -3338,9 +3339,10 @@ def OpenACC_GlobalDestructorOp : OpenACC_Op<"global_dtor",
     }
     acc.global_dtor @acc_destructor {
       %0 = llvm.mlir.addressof @globalvar : !llvm.ptr
-      %1 = acc.getdeviceptr varPtr(%0 : !llvm.ptr) -> !llvm.ptr {dataClause = #acc.data_clause<create>}
+      %1 = acc.getdeviceptr varPtr(%0 : !llvm.ptr) varType(i32) dataClause(acc_create) -> !llvm.ptr
       acc.declare_exit dataOperands(%1 : !llvm.ptr)
-      acc.delete accPtr(%1 : !llvm.ptr) {dataClause = #acc.data_clause<create>}
+      acc.delete accPtr(%1 : !llvm.ptr) dataClause(acc_create)
+      acc.terminator
     }
     ```
   }];



More information about the Mlir-commits mailing list