| 1 |
! Check offloaded function's attributes and classification for OpenACC |
| 2 |
! routine. |
| 3 |
|
| 4 |
! { dg-additional-options "-O2" } |
| 5 |
! { dg-additional-options "-fopt-info-optimized-omp" } |
| 6 |
! { dg-additional-options "-fdump-tree-ompexp" } |
| 7 |
! { dg-additional-options "-fdump-tree-oaccloops" } |
| 8 |
|
| 9 |
! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting |
| 10 |
! aspects of that functionality. |
| 11 |
|
| 12 |
subroutine ROUTINE |
| 13 |
!$acc routine worker |
| 14 |
integer, parameter :: n = 1024 |
| 15 |
integer, dimension (0:n-1) :: a, b, c |
| 16 |
integer :: i |
| 17 |
|
| 18 |
call setup(a, b) |
| 19 |
|
| 20 |
!$acc loop ! { dg-line l_loop_i1 } |
| 21 |
! { dg-optimized {assigned OpenACC worker vector loop parallelism} {} { target *-*-* } l_loop_i1 } |
| 22 |
do i = 0, n - 1 |
| 23 |
c(i) = a(i) + b(i) |
| 24 |
end do |
| 25 |
end subroutine ROUTINE |
| 26 |
|
| 27 |
! Check the offloaded function's attributes. |
| 28 |
! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(0 1, 1 0, 1 0\\), omp declare target \\(worker\\)\\)\\)" 1 "ompexp" } } |
| 29 |
|
| 30 |
! Check the offloaded function's classification and compute dimensions (will |
| 31 |
! always be 1 x 1 x 1 for non-offloading compilation). |
| 32 |
! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccloops" } } |
| 33 |
! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } } |
| 34 |
! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } } |
| 35 |
! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine' not discarded" 1 "oaccloops" { target { ! offloading_enabled } } } } |
| 36 |
! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'routine_' not discarded" 1 "oaccloops" { target offloading_enabled } } } |
| 37 |
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } } |
| 38 |
! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(0 1, 1 1, 1 1\\), omp declare target \\(worker\\)\\)\\)" 1 "oaccloops" } } |
| 39 |
! { dg-final { scan-tree-dump-times "(?n)void routine \\(\\)" 1 "oaccloops" { target { ! offloading_enabled } } } } |
| 40 |
! { dg-final { scan-tree-dump-times "(?n)void routine_ \\(\\)" 1 "oaccloops" { target offloading_enabled } } } |
| 41 |
!TODO See PR101551 for 'offloading_enabled' differences. |