Skip to content

Commit 3c23d1f

Browse files
committed
[flang][OpenMP] Enable delayed privatization for omp parallel by default
Flips the delayed privatization switch to be on by default. After the recent fixes related to delayed privatization, the gfortran test suite runs successfully with delayed privatization turned on by defuault for `omp parallel`.
1 parent c905db6 commit 3c23d1f

20 files changed

+70
-25
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
21432143
symTable.pushScope();
21442144
loopDsp.emplace(converter, semaCtx, item->clauses, eval,
21452145
/*shouldCollectPreDeterminedSymbols=*/true,
2146-
enableDelayedPrivatization, &symTable);
2146+
/*useDelayedPrivatization=*/false, &symTable);
21472147
loopDsp->processStep1();
21482148
}
21492149

flang/lib/Lower/OpenMP/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ llvm::cl::opt<bool> enableDelayedPrivatization(
3434
"openmp-enable-delayed-privatization",
3535
llvm::cl::desc(
3636
"Emit `[first]private` variables as clauses on the MLIR ops."),
37-
llvm::cl::init(false));
37+
llvm::cl::init(true));
3838

3939
llvm::cl::opt<bool> enableDelayedPrivatizationStaging(
4040
"openmp-enable-delayed-privatization-staging",

flang/test/Integration/OpenMP/copyprivate.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
!CHECK-NEXT: }
3434

3535
!CHECK-LABEL: define internal void @test_scalar_..omp_par({{.*}})
36-
!CHECK: %[[J:.*]] = alloca i32, i64 1
3736
!CHECK: %[[I:.*]] = alloca i32, i64 1
37+
!CHECK: %[[J:.*]] = alloca i32, i64 1
3838
!CHECK: %[[DID_IT:.*]] = alloca i32
3939
!CHECK: store i32 0, ptr %[[DID_IT]]
4040
!CHECK: %[[THREAD_NUM1:.*]] = call i32 @__kmpc_global_thread_num(ptr @[[LOC:.*]])

flang/test/Lower/OpenMP/Todo/omp-default-clause-inner-loop.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
! This test checks the lowering of parallel do
22

3-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
4-
! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp \
4+
! RUN: -mmlir --openmp-enable-delayed-privatization=false %s -o - \
5+
! RUN: | FileCheck %s
6+
7+
! RUN: bbc -fopenmp -emit-fir -hlfir=false \
8+
! RUN: --openmp-enable-delayed-privatization=false %s -o - \
9+
! RUN: | FileCheck %s
510

611
! The string "EXPECTED" denotes the expected FIR
712

flang/test/Lower/OpenMP/copyprivate.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
! Test COPYPRIVATE.
2-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
3+
! RUN: -mmlir --openmp-enable-delayed-privatization=false -o - %s 2>&1 \
4+
! RUN: | FileCheck %s
35

46
!CHECK-DAG: func private @_copy_i64(%{{.*}}: !fir.ref<i64>, %{{.*}}: !fir.ref<i64>)
57
!CHECK-DAG: func private @_copy_f32(%{{.*}}: !fir.ref<f32>, %{{.*}}: !fir.ref<f32>)

flang/test/Lower/OpenMP/copyprivate2.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
! Test lowering of COPYPRIVATE with allocatable/pointer variables.
2-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
3+
! RUN: -mmlir --openmp-enable-delayed-privatization=false \
4+
! RUN: -o - %s 2>&1 | FileCheck %s
35

46
!CHECK-LABEL: func private @_copy_box_ptr_i32(
57
!CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.box<!fir.ptr<i32>>>,

flang/test/Lower/OpenMP/critical.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
! REQUIRES: openmp_runtime
22

3-
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
3+
!RUN: %flang_fc1 -emit-hlfir \
4+
!RUN: -mmlir --openmp-enable-delayed-privatization=false \
5+
!RUN: %openmp_flags %s -o - | FileCheck %s
46

57
!CHECK: omp.critical.declare @help2
68
!CHECK: omp.critical.declare @help1 hint(contended)

flang/test/Lower/OpenMP/default-clause-byref.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
! This test checks lowering of OpenMP parallel directive
22
! with `DEFAULT` clause present.
33

4-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s
5-
! RUN: bbc -fopenmp -emit-hlfir --force-byref-reduction %s -o - | FileCheck %s
4+
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --force-byref-reduction \
5+
! RUN: -mmlir --openmp-enable-delayed-privatization=false %s -o - \
6+
! RUN: | FileCheck %s
7+
8+
! RUN: bbc -fopenmp -emit-hlfir --force-byref-reduction \
9+
! RUN: --openmp-enable-delayed-privatization=false %s -o - \
10+
! RUN: | FileCheck %s
611

712

813
!CHECK: func @_QQmain() attributes {fir.bindc_name = "default_clause_lowering"} {

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
! This test checks lowering of OpenMP parallel directive
22
! with `DEFAULT` clause present.
33

4-
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
5-
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
4+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
5+
! RUN: -mmlir --openmp-enable-delayed-privatization=false %s -o - \
6+
! RUN: | FileCheck %s
7+
8+
! RUN: bbc -fopenmp -emit-hlfir \
9+
! RUN: --openmp-enable-delayed-privatization=false %s -o - \
10+
! RUN: | FileCheck %s
611

712

813
!CHECK: func @_QQmain() attributes {fir.bindc_name = "default_clause_lowering"} {

flang/test/Lower/OpenMP/firstprivate-commonblock.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
1+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
2+
! RUN: -mmlir --openmp-enable-delayed-privatization=false -o - %s 2>&1 \
3+
! RUN: | FileCheck %s
24

35
!CHECK: func.func @_QPfirstprivate_common() {
46
!CHECK: %[[val_0:.*]] = fir.address_of(@c_) : !fir.ref<!fir.array<8xi8>>

flang/test/Lower/OpenMP/hlfir-seqloop-parallel.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
! This test checks lowering of sequential loops in OpenMP parallel.
22
! The loop indices of these loops should be privatised.
33

4-
! RUN: bbc -hlfir -fopenmp -emit-hlfir %s -o - | FileCheck %s
5-
! RUN: %flang_fc1 -emit-hlfir -flang-experimental-hlfir -fopenmp %s -o - | FileCheck %s
4+
! RUN: bbc -fopenmp -emit-hlfir \
5+
! RUN: --openmp-enable-delayed-privatization=false %s -o - \
6+
! RUN: | FileCheck %s
7+
8+
! RUN: %flang_fc1 -emit-hlfir -flang-experimental-hlfir -fopenmp \
9+
! RUN: -mmlir --openmp-enable-delayed-privatization=false %s -o - \
10+
! RUN: | FileCheck %s
611

712

813
subroutine sb1

flang/test/Lower/OpenMP/implicit-dsa.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
1+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
2+
! RUN: -mmlir --openmp-enable-delayed-privatization=false -o - %s 2>&1 \
3+
! RUN: | FileCheck %s
24

35
! Checks lowering of OpenMP variables with implicitly determined DSAs.
46

flang/test/Lower/OpenMP/parallel-firstprivate-clause-scalar.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
! This test checks lowering of `FIRSTPRIVATE` clause for scalar types.
22

33
! REQUIRES: shell
4-
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s --check-prefix=CHECK
4+
! RUN: bbc -fopenmp -emit-hlfir --openmp-enable-delayed-privatization=false %s -o - \
5+
! RUN: | FileCheck %s --check-prefix=CHECK
56

67
!CHECK-DAG: func @_QPfirstprivate_complex(%[[ARG1:.*]]: !fir.ref<!fir.complex<4>>{{.*}}, %[[ARG2:.*]]: !fir.ref<!fir.complex<8>>{{.*}}) {
78
!CHECK: %[[ARG1_DECL:.*]]:2 = hlfir.declare %[[ARG1]] dummy_scope %{{[0-9]+}} {uniq_name = "_QFfirstprivate_complexEarg1"} : (!fir.ref<!fir.complex<4>>, !fir.dscope) -> (!fir.ref<!fir.complex<4>>, !fir.ref<!fir.complex<4>>)

flang/test/Lower/OpenMP/parallel-private-clause-fixes.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
! This test checks a few bug fixes in the PRIVATE clause lowering
22

3-
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
3+
! RUN: bbc -fopenmp -emit-hlfir --openmp-enable-delayed-privatization=false %s -o - \
4+
! RUN: | FileCheck %s
5+
6+
47

58
! CHECK-LABEL: multiple_private_fix
69
! CHECK-SAME: %[[GAMA:.*]]: !fir.ref<i32> {fir.bindc_name = "gama"}

flang/test/Lower/OpenMP/parallel-private-clause-str.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
! `PRIVATE` clause present for strings
33

44
! REQUIRES: shell
5-
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
6-
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
5+
! RUN: bbc -fopenmp -emit-hlfir --openmp-enable-delayed-privatization=false %s -o - \
6+
! RUN: | FileCheck %s
7+
8+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
9+
! RUN: -mmlir --openmp-enable-delayed-privatization=false -o - %s 2>&1 \
10+
! RUN: | FileCheck %s
711

812
!CHECK: func.func @_QPtest_allocatable_string(%{{.*}}: !fir.ref<i32> {fir.bindc_name = "n"}) {
913
!CHECK: %[[C_BOX_REF:.*]] = fir.alloca !fir.box<!fir.heap<!fir.char<1,?>>> {bindc_name = "c", uniq_name = "_QFtest_allocatable_stringEc"}

flang/test/Lower/OpenMP/parallel-private-clause.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
! `PRIVATE` clause present.
33

44
! REQUIRES: shell
5-
! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-hlfir %s -o - | \
5+
! RUN: bbc --use-desc-for-alloc=false -fopenmp -emit-hlfir \
6+
! RUN: --openmp-enable-delayed-privatization=false %s -o - | \
67
! RUN: FileCheck %s --check-prefix=FIRDialect
78

89
!FIRDialect: func @_QPprivate_clause(%[[ARG1:.*]]: !fir.ref<i32> {fir.bindc_name = "arg1"}, %[[ARG2:.*]]: !fir.ref<!fir.array<10xi32>> {fir.bindc_name = "arg2"}, %[[ARG3:.*]]: !fir.boxchar<1> {fir.bindc_name = "arg3"}, %[[ARG4:.*]]: !fir.boxchar<1> {fir.bindc_name = "arg4"}) {

flang/test/Lower/OpenMP/parallel-reduction-mixed.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
!! Make sure that mixture of by-ref and by-val reductions work all the way
22
!! to LLVM-IR code.
3-
! RUN: %flang_fc1 -emit-llvm -fopenmp -o - %s 2>&1 | FileCheck %s
3+
! RUN: %flang_fc1 -emit-llvm \
4+
! RUN: -mmlir --openmp-enable-delayed-privatization=false \
5+
! RUN: -fopenmp -o - %s 2>&1 | FileCheck %s
46
subroutine proc
57
implicit none
68
real(8),allocatable :: F(:)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
! This test checks lowering of OpenMP DO Directive (Worksharing).
22

3-
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
3+
! RUN: bbc -fopenmp -emit-hlfir --openmp-enable-delayed-privatization=false %s -o - \
4+
! RUN: | FileCheck %s
45

56
! CHECK-LABEL: func @_QPsimple_parallel_do()
67
subroutine simple_parallel_do

flang/test/Lower/OpenMP/private-commonblock.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
1+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
2+
! RUN: -mmlir --openmp-enable-delayed-privatization=false -o - %s 2>&1 \
3+
! RUN: | FileCheck %s
24

35
!CHECK: func.func @_QPprivate_common() {
46
!CHECK: omp.parallel {

flang/test/Lower/OpenMP/unstructured.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
! Test unstructured code adjacent to and inside OpenMP constructs.
22

3-
! RUN: bbc %s -fopenmp -emit-hlfir -o "-" | FileCheck %s
3+
! RUN: bbc %s -fopenmp -emit-hlfir --openmp-enable-delayed-privatization=false -o "-" \
4+
! RUN: | FileCheck %s
45

56
! CHECK-LABEL: func @_QPss1{{.*}} {
67
! CHECK: br ^bb1

0 commit comments

Comments
 (0)