[Mlir-commits] [mlir] 7951ab1 - [mlir][openacc] Relax the single block constraint on acc.loop
Valentin Clement
llvmlistbot at llvm.org
Tue Apr 11 10:43:15 PDT 2023
Author: Valentin Clement
Date: 2023-04-11T10:43:09-07:00
New Revision: 7951ab12b9674c5999f269aef8fa93b7994f27f0
URL: https://github.com/llvm/llvm-project/commit/7951ab12b9674c5999f269aef8fa93b7994f27f0
DIFF: https://github.com/llvm/llvm-project/commit/7951ab12b9674c5999f269aef8fa93b7994f27f0.diff
LOG: [mlir][openacc] Relax the single block constraint on acc.loop
The acc.loop operation was constrained by the SingleBlockImplicitTerminator.
This patch relax this constraint to allow multiple block in the loop.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D148025
Added:
Modified:
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
mlir/test/Dialect/OpenACC/ops.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index 9203e8b6b572..9a6e942e85bd 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -343,9 +343,7 @@ def OpenACC_ExitDataOp : OpenACC_Op<"exit_data", [AttrSizedOperandSegments]> {
// 2.9 loop Construct
//===----------------------------------------------------------------------===//
-def OpenACC_LoopOp : OpenACC_Op<"loop",
- [AttrSizedOperandSegments,
- SingleBlockImplicitTerminator<"acc::YieldOp">]> {
+def OpenACC_LoopOp : OpenACC_Op<"loop", [AttrSizedOperandSegments]> {
let summary = "loop construct";
let description = [{
@@ -367,7 +365,6 @@ def OpenACC_LoopOp : OpenACC_Op<"loop",
```
}];
-
let arguments = (ins OptionalAttr<I64Attr>:$collapse,
Optional<IntOrIndex>:$gangNum,
Optional<IntOrIndex>:$gangStatic,
diff --git a/mlir/test/Dialect/OpenACC/ops.mlir b/mlir/test/Dialect/OpenACC/ops.mlir
index 48d343b7d2c8..de5c3b4fad3f 100644
--- a/mlir/test/Dialect/OpenACC/ops.mlir
+++ b/mlir/test/Dialect/OpenACC/ops.mlir
@@ -323,6 +323,37 @@ func.func @testloopop() -> () {
// -----
+func.func @acc_loop_multiple_block() {
+ acc.parallel {
+ acc.loop {
+ %c1 = arith.constant 1 : index
+ cf.br ^bb1(%c1 : index)
+ ^bb1(%9: index):
+ %c0 = arith.constant 0 : index
+ %12 = arith.cmpi sgt, %9, %c0 : index
+ cf.cond_br %12, ^bb2, ^bb3
+ ^bb2:
+ %c1_0 = arith.constant 1 : index
+ %c10 = arith.constant 10 : index
+ %22 = arith.subi %c10, %c1_0 : index
+ cf.br ^bb1(%22 : index)
+ ^bb3:
+ acc.yield
+ }
+ acc.yield
+ }
+ return
+}
+
+// CHECK-LABEL: func.func @acc_loop_multiple_block()
+// CHECK: acc.parallel
+// CHECK: acc.loop
+// CHECK-3: ^bb{{.*}}
+// CHECK: acc.yield
+// CHECK: acc.yield
+
+// -----
+
func.func @testparallelop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () {
%i64value = arith.constant 1 : i64
%i32value = arith.constant 1 : i32
More information about the Mlir-commits
mailing list