Skip to content

Commit

Permalink
[mlir][openacc] Cleanup acc.serial from old data clause operands
Browse files Browse the repository at this point in the history
Remove old clause operands from acc.serial operation since
the new dataOperands is now in place.
private and firstprivate will receive some redesign but are
not part of the new dataOperands.

Depends on D150207

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D150224
  • Loading branch information
clementval committed May 10, 2023
1 parent b60e491 commit 3484745
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 61 deletions.
2 changes: 1 addition & 1 deletion flang/lib/Lower/OpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ createComputeOp(Fortran::lower::AbstractConverter &converter,
addOperand(operands, operandSegments, selfCond);
if constexpr (!std::is_same_v<Op, mlir::acc::KernelsOp>)
addOperands(operands, operandSegments, reductionOperands);
if constexpr (!std::is_same_v<Op, mlir::acc::ParallelOp>)
if constexpr (std::is_same_v<Op, mlir::acc::KernelsOp>)
operandSegments.append({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
if constexpr (!std::is_same_v<Op, mlir::acc::KernelsOp>) {
addOperands(operands, operandSegments, privateOperands);
Expand Down
25 changes: 0 additions & 25 deletions mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -485,17 +485,6 @@ def OpenACC_SerialOp : OpenACC_Op<"serial",
UnitAttr:$selfAttr,
OptionalAttr<OpenACC_ReductionOpAttr>:$reductionOp,
Variadic<AnyType>:$reductionOperands,
Variadic<AnyType>:$copyOperands,
Variadic<AnyType>:$copyinOperands,
Variadic<AnyType>:$copyinReadonlyOperands,
Variadic<AnyType>:$copyoutOperands,
Variadic<AnyType>:$copyoutZeroOperands,
Variadic<AnyType>:$createOperands,
Variadic<AnyType>:$createZeroOperands,
Variadic<AnyType>:$noCreateOperands,
Variadic<AnyType>:$presentOperands,
Variadic<AnyType>:$devicePtrOperands,
Variadic<AnyType>:$attachOperands,
Variadic<AnyType>:$gangPrivateOperands,
Variadic<AnyType>:$gangFirstPrivateOperands,
Variadic<OpenACC_PointerLikeTypeInterface>:$dataClauseOperands,
Expand All @@ -514,24 +503,10 @@ def OpenACC_SerialOp : OpenACC_Op<"serial",
let assemblyFormat = [{
oilist(
`dataOperands` `(` $dataClauseOperands `:` type($dataClauseOperands) `)`
| `attach` `(` $attachOperands `:` type($attachOperands) `)`
| `async` `(` $async `:` type($async) `)`
| `copy` `(` $copyOperands `:` type($copyOperands) `)`
| `copyin` `(` $copyinOperands `:` type($copyinOperands) `)`
| `copyin_readonly` `(` $copyinReadonlyOperands `:`
type($copyinReadonlyOperands) `)`
| `copyout` `(` $copyoutOperands `:` type($copyoutOperands) `)`
| `copyout_zero` `(` $copyoutZeroOperands `:`
type($copyoutZeroOperands) `)`
| `create` `(` $createOperands `:` type($createOperands) `)`
| `create_zero` `(` $createZeroOperands `:`
type($createZeroOperands) `)`
| `deviceptr` `(` $devicePtrOperands `:` type($devicePtrOperands) `)`
| `firstprivate` `(` $gangFirstPrivateOperands `:`
type($gangFirstPrivateOperands) `)`
| `no_create` `(` $noCreateOperands `:` type($noCreateOperands) `)`
| `private` `(` $gangPrivateOperands `:` type($gangPrivateOperands) `)`
| `present` `(` $presentOperands `:` type($presentOperands) `)`
| `wait` `(` $waitOperands `:` type($waitOperands) `)`
| `self` `(` $selfCond `)`
| `if` `(` $ifCond `)`
Expand Down
8 changes: 1 addition & 7 deletions mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,7 @@ LogicalResult acc::ParallelOp::verify() {
//===----------------------------------------------------------------------===//

unsigned SerialOp::getNumDataOperands() {
return getReductionOperands().size() + getCopyOperands().size() +
getCopyinOperands().size() + getCopyinReadonlyOperands().size() +
getCopyoutOperands().size() + getCopyoutZeroOperands().size() +
getCreateOperands().size() + getCreateZeroOperands().size() +
getNoCreateOperands().size() + getPresentOperands().size() +
getDevicePtrOperands().size() + getAttachOperands().size() +
getGangPrivateOperands().size() +
return getReductionOperands().size() + getGangPrivateOperands().size() +
getGangFirstPrivateOperands().size() + getDataClauseOperands().size();
}

Expand Down
28 changes: 0 additions & 28 deletions mlir/test/Dialect/OpenACC/ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -480,20 +480,6 @@ func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10
}
acc.serial wait(%i64value, %i32value, %idxValue : i64, i32, index) {
}
acc.serial copyin(%a, %b : memref<10xf32>, memref<10xf32>) {
}
acc.serial copyin_readonly(%a, %b : memref<10xf32>, memref<10xf32>) {
}
acc.serial copyin(%a: memref<10xf32>) copyout_zero(%b, %c : memref<10xf32>, memref<10x10xf32>) {
}
acc.serial copyout(%b, %c : memref<10xf32>, memref<10x10xf32>) create(%a: memref<10xf32>) {
}
acc.serial copyout_zero(%b, %c : memref<10xf32>, memref<10x10xf32>) create_zero(%a: memref<10xf32>) {
}
acc.serial no_create(%a: memref<10xf32>) present(%b, %c : memref<10xf32>, memref<10x10xf32>) {
}
acc.serial deviceptr(%a: memref<10xf32>) attach(%b, %c : memref<10xf32>, memref<10x10xf32>) {
}
acc.serial private(%a, %c : memref<10xf32>, memref<10x10xf32>) firstprivate(%b: memref<10xf32>) {
}
acc.serial {
Expand Down Expand Up @@ -530,20 +516,6 @@ func.func @testserialop(%a: memref<10xf32>, %b: memref<10xf32>, %c: memref<10x10
// CHECK-NEXT: }
// CHECK: acc.serial wait([[I64VALUE]], [[I32VALUE]], [[IDXVALUE]] : i64, i32, index) {
// CHECK-NEXT: }
// CHECK: acc.serial copyin([[ARGA]], [[ARGB]] : memref<10xf32>, memref<10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial copyin_readonly([[ARGA]], [[ARGB]] : memref<10xf32>, memref<10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial copyin([[ARGA]] : memref<10xf32>) copyout_zero([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial copyout([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) create([[ARGA]] : memref<10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial copyout_zero([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) create_zero([[ARGA]] : memref<10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial no_create([[ARGA]] : memref<10xf32>) present([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial attach([[ARGB]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) deviceptr([[ARGA]] : memref<10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial firstprivate([[ARGB]] : memref<10xf32>) private([[ARGA]], [[ARGC]] : memref<10xf32>, memref<10x10xf32>) {
// CHECK-NEXT: }
// CHECK: acc.serial {
Expand Down

0 comments on commit 3484745

Please sign in to comment.