[Mlir-commits] [flang] [mlir] [mlir][acc] Add ACCRecipeMaterialization pass and reduction ops (PR #184252)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Mar 2 14:50:01 PST 2026


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 -- mlir/lib/Dialect/OpenACC/Transforms/ACCRecipeMaterialization.cpp flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.h flang/lib/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.cpp flang/lib/Optimizer/OpenACC/Support/RegisterOpenACCExtensions.cpp mlir/include/mlir/Dialect/OpenACC/OpenACCUtilsLoop.h mlir/lib/Dialect/OpenACC/IR/OpenACCCG.cpp mlir/lib/Dialect/OpenACC/Utils/OpenACCUtilsLoop.cpp mlir/unittests/Dialect/OpenACC/OpenACCUtilsLoopTest.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/FIROpenACCOpsInterfaces.cpp b/flang/lib/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.cpp
index 8baf5b0d2..820938d16 100644
--- a/flang/lib/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.cpp
+++ b/flang/lib/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.cpp
@@ -46,8 +46,8 @@ mlir::Value ReductionInitOpFortranObjectViewModel::getViewSource(
 }
 
 std::optional<std::int64_t>
-ReductionInitOpFortranObjectViewModel::getViewOffset(mlir::Operation *op,
-                                                    mlir::OpResult resultView) const {
+ReductionInitOpFortranObjectViewModel::getViewOffset(
+    mlir::Operation *op, mlir::OpResult resultView) const {
   assert(resultView.getOwner() == op && "result value must be the op's result");
   return 0;
 }
diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACCCG.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACCCG.cpp
index 81213780d..881234cdd 100644
--- a/mlir/lib/Dialect/OpenACC/IR/OpenACCCG.cpp
+++ b/mlir/lib/Dialect/OpenACC/IR/OpenACCCG.cpp
@@ -271,7 +271,8 @@ LogicalResult ReductionInitOp::verify() {
   Block &block = getRegion().front();
   if (auto yieldOp = dyn_cast<acc::YieldOp>(block.getTerminator())) {
     if (yieldOp.getNumOperands() != 1)
-      return emitOpError("region must yield exactly one value (private storage)");
+      return emitOpError(
+          "region must yield exactly one value (private storage)");
     if (yieldOp.getOperand(0).getType() != getVar().getType())
       return emitOpError("yielded value type must match var type");
   }
diff --git a/mlir/lib/Dialect/OpenACC/Utils/OpenACCUtilsLoop.cpp b/mlir/lib/Dialect/OpenACC/Utils/OpenACCUtilsLoop.cpp
index 63cab6107..7c71a98b4 100644
--- a/mlir/lib/Dialect/OpenACC/Utils/OpenACCUtilsLoop.cpp
+++ b/mlir/lib/Dialect/OpenACC/Utils/OpenACCUtilsLoop.cpp
@@ -107,13 +107,14 @@ static void normalizeIVUses(OpBuilder &b, Location loc, Value iv, Value origLB,
   iv.replaceAllUsesExcept(denormalized, exceptions);
 }
 
-/// Helper used by loop conversion: clone region and return insertion point only.
+/// Helper used by loop conversion: clone region and return insertion point
+/// only.
 static Block::iterator cloneACCRegionIntoForLoop(Region *src, Block *dest,
-                                                Block::iterator insertionPoint,
-                                                IRMapping &mapping,
-                                                RewriterBase &rewriter) {
-  auto [replacements, ip] = acc::cloneACCRegionInto(src, dest, insertionPoint,
-                                                    mapping, ValueRange{});
+                                                 Block::iterator insertionPoint,
+                                                 IRMapping &mapping,
+                                                 RewriterBase &rewriter) {
+  auto [replacements, ip] =
+      acc::cloneACCRegionInto(src, dest, insertionPoint, mapping, ValueRange{});
   (void)replacements;
   return ip;
 }

``````````

</details>


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


More information about the Mlir-commits mailing list