Skip to content

Commit 0f318d9

Browse files
committed
Revert "[flang][OpenMP] Fix firstprivate not working with lastprivate in DO SIMD (llvm#170163)"
This reverts commit 748e7af.
1 parent c99c3bc commit 0f318d9

File tree

6 files changed

+27
-152
lines changed

6 files changed

+27
-152
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,14 +3338,19 @@ static mlir::omp::WsloopOp genCompositeDoSimd(
33383338
genSimdClauses(converter, semaCtx, simdItem->clauses, loc, simdClauseOps,
33393339
simdReductionSyms);
33403340

3341-
3342-
DataSharingProcessor wsloopItemDSP(converter, semaCtx, doItem->clauses, eval,
3343-
/*shouldCollectPreDeterminedSymbols=*/true,
3344-
/*useDelayedPrivatization=*/true,
3345-
symTable);
3341+
DataSharingProcessor wsloopItemDSP(
3342+
converter, semaCtx, doItem->clauses, eval,
3343+
/*shouldCollectPreDeterminedSymbols=*/false,
3344+
/*useDelayedPrivatization=*/true, symTable);
33463345
wsloopItemDSP.processStep1();
33473346
wsloopItemDSP.processStep2(&wsloopClauseOps);
33483347

3348+
DataSharingProcessor simdItemDSP(converter, semaCtx, simdItem->clauses, eval,
3349+
/*shouldCollectPreDeterminedSymbols=*/true,
3350+
/*useDelayedPrivatization=*/true, symTable);
3351+
simdItemDSP.processStep1();
3352+
simdItemDSP.processStep2(&simdClauseOps, simdItem->id);
3353+
33493354
// Pass the innermost leaf construct's clauses because that's where COLLAPSE
33503355
// is placed by construct decomposition.
33513356
mlir::omp::LoopNestOperands loopNestClauseOps;
@@ -3364,9 +3369,8 @@ static mlir::omp::WsloopOp genCompositeDoSimd(
33643369
wsloopOp.setComposite(/*val=*/true);
33653370

33663371
EntryBlockArgs simdArgs;
3367-
// For composite 'do simd', privatization is handled by the wsloop.
3368-
// The simd does not create separate private storage for variables already
3369-
// privatized by the worksharing construct.
3372+
simdArgs.priv.syms = simdItemDSP.getDelayedPrivSymbols();
3373+
simdArgs.priv.vars = simdClauseOps.privateVars;
33703374
simdArgs.reduction.syms = simdReductionSyms;
33713375
simdArgs.reduction.vars = simdClauseOps.reductionVars;
33723376
auto simdOp =
@@ -3376,7 +3380,7 @@ static mlir::omp::WsloopOp genCompositeDoSimd(
33763380
genLoopNestOp(converter, symTable, semaCtx, eval, loc, queue, simdItem,
33773381
loopNestClauseOps, iv,
33783382
{{wsloopOp, wsloopArgs}, {simdOp, simdArgs}},
3379-
llvm::omp::Directive::OMPD_do_simd, wsloopItemDSP);
3383+
llvm::omp::Directive::OMPD_do_simd, simdItemDSP);
33803384
return wsloopOp;
33813385
}
33823386

flang/test/Integration/OpenMP/do-simd-firstprivate-lastprivate-runtime.f90

Lines changed: 0 additions & 48 deletions
This file was deleted.

flang/test/Lower/OpenMP/do-simd-firstprivate-lastprivate.f90

Lines changed: 0 additions & 89 deletions
This file was deleted.

flang/test/Lower/OpenMP/order-clause.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ end subroutine do_order
3636

3737
!CHECK-LABEL: func.func @_QPdo_simd_order() {
3838
subroutine do_simd_order
39-
!CHECK: omp.wsloop order(reproducible:concurrent)
39+
!CHECK: omp.wsloop order(reproducible:concurrent) {
4040
!$omp do simd order(concurrent)
4141
do i = 1, 10
4242
end do
43-
!CHECK: omp.wsloop order(reproducible:concurrent)
43+
!CHECK: omp.wsloop order(reproducible:concurrent) {
4444
!$omp do simd order(reproducible:concurrent)
4545
do i = 1, 10
4646
end do
47-
!CHECK: omp.wsloop order(unconstrained:concurrent)
47+
!CHECK: omp.wsloop order(unconstrained:concurrent) {
4848
!$omp do simd order(unconstrained:concurrent)
4949
do i = 1, 10
5050
end do
@@ -53,7 +53,7 @@ end subroutine do_simd_order
5353
!CHECK-LABEL: func.func @_QPdo_simd_order_parallel() {
5454
subroutine do_simd_order_parallel
5555
!CHECK: omp.parallel {
56-
!CHECK: omp.wsloop order(reproducible:concurrent)
56+
!CHECK: omp.wsloop order(reproducible:concurrent) {
5757
!$omp parallel do simd order(reproducible:concurrent)
5858
do i = 1, 10
5959
end do

flang/test/Lower/OpenMP/wsloop-simd.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ end subroutine do_simd_reduction
7171
subroutine do_simd_private()
7272
integer, allocatable :: tmp
7373
! CHECK: omp.wsloop
74-
! CHECK-SAME: private(@[[PRIV_IVAR_SYM:.*]] %{{.*}} -> %[[PRIV_IVAR:.*]] : !fir.ref<i32>)
7574
! CHECK-NEXT: omp.simd
75+
! CHECK-SAME: private(@[[PRIV_BOX_SYM:.*]] %{{.*}} -> %[[PRIV_BOX:.*]], @[[PRIV_IVAR_SYM:.*]] %{{.*}} -> %[[PRIV_IVAR:.*]] : !fir.ref<!fir.box<!fir.heap<i32>>>, !fir.ref<i32>)
7676
! CHECK-NEXT: omp.loop_nest (%[[IVAR:.*]]) : i32
7777
!$omp do simd private(tmp)
7878
do i=1, 10
79+
! CHECK: %[[PRIV_BOX_DECL:.*]]:2 = hlfir.declare %[[PRIV_BOX]]
7980
! CHECK: %[[PRIV_IVAR_DECL:.*]]:2 = hlfir.declare %[[PRIV_IVAR]]
8081
! CHECK: hlfir.assign %[[IVAR]] to %[[PRIV_IVAR_DECL]]#0
82+
! CHECK: %[[PRIV_BOX_LOAD:.*]] = fir.load %[[PRIV_BOX_DECL]]
83+
! CHECK: hlfir.assign %{{.*}} to %[[PRIV_BOX_DECL]]#0
8184
! CHECK: omp.yield
8285
tmp = tmp + 1
8386
end do
@@ -87,11 +90,13 @@ end subroutine do_simd_private
8790
subroutine do_simd_lastprivate_firstprivate()
8891
integer :: a
8992
! CHECK: omp.wsloop
90-
! CHECK-SAME: private(@[[FIRSTPRIVATE_A_SYM:.*]] %{{.*}} -> %[[FIRSTPRIVATE_A:.*]], @[[PRIVATE_I_SYM:.*]] %{{.*}} -> %[[PRIVATE_I:.*]] : !fir.ref<i32>, !fir.ref<i32>)
93+
! CHECK-SAME: private(@[[FIRSTPRIVATE_A_SYM:.*]] %{{.*}} -> %[[FIRSTPRIVATE_A:.*]] : !fir.ref<i32>)
9194
! CHECK-NEXT: omp.simd
95+
! CHECK-SAME: private(@[[PRIVATE_A_SYM:.*]] %{{.*}} -> %[[PRIVATE_A:.*]], @[[PRIVATE_I_SYM:.*]] %{{.*}} -> %[[PRIVATE_I:.*]] : !fir.ref<i32>, !fir.ref<i32>)
9296
!$omp do simd lastprivate(a) firstprivate(a)
9397
do i = 1, 10
9498
! CHECK: %[[FIRSTPRIVATE_A_DECL:.*]]:2 = hlfir.declare %[[FIRSTPRIVATE_A]]
99+
! CHECK: %[[PRIVATE_A_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_A]]
95100
! CHECK: %[[PRIVATE_I_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_I]]
96101
a = a + 1
97102
end do

revert_patches.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ complicated build, deferring
1111
needs more work to land
1212
[Flang] Move builtin .mod generation into runtimes (Reapply #137828)
1313
---
14+
olcf fails smoke-fort
15+
[flang][OpenMP] Fix firstprivate not working with lastprivate in DO SIMD (#170163)
16+
---

0 commit comments

Comments
 (0)