forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang][openacc] Fix unstructured code in OpenACC region ops (llvm#66284
) For unstructured construct, the blocks are created in advance inside the function body. This causes issues when the unstructured construct is inside an OpenACC region operations. This patch adds the same fix than OpenMP lowering and re-create the blocks inside the op region. Initial OpenMP fix: 29f167a
- Loading branch information
1 parent
ceb4096
commit 7a4752d
Showing
5 changed files
with
171 additions
and
57 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s | ||
! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s | ||
|
||
subroutine test_unstructured1(a, b, c) | ||
integer :: i, j, k | ||
real :: a(:,:,:), b(:,:,:), c(:,:,:) | ||
|
||
!$acc data copy(a, b, c) | ||
|
||
!$acc kernels | ||
a(:,:,:) = 0.0 | ||
!$acc end kernels | ||
|
||
!$acc kernels | ||
do i = 1, 10 | ||
do j = 1, 10 | ||
do k = 1, 10 | ||
end do | ||
end do | ||
end do | ||
!$acc end kernels | ||
|
||
do i = 1, 10 | ||
do j = 1, 10 | ||
do k = 1, 10 | ||
end do | ||
end do | ||
|
||
if (a(1,2,3) > 10) stop 'just to be unstructured' | ||
end do | ||
|
||
!$acc end data | ||
|
||
end subroutine | ||
|
||
! CHECK-LABEL: func.func @_QPtest_unstructured1 | ||
! CHECK: acc.data | ||
! CHECK: acc.kernels | ||
! CHECK: acc.kernels | ||
! CHECK: fir.call @_FortranAStopStatementText | ||
|
||
|
||
subroutine test_unstructured2(a, b, c) | ||
integer :: i, j, k | ||
real :: a(:,:,:), b(:,:,:), c(:,:,:) | ||
|
||
!$acc parallel loop | ||
do i = 1, 10 | ||
do j = 1, 10 | ||
do k = 1, 10 | ||
if (a(1,2,3) > 10) stop 'just to be unstructured' | ||
end do | ||
end do | ||
end do | ||
|
||
! CHECK-LABEL: func.func @_QPtest_unstructured2 | ||
! CHECK: acc.parallel | ||
! CHECK: acc.loop | ||
! CHECK: fir.call @_FortranAStopStatementText | ||
! CHECK: fir.unreachable | ||
! CHECK: acc.yield | ||
! CHECK: acc.yield | ||
|
||
end subroutine | ||
|
||
subroutine test_unstructured3(a, b, c) | ||
integer :: i, j, k | ||
real :: a(:,:,:), b(:,:,:), c(:,:,:) | ||
|
||
!$acc parallel | ||
do i = 1, 10 | ||
do j = 1, 10 | ||
do k = 1, 10 | ||
if (a(1,2,3) > 10) stop 'just to be unstructured' | ||
end do | ||
end do | ||
end do | ||
!$acc end parallel | ||
|
||
! CHECK-LABEL: func.func @_QPtest_unstructured3 | ||
! CHECK: acc.parallel | ||
! CHECK: fir.call @_FortranAStopStatementText | ||
! CHECK: fir.unreachable | ||
! CHECK: acc.yield | ||
|
||
end subroutine |
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