Skip to content

Commit 13edc47

Browse files
committed
[WIP][flang][OpenMP] Enable delayed privatization by default
Flips the delayed privatization switch to be on by default. For now, this PR is only used to smoke out issues resulting from enabling dealyed privatization. It is not meant to be merged (yet).
1 parent 9a706aa commit 13edc47

12 files changed

+42
-15
lines changed

flang/lib/Lower/OpenMP/Utils.cpp

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

3636
namespace Fortran {
3737
namespace lower {

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/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/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]] {uniq_name = "_QFfirstprivate_complexEarg1"} : (!fir.ref<!fir.complex<4>>) -> (!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-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)