[Mlir-commits] [flang] [mlir] [acc][flang] Implement OpenACC interface for partial entity accesses (PR #165911)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 31 12:23:45 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.h flang/lib/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.cpp flang/include/flang/Optimizer/Dialect/FIROps.h flang/lib/Optimizer/OpenACC/Support/RegisterOpenACCExtensions.cpp mlir/include/mlir/Dialect/OpenACC/OpenACCUtils.h mlir/lib/Dialect/OpenACC/Utils/OpenACCUtils.cpp mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Optimizer/OpenACC/Support/RegisterOpenACCExtensions.cpp b/flang/lib/Optimizer/OpenACC/Support/RegisterOpenACCExtensions.cpp
index 03382fdf6..d71c40dfa 100644
--- a/flang/lib/Optimizer/OpenACC/Support/RegisterOpenACCExtensions.cpp
+++ b/flang/lib/Optimizer/OpenACC/Support/RegisterOpenACCExtensions.cpp
@@ -47,18 +47,18 @@ void registerOpenACCExtensions(mlir::DialectRegistry &registry) {
         PartialEntityAccessModel<fir::ArrayCoorOp>>(*ctx);
     fir::CoordinateOp::attachInterface<
         PartialEntityAccessModel<fir::CoordinateOp>>(*ctx);
-    fir::DeclareOp::attachInterface<
-        PartialEntityAccessModel<fir::DeclareOp>>(*ctx);
+    fir::DeclareOp::attachInterface<PartialEntityAccessModel<fir::DeclareOp>>(
+        *ctx);
   });
 
   // Register HLFIR operation interfaces
-  registry.addExtension(+[](mlir::MLIRContext *ctx,
-                            hlfir::hlfirDialect *dialect) {
-    hlfir::DesignateOp::attachInterface<
-        PartialEntityAccessModel<hlfir::DesignateOp>>(*ctx);
-    hlfir::DeclareOp::attachInterface<
-        PartialEntityAccessModel<hlfir::DeclareOp>>(*ctx);
-  });
+  registry.addExtension(
+      +[](mlir::MLIRContext *ctx, hlfir::hlfirDialect *dialect) {
+        hlfir::DesignateOp::attachInterface<
+            PartialEntityAccessModel<hlfir::DesignateOp>>(*ctx);
+        hlfir::DeclareOp::attachInterface<
+            PartialEntityAccessModel<hlfir::DeclareOp>>(*ctx);
+      });
 
   registerAttrsExtensions(registry);
 }
diff --git a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
index 4dcd51d3c..6f4e30585 100644
--- a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
+++ b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
@@ -614,8 +614,8 @@ TEST_F(OpenACCUtilsTest, getBaseEntityFromSubview) {
   SmallVector<OpFoldResult> sizes = {b.getIndexAttr(5), b.getIndexAttr(10)};
   SmallVector<OpFoldResult> strides = {b.getIndexAttr(1), b.getIndexAttr(1)};
 
-  OwningOpRef<memref::SubViewOp> subviewOp = memref::SubViewOp::create(
-      b, loc, baseMemref, offsets, sizes, strides);
+  OwningOpRef<memref::SubViewOp> subviewOp =
+      memref::SubViewOp::create(b, loc, baseMemref, offsets, sizes, strides);
   Value subview = subviewOp->getResult();
 
   // Test that getBaseEntity returns the base memref, not the subview
@@ -651,8 +651,8 @@ TEST_F(OpenACCUtilsTest, getBaseEntityChainedSubviews) {
   SmallVector<OpFoldResult> sizes1 = {b.getIndexAttr(50), b.getIndexAttr(80)};
   SmallVector<OpFoldResult> strides1 = {b.getIndexAttr(1), b.getIndexAttr(1)};
 
-  OwningOpRef<memref::SubViewOp> subview1Op = memref::SubViewOp::create(
-      b, loc, baseMemref, offsets1, sizes1, strides1);
+  OwningOpRef<memref::SubViewOp> subview1Op =
+      memref::SubViewOp::create(b, loc, baseMemref, offsets1, sizes1, strides1);
   Value subview1 = subview1Op->getResult();
 
   // Create second subview (subview of subview)
@@ -660,12 +660,13 @@ TEST_F(OpenACCUtilsTest, getBaseEntityChainedSubviews) {
   SmallVector<OpFoldResult> sizes2 = {b.getIndexAttr(20), b.getIndexAttr(30)};
   SmallVector<OpFoldResult> strides2 = {b.getIndexAttr(1), b.getIndexAttr(1)};
 
-  OwningOpRef<memref::SubViewOp> subview2Op = memref::SubViewOp::create(
-      b, loc, subview1, offsets2, sizes2, strides2);
+  OwningOpRef<memref::SubViewOp> subview2Op =
+      memref::SubViewOp::create(b, loc, subview1, offsets2, sizes2, strides2);
   Value subview2 = subview2Op->getResult();
 
   // Test that getBaseEntity on the nested subview returns the first subview
-  // (since our implementation returns the immediate source, not the ultimate base)
+  // (since our implementation returns the immediate source, not the ultimate
+  // base)
   Value baseEntity = getBaseEntity(subview2);
   EXPECT_EQ(baseEntity, subview1);
 

``````````

</details>


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


More information about the Mlir-commits mailing list