-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Flang] [OpenMP] Allow any type as argument to the FlushOp #143844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Flang] [OpenMP] Allow any type as argument to the FlushOp #143844
Conversation
@llvm/pr-subscribers-flang-fir-hlfir @llvm/pr-subscribers-mlir Author: Thirumalai Shaktivel (Thirumalai-Shaktivel) ChangesFixes: #143842 Full diff: https://github.com/llvm/llvm-project/pull/143844.diff 2 Files Affected:
diff --git a/flang/test/Fir/fir-ops.fir b/flang/test/Fir/fir-ops.fir
index 9c444d2f4e0bc..56c5220487f5e 100644
--- a/flang/test/Fir/fir-ops.fir
+++ b/flang/test/Fir/fir-ops.fir
@@ -1015,3 +1015,11 @@ func.func @test_box_total_elements(%arg0: !fir.class<!fir.type<sometype{i:i32}>>
%6 = arith.addi %2, %5 : index
return %6 : index
}
+
+// omp.flush operation
+// CHECK-LABEL: func.func @omp_flush
+func.func @omp_flush(%arg0: !fir.class<!fir.type<_QMmymodTmyt1{t:i32}>>) {
+ // CHECK: omp.flush(%{{.*}} : !fir.class<!fir.type<_QMmymodTmyt1{t:i32}>>)
+ omp.flush(%arg0 : !fir.class<!fir.type<_QMmymodTmyt1{t:i32}>>)
+ return
+}
diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
index 036c6a6e350a8..ac80926053a2d 100644
--- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -889,7 +889,7 @@ def FlushOp : OpenMP_Op<"flush", clauses = [
specified or implied.
}] # clausesDescription;
- let arguments = !con((ins Variadic<OpenMP_PointerLikeType>:$varList),
+ let arguments = !con((ins Variadic<AnyType>:$varList),
clausesArgs);
// Override inherited assembly format to include `varList`.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach looks good but see my comment. The codegen for FlushOp doesn't use the argument list anyway so it doesn't matter what is in it
llvm-project/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
Line 5768 in 702b903
ompBuilder->createFlush(builder.saveIP()); |
flang/test/Fir/fir-ops.fir
Outdated
// omp.flush operation | ||
// CHECK-LABEL: func.func @omp_flush | ||
func.func @omp_flush(%arg0: !fir.class<!fir.type<_QMmymodTmyt1{t:i32}>>) { | ||
// CHECK: omp.flush(%{{.*}} : !fir.class<!fir.type<_QMmymodTmyt1{t:i32}>>) | ||
omp.flush(%arg0 : !fir.class<!fir.type<_QMmymodTmyt1{t:i32}>>) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is for checking operations in the fir dialect. Please move this to mlir/test/Dialect/OpenMP/ops.mlir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For LLVM dialect, we already have a test for !llvm.ptr
type as an argument to FlushOp.
I wanted to add a test for fir.class<...>
, which place would be the correct to add this test, @tblah? (I suppose I can't add it to mlir/test/Dialect/OpenMP/ops.mlir
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh good point. Add a lowering test for this example and check that the flush op was created successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update
Thanks for the review, @tblah ! |
Fixes: #143842