forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 16
[flang][openacc] Lower enter data directive #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
schweitzpgi
merged 1 commit into
flang-compiler:fir-dev
from
clementval:flang/openacc/lower/op/enter_data
Oct 30, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,67 @@ | ||
! This test checks lowering of OpenACC enter data directive. | ||
|
||
! RUN: bbc -fopenacc -emit-fir %s -o - | FileCheck %s | ||
|
||
subroutine acc_enter_data | ||
integer :: async = 1 | ||
real, dimension(10, 10) :: a, b, c | ||
logical :: ifCondition = .TRUE. | ||
|
||
!CHECK: [[A:%.*]] = fir.alloca !fir.array<10x10xf32> {name = "{{.*}}Ea"} | ||
!CHECK: [[B:%.*]] = fir.alloca !fir.array<10x10xf32> {name = "{{.*}}Eb"} | ||
!CHECK: [[C:%.*]] = fir.alloca !fir.array<10x10xf32> {name = "{{.*}}Ec"} | ||
|
||
!$acc enter data create(a) | ||
!CHECK: acc.enter_data create([[A]] : !fir.ref<!fir.array<10x10xf32>>){{$}} | ||
|
||
!$acc enter data create(a) if(.true.) | ||
!CHECK: [[IF1:%.*]] = constant true | ||
!CHECK: acc.enter_data if([[IF1]]) create([[A]] : !fir.ref<!fir.array<10x10xf32>>){{$}} | ||
|
||
!$acc enter data create(a) if(ifCondition) | ||
!CHECK: [[IFCOND:%.*]] = fir.load %{{.*}} : !fir.ref<!fir.logical<4>> | ||
!CHECK: [[IF2:%.*]] = fir.convert [[IFCOND]] : (!fir.logical<4>) -> i1 | ||
!CHECK: acc.enter_data if([[IF2]]) create([[A]] : !fir.ref<!fir.array<10x10xf32>>){{$}} | ||
|
||
!$acc enter data create(a) create(b) create(c) | ||
!CHECK: acc.enter_data create([[A]], [[B]], [[C]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>){{$}} | ||
|
||
!$acc enter data create(a) create(b) create(zero: c) | ||
!CHECK: acc.enter_data create([[A]], [[B]] : !fir.ref<!fir.array<10x10xf32>>, !fir.ref<!fir.array<10x10xf32>>) create_zero([[C]] : !fir.ref<!fir.array<10x10xf32>>){{$}} | ||
|
||
!$acc enter data copyin(a) create(b) attach(c) | ||
!CHECK: acc.enter_data copyin([[A]] : !fir.ref<!fir.array<10x10xf32>>) create([[B]] : !fir.ref<!fir.array<10x10xf32>>) attach([[C]] : !fir.ref<!fir.array<10x10xf32>>){{$}} | ||
|
||
!$acc enter data create(a) async | ||
!CHECK: acc.enter_data create([[A]] : !fir.ref<!fir.array<10x10xf32>>) attributes {async} | ||
|
||
!$acc enter data create(a) wait | ||
!CHECK: acc.enter_data create([[A]] : !fir.ref<!fir.array<10x10xf32>>) attributes {wait} | ||
|
||
!$acc enter data create(a) async wait | ||
!CHECK: acc.enter_data create([[A]] : !fir.ref<!fir.array<10x10xf32>>) attributes {async, wait} | ||
|
||
!$acc enter data create(a) async(1) | ||
!CHECK: [[ASYNC1:%.*]] = constant 1 : i32 | ||
!CHECK: acc.enter_data async([[ASYNC1]] : i32) create([[A]] : !fir.ref<!fir.array<10x10xf32>>) | ||
|
||
!$acc enter data create(a) async(async) | ||
!CHECK: [[ASYNC2:%.*]] = fir.load %{{.*}} : !fir.ref<i32> | ||
!CHECK: acc.enter_data async([[ASYNC2]] : i32) create([[A]] : !fir.ref<!fir.array<10x10xf32>>) | ||
|
||
!$acc enter data create(a) wait(1) | ||
!CHECK: [[WAIT1:%.*]] = constant 1 : i32 | ||
!CHECK: acc.enter_data wait([[WAIT1]] : i32) create([[A]] : !fir.ref<!fir.array<10x10xf32>>) | ||
|
||
!$acc enter data create(a) wait(queues: 1, 2) | ||
!CHECK: [[WAIT2:%.*]] = constant 1 : i32 | ||
!CHECK: [[WAIT3:%.*]] = constant 2 : i32 | ||
!CHECK: acc.enter_data wait([[WAIT2]], [[WAIT3]] : i32, i32) create([[A]] : !fir.ref<!fir.array<10x10xf32>>) | ||
|
||
!$acc enter data create(a) wait(devnum: 1: queues: 1, 2) | ||
!CHECK: [[WAIT4:%.*]] = constant 1 : i32 | ||
!CHECK: [[WAIT5:%.*]] = constant 2 : i32 | ||
!CHECK: [[WAIT6:%.*]] = constant 1 : i32 | ||
!CHECK: acc.enter_data wait_devnum([[WAIT6]] : i32) wait([[WAIT4]], [[WAIT5]] : i32, i32) create([[A]] : !fir.ref<!fir.array<10x10xf32>>) | ||
|
||
end subroutine acc_enter_data |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.