[mlir][openacc] Accept acc.serial has parent of acc.yield op
authorValentin Clement <clementval@gmail.com>
Thu, 13 Apr 2023 21:35:02 +0000 (14:35 -0700)
committerValentin Clement <clementval@gmail.com>
Thu, 13 Apr 2023 21:35:22 +0000 (14:35 -0700)
acc.serial op is modeled on the acc.parallel op.
acc.yield operation must then accept acc.serial has a parent
operation.

Reviewed By: PeteSteinfeld, razvanlupusoru

Differential Revision: https://reviews.llvm.org/D148258

mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
mlir/test/Dialect/OpenACC/ops.mlir

index f0f0acc..2bc4267 100644 (file)
@@ -497,7 +497,7 @@ def OpenACC_LoopOp : OpenACC_Op<"loop", [AttrSizedOperandSegments]> {
 
 // Yield operation for the acc.loop and acc.parallel operations.
 def OpenACC_YieldOp : OpenACC_Op<"yield", [Terminator,
-    ParentOneOf<["ParallelOp, LoopOp"]>]> {
+    ParentOneOf<["ParallelOp, LoopOp, SerialOp"]>]> {
   let summary = "Acc yield and termination operation";
 
   let description = [{
index c659467..be014fd 100644 (file)
@@ -530,6 +530,9 @@ func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10
   } attributes {waitAttr}
   acc.serial {
   } attributes {selfAttr}
+  acc.serial {
+    acc.yield
+  } attributes {selfAttr}
   return
 }
 
@@ -577,6 +580,9 @@ func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10
 // CHECK-NEXT: } attributes {waitAttr}
 // CHECK:      acc.serial {
 // CHECK-NEXT: } attributes {selfAttr}
+// CHECK:      acc.serial {
+// CHECK:        acc.yield
+// CHECK-NEXT: } attributes {selfAttr}
 
 // -----