[Mlir-commits] [mlir] [mlir][acc] Extend PointerLikeType to provide alloc, dealloc, copy (PR #162328)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 7 10:20:59 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 cpp -- mlir/test/lib/Dialect/OpenACC/TestOpenACC.cpp mlir/test/lib/Dialect/OpenACC/TestPointerLikeTypeInterface.cpp mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp mlir/tools/mlir-opt/mlir-opt.cpp
``````````
: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/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
index c2a21acb4..065b41376 100644
--- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
+++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
@@ -84,8 +84,8 @@ struct MemRefPointerLikeModel
return true;
}
- // For dynamic memrefs, extract sizes from the original variable if provided.
- // Otherwise they cannot be handled.
+ // For dynamic memrefs, extract sizes from the original variable if
+ // provided. Otherwise they cannot be handled.
if (originalVar && originalVar.getType() == memrefTy &&
memrefTy.hasRank()) {
SmallVector<Value> dynamicSizes;
@@ -104,7 +104,6 @@ struct MemRefPointerLikeModel
return true;
}
-
// TODO: Unranked not yet supported.
return false;
}
diff --git a/mlir/test/lib/Dialect/OpenACC/TestOpenACC.cpp b/mlir/test/lib/Dialect/OpenACC/TestOpenACC.cpp
index 6f7bdde17..988624017 100644
--- a/mlir/test/lib/Dialect/OpenACC/TestOpenACC.cpp
+++ b/mlir/test/lib/Dialect/OpenACC/TestOpenACC.cpp
@@ -17,10 +17,7 @@ namespace test {
void registerTestPointerLikeTypeInterfacePass();
// Unified registration function for all OpenACC tests
-void registerTestOpenACC() {
- registerTestPointerLikeTypeInterfacePass();
-}
+void registerTestOpenACC() { registerTestPointerLikeTypeInterfacePass(); }
} // namespace test
} // namespace mlir
-
diff --git a/mlir/test/lib/Dialect/OpenACC/TestPointerLikeTypeInterface.cpp b/mlir/test/lib/Dialect/OpenACC/TestPointerLikeTypeInterface.cpp
index fc573d431..40752b70a 100644
--- a/mlir/test/lib/Dialect/OpenACC/TestPointerLikeTypeInterface.cpp
+++ b/mlir/test/lib/Dialect/OpenACC/TestPointerLikeTypeInterface.cpp
@@ -26,7 +26,7 @@ namespace {
struct OperationTracker : public OpBuilder::Listener {
SmallVector<Operation *> insertedOps;
-
+
void notifyOperationInserted(Operation *op,
OpBuilder::InsertPoint previous) override {
insertedOps.push_back(op);
@@ -72,8 +72,9 @@ private:
OpBuilder &builder);
void testGenFree(Operation *op, Value result, PointerLikeType pointerType,
OpBuilder &builder);
- void testGenCopy(Operation *srcOp, Operation *destOp, Value srcResult, Value destResult,
- PointerLikeType pointerType, OpBuilder &builder);
+ void testGenCopy(Operation *srcOp, Operation *destOp, Value srcResult,
+ Value destResult, PointerLikeType pointerType,
+ OpBuilder &builder);
struct PointerCandidate {
Operation *op;
@@ -144,7 +145,8 @@ void TestPointerLikeTypeInterfacePass::runOnOperation() {
// Try copying from each source to each destination
for (const auto &src : sources) {
for (const auto &dest : destinations) {
- testGenCopy(src.op, dest.op, src.result, dest.result, src.pointerType, builder);
+ testGenCopy(src.op, dest.op, src.result, dest.result, src.pointerType,
+ builder);
}
}
}
@@ -253,12 +255,9 @@ void TestPointerLikeTypeInterfacePass::testGenFree(Operation *op, Value result,
}
}
-void TestPointerLikeTypeInterfacePass::testGenCopy(Operation *srcOp,
- Operation *destOp,
- Value srcResult,
- Value destResult,
- PointerLikeType pointerType,
- OpBuilder &builder) {
+void TestPointerLikeTypeInterfacePass::testGenCopy(
+ Operation *srcOp, Operation *destOp, Value srcResult, Value destResult,
+ PointerLikeType pointerType, OpBuilder &builder) {
Location loc = destOp->getLoc();
// Create a new builder with the listener and set insertion point
``````````
</details>
https://github.com/llvm/llvm-project/pull/162328
More information about the Mlir-commits
mailing list