[flang-commits] [flang] 2faf397 - [flang][openacc] Lower async/wait clauses for acc.data
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Fri Jun 30 11:12:39 PDT 2023
Author: Valentin Clement
Date: 2023-06-30T11:12:33-07:00
New Revision: 2faf397e4f55b9d3e6aea682e66a948b056fce2d
URL: https://github.com/llvm/llvm-project/commit/2faf397e4f55b9d3e6aea682e66a948b056fce2d
DIFF: https://github.com/llvm/llvm-project/commit/2faf397e4f55b9d3e6aea682e66a948b056fce2d.diff
LOG: [flang][openacc] Lower async/wait clauses for acc.data
Lower async and wait clauses to the correponding
attributes and operands on the acc.data operation.
Depends on D154131
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D154155
Added:
Modified:
flang/lib/Lower/OpenACC.cpp
flang/test/Lower/OpenACC/acc-data.f90
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 648e7e243e3e8..c281b8f8734de 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -1459,6 +1459,13 @@ static void genACCDataOp(Fortran::lower::AbstractConverter &converter,
/*structured=*/true);
attachEntryOperands.append(dataClauseOperands.begin() + crtDataStart,
dataClauseOperands.end());
+ } else if (const auto *asyncClause =
+ std::get_if<Fortran::parser::AccClause::Async>(&clause.u)) {
+ genAsyncClause(converter, asyncClause, async, addAsyncAttr, stmtCtx);
+ } else if (const auto *waitClause =
+ std::get_if<Fortran::parser::AccClause::Wait>(&clause.u)) {
+ genWaitClause(converter, waitClause, waitOperands, waitDevnum,
+ addWaitAttr, stmtCtx);
}
}
@@ -1475,7 +1482,7 @@ static void genACCDataOp(Fortran::lower::AbstractConverter &converter,
builder, currentLocation, operands, operandSegments);
dataOp.setAsyncAttr(addAsyncAttr);
- dataOp.setAsyncAttr(addWaitAttr);
+ dataOp.setWaitAttr(addWaitAttr);
auto insPt = builder.saveInsertionPoint();
builder.setInsertionPointAfter(dataOp);
diff --git a/flang/test/Lower/OpenACC/acc-data.f90 b/flang/test/Lower/OpenACC/acc-data.f90
index 32af8039af7c4..7b880d76bd369 100644
--- a/flang/test/Lower/OpenACC/acc-data.f90
+++ b/flang/test/Lower/OpenACC/acc-data.f90
@@ -144,5 +144,35 @@ subroutine acc_data
! CHECK: acc.detach accPtr(%[[ATTACH_D]] : !fir.ptr<f32>) {dataClause = 10 : i64, name = "d"}
! CHECK: acc.detach accPtr(%[[ATTACH_E]] : !fir.ptr<f32>) {dataClause = 10 : i64, name = "e"}
+ !$acc data present(a) async
+ !$acc end data
+
+! CHECK: acc.data dataOperands(%{{.*}}) {
+! CHECK: } attributes {asyncAttr}
+
+ !$acc data present(a) async(1)
+ !$acc end data
+
+! CHECK: acc.data async(%{{.*}} : i32) dataOperands(%{{.*}}) {
+! CHECK: }{{$}}
+
+ !$acc data present(a) wait
+ !$acc end data
+
+! CHECK: acc.data dataOperands(%{{.*}}) {
+! CHECK: } attributes {waitAttr}
+
+ !$acc data present(a) wait(1)
+ !$acc end data
+
+! CHECK: acc.data dataOperands(%{{.*}}) wait(%{{.*}} : i32) {
+! CHECK: }{{$}}
+
+ !$acc data present(a) wait(devnum: 0: 1)
+ !$acc end data
+
+! CHECK: acc.data dataOperands(%{{.*}}) wait_devnum(%{{.*}} : i32) wait(%{{.*}} : i32) {
+! CHECK: }{{$}}
+
end subroutine acc_data
More information about the flang-commits
mailing list