diff --git a/flang/test/Lower/OpenACC/acc-serial-loop.f90 b/flang/test/Lower/OpenACC/acc-serial-loop.f90 --- a/flang/test/Lower/OpenACC/acc-serial-loop.f90 +++ b/flang/test/Lower/OpenACC/acc-serial-loop.f90 @@ -358,18 +358,19 @@ ! CHECK: acc.yield ! CHECK-NEXT: }{{$}} - !$acc serial loop private(a) firstprivate(b) - DO i = 1, n - a(i) = b(i) - END DO - -! CHECK: acc.serial firstprivate(%[[B]] : !fir.ref>) private(%[[A]] : !fir.ref>) { -! CHECK: acc.loop private(%[[A]] : !fir.ref>) { -! CHECK: fir.do_loop -! CHECK: acc.yield -! CHECK-NEXT: }{{$}} -! CHECK: acc.yield -! CHECK-NEXT: }{{$}} +! TODO: update when lowering is updated to new private design +! !$acc serial loop private(a) firstprivate(b) +! DO i = 1, n +! a(i) = b(i) +! END DO + +! TODO: acc.serial firstprivate(%[[B]] : !fir.ref>) private(%[[A]] : !fir.ref>) { +! TODO: acc.loop private(%[[A]] : !fir.ref>) { +! TODO: fir.do_loop +! TODO: acc.yield +! TODO-NEXT: }{{$}} +! TODO: acc.yield +! TODO-NEXT: }{{$}} !$acc serial loop seq DO i = 1, n diff --git a/flang/test/Lower/OpenACC/acc-serial.f90 b/flang/test/Lower/OpenACC/acc-serial.f90 --- a/flang/test/Lower/OpenACC/acc-serial.f90 +++ b/flang/test/Lower/OpenACC/acc-serial.f90 @@ -231,11 +231,12 @@ ! CHECK: acc.detach accPtr(%[[ATTACH_D]] : !fir.ptr) {dataClause = 10 : i64, name = "d"} ! CHECK: acc.detach accPtr(%[[ATTACH_E]] : !fir.ptr) {dataClause = 10 : i64, name = "e"} - !$acc serial private(a) firstprivate(b) private(c) - !$acc end serial +! TODO: update when lowering is updated to new private design +! !$acc serial private(a) firstprivate(b) private(c) +! !$acc end serial -! CHECK: acc.serial firstprivate(%[[B]] : !fir.ref>) private(%[[A]], %[[C]] : !fir.ref>, !fir.ref>) { -! CHECK: acc.yield -! CHECK-NEXT: }{{$}} +! TODO: acc.serial firstprivate(%[[B]] : !fir.ref>) private(%[[A]], %[[C]] : !fir.ref>, !fir.ref>) { +! TODO: acc.yield +! TODO-NEXT: }{{$}} end subroutine diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td --- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td +++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td @@ -704,7 +704,8 @@ UnitAttr:$selfAttr, OptionalAttr:$reductionOp, Variadic:$reductionOperands, - Variadic:$gangPrivateOperands, + Variadic:$gangPrivateOperands, + OptionalAttr:$privatizations, Variadic:$gangFirstPrivateOperands, Variadic:$dataClauseOperands, OptionalAttr:$defaultAttr); @@ -725,7 +726,9 @@ | `async` `(` $async `:` type($async) `)` | `firstprivate` `(` $gangFirstPrivateOperands `:` type($gangFirstPrivateOperands) `)` - | `private` `(` $gangPrivateOperands `:` type($gangPrivateOperands) `)` + | `private` `(` custom( + $gangPrivateOperands, type($gangPrivateOperands), $privatizations) + `)` | `wait` `(` $waitOperands `:` type($waitOperands) `)` | `self` `(` $selfCond `)` | `if` `(` $ifCond `)` diff --git a/mlir/test/Dialect/OpenACC/ops.mlir b/mlir/test/Dialect/OpenACC/ops.mlir --- a/mlir/test/Dialect/OpenACC/ops.mlir +++ b/mlir/test/Dialect/OpenACC/ops.mlir @@ -490,7 +490,25 @@ // ----- -// ----- +acc.private.recipe @privatization_memref_10_f32 : memref<10xf32> init { +^bb0(%arg0: memref<10xf32>): + %0 = memref.alloc() : memref<10xf32> + acc.yield %0 : memref<10xf32> +} destroy { +^bb0(%arg0: memref<10xf32>): + memref.dealloc %arg0 : memref<10xf32> + acc.terminator +} + +acc.private.recipe @privatization_memref_10_10_f32 : memref<10x10xf32> init { +^bb0(%arg0: memref<10x10xf32>): + %0 = memref.alloc() : memref<10x10xf32> + acc.yield %0 : memref<10x10xf32> +} destroy { +^bb0(%arg0: memref<10x10xf32>): + memref.dealloc %arg0 : memref<10x10xf32> + acc.terminator +} func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10xf32>) -> () { %i64value = arith.constant 1 : i64 @@ -510,7 +528,7 @@ } acc.serial wait(%i64value, %i32value, %idxValue : i64, i32, index) { } - acc.serial private(%a, %c : memref<10xf32>, memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { + acc.serial private(@privatization_memref_10_f32 -> %a : memref<10xf32>, @privatization_memref_10_10_f32 -> %c : memref<10x10xf32>) firstprivate(%b: memref<10xf32>) { } acc.serial { } attributes {defaultAttr = #acc} @@ -546,7 +564,7 @@ // CHECK-NEXT: } // CHECK: acc.serial wait([[I64VALUE]], [[I32VALUE]], [[IDXVALUE]] : i64, i32, index) { // CHECK-NEXT: } -// CHECK: acc.serial firstprivate([[ARGB]] : memref<10xf32>) private([[ARGA]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) { +// CHECK: acc.serial firstprivate([[ARGB]] : memref<10xf32>) private(@privatization_memref_10_f32 -> [[ARGA]] : memref<10xf32>, @privatization_memref_10_10_f32 -> [[ARGC]] : memref<10x10xf32>) { // CHECK-NEXT: } // CHECK: acc.serial { // CHECK-NEXT: } attributes {defaultAttr = #acc}