forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenMP][flang][do-conc] Map values depending on values defined outsi…
…de target region. Adds support for `do concurrent` mapping when mapped value(s) depend on values defined outside the target region; e.g. the size of the array is dynamic. This needs to be handled by localizing these region outsiders by either cloning them in the region or in case we cannot do that, map them and use the mapped values.
- Loading branch information
Showing
3 changed files
with
126 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
flang/test/Transforms/DoConcurrent/runtime_sized_array.f90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
! Tests `do concurrent` mapping when mapped value(s) depend on values defined | ||
! outside the target region; e.g. the size of the array is dynamic. This needs | ||
! to be handled by localizing these region outsiders by either cloning them in | ||
! the region or in case we cannot do that, map them and use the mapped values. | ||
|
||
! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-parallel=device %s -o - \ | ||
! RUN: | FileCheck %s | ||
|
||
subroutine foo(n) | ||
implicit none | ||
integer :: n | ||
integer :: i | ||
integer, dimension(n) :: a | ||
|
||
do concurrent(i=1:10) | ||
a(i) = i | ||
end do | ||
end subroutine | ||
|
||
! CHECK-DAG: %[[I_DECL:.*]]:2 = hlfir.declare %{{.*}} {uniq_name = "_QFfooEi"} | ||
! CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %{{.*}}(%{{.*}}) {uniq_name = "_QFfooEa"} | ||
! CHECK-DAG: %[[N_ALLOC:.*]] = fir.alloca i32 | ||
|
||
! CHECK-DAG: %[[I_MAP:.*]] = omp.map.info var_ptr(%[[I_DECL]]#1 : {{.*}}) | ||
! CHECK-DAG: %[[A_MAP:.*]] = omp.map.info var_ptr(%[[A_DECL]]#1 : {{.*}}) | ||
! CHECK-DAG: %[[N_MAP:.*]] = omp.map.info var_ptr(%[[N_ALLOC]] : {{.*}}) | ||
|
||
! CHECK: omp.target | ||
! CHECK-SAME: map_entries(%[[I_MAP]] -> %[[I_ARG:arg[0-9]*]], | ||
! CHECK-SAME: %[[A_MAP]] -> %[[A_ARG:arg[0-9]*]], | ||
! CHECK-SAME: %[[N_MAP]] -> %[[N_ARG:arg[0-9]*]] : {{.*}}) | ||
! CHECK-SAME: {{.*}} { | ||
|
||
! CHECK-DAG: %{{.*}} = hlfir.declare %[[I_ARG]] | ||
! CHECK-DAG: %{{.*}} = hlfir.declare %[[A_ARG]] | ||
! CHECK-DAG: %{{.*}} = fir.load %[[N_ARG]] | ||
|
||
! CHECK: omp.terminator | ||
! CHECK: } | ||
|
||
|
||
|