| 1 |
! Check offloaded function's attributes and classification for OpenACC |
| 2 |
! kernels. |
| 3 |
|
| 4 |
! { dg-additional-options "--param openacc-kernels=parloops" } |
| 5 |
|
| 6 |
! { dg-additional-options "-O2" } |
| 7 |
! { dg-additional-options "-fopt-info-optimized-omp" } |
| 8 |
! { dg-additional-options "-fdump-tree-ompexp" } |
| 9 |
! { dg-additional-options "-fdump-tree-parloops1-all" } |
| 10 |
! { dg-additional-options "-fdump-tree-oaccloops" } |
| 11 |
|
| 12 |
! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting |
| 13 |
! aspects of that functionality. |
| 14 |
|
| 15 |
program main |
| 16 |
implicit none |
| 17 |
integer, parameter :: n = 1024 |
| 18 |
integer, dimension (0:n-1) :: a, b, c |
| 19 |
integer :: i |
| 20 |
|
| 21 |
call setup(a, b) |
| 22 |
|
| 23 |
!$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-line l_compute1 } |
| 24 |
! { dg-optimized {assigned OpenACC gang loop parallelism} {} { target *-*-* } l_compute1 } |
| 25 |
do i = 0, n - 1 |
| 26 |
c(i) = a(i) + b(i) |
| 27 |
end do |
| 28 |
!$acc end kernels |
| 29 |
end program main |
| 30 |
|
| 31 |
! Check the offloaded function's attributes. |
| 32 |
! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } |
| 33 |
|
| 34 |
! Check that exactly one OpenACC kernels construct is analyzed, and that it |
| 35 |
! can be parallelized. |
| 36 |
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } |
| 37 |
! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } } |
| 38 |
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } |
| 39 |
|
| 40 |
! Check the offloaded function's classification and compute dimensions (will |
| 41 |
! always be 1 x 1 x 1 for non-offloading compilation). |
| 42 |
! { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } } |
| 43 |
! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } } |
| 44 |
! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } |