[Mlir-commits] [flang] [mlir] [acc][flang] Add isDeviceData APIs for device data detection (PR #176219)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jan 15 10:44:20 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 cpp,h -- flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.h flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h flang/lib/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.cpp flang/lib/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.cpp mlir/include/mlir/Dialect/OpenACC/Analysis/OpenACCSupport.h mlir/include/mlir/Dialect/OpenACC/OpenACCUtils.h mlir/lib/Dialect/OpenACC/Analysis/OpenACCSupport.cpp mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp mlir/lib/Dialect/OpenACC/Transforms/ACCImplicitData.cpp 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/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h b/flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h
index a659cb191..1ce69df2d 100644
--- a/flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h
+++ b/flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h
@@ -54,7 +54,6 @@ struct OpenACCPointerLikeModel
mlir::TypedValue<mlir::acc::PointerLikeType> destPtr) const;
bool isDeviceData(mlir::Type pointer, mlir::Value var) const;
-
};
template <typename T>
diff --git a/mlir/lib/Dialect/OpenACC/Transforms/ACCImplicitData.cpp b/mlir/lib/Dialect/OpenACC/Transforms/ACCImplicitData.cpp
index a5b5753cd..5e46875ca 100644
--- a/mlir/lib/Dialect/OpenACC/Transforms/ACCImplicitData.cpp
+++ b/mlir/lib/Dialect/OpenACC/Transforms/ACCImplicitData.cpp
@@ -475,7 +475,6 @@ Operation *ACCImplicitData::generateDataClauseOpForCandidate(
acc::getBounds(op));
}
-
if (acc::isDeviceValue(var)) {
// If the variable is device data, use deviceptr clause.
return acc::DevicePtrOp::create(builder, loc, var,
diff --git a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
index f0cd84516..29186ce82 100644
--- a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
+++ b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp
@@ -30,9 +30,9 @@ using namespace mlir::acc;
class OpenACCUtilsTest : public ::testing::Test {
protected:
OpenACCUtilsTest() : b(&context), loc(UnknownLoc::get(&context)) {
- context.loadDialect<acc::OpenACCDialect, arith::ArithDialect,
- gpu::GPUDialect, memref::MemRefDialect,
- func::FuncDialect>();
+ context
+ .loadDialect<acc::OpenACCDialect, arith::ArithDialect, gpu::GPUDialect,
+ memref::MemRefDialect, func::FuncDialect>();
}
MLIRContext context;
@@ -1378,7 +1378,8 @@ TEST_F(OpenACCUtilsTest, isDeviceValueMemrefGlobalAddressSpace) {
// Test that a memref with GPU global address space is considered device data
auto gpuAddressSpace =
gpu::AddressSpaceAttr::get(&context, gpu::AddressSpace::Global);
- auto memrefTy = MemRefType::get({10}, b.getI32Type(), AffineMap(), gpuAddressSpace);
+ auto memrefTy =
+ MemRefType::get({10}, b.getI32Type(), AffineMap(), gpuAddressSpace);
OwningOpRef<memref::AllocaOp> allocOp =
memref::AllocaOp::create(b, loc, memrefTy);
@@ -1393,7 +1394,8 @@ TEST_F(OpenACCUtilsTest, isDeviceValueMemrefWorkgroupAddressSpace) {
// data
auto gpuAddressSpace =
gpu::AddressSpaceAttr::get(&context, gpu::AddressSpace::Workgroup);
- auto memrefTy = MemRefType::get({10}, b.getI32Type(), AffineMap(), gpuAddressSpace);
+ auto memrefTy =
+ MemRefType::get({10}, b.getI32Type(), AffineMap(), gpuAddressSpace);
OwningOpRef<memref::AllocaOp> allocOp =
memref::AllocaOp::create(b, loc, memrefTy);
@@ -1408,7 +1410,8 @@ TEST_F(OpenACCUtilsTest, isDeviceValueMemrefPrivateAddressSpace) {
// data
auto gpuAddressSpace =
gpu::AddressSpaceAttr::get(&context, gpu::AddressSpace::Private);
- auto memrefTy = MemRefType::get({10}, b.getI32Type(), AffineMap(), gpuAddressSpace);
+ auto memrefTy =
+ MemRefType::get({10}, b.getI32Type(), AffineMap(), gpuAddressSpace);
OwningOpRef<memref::AllocaOp> allocOp =
memref::AllocaOp::create(b, loc, memrefTy);
``````````
</details>
https://github.com/llvm/llvm-project/pull/176219
More information about the Mlir-commits
mailing list