brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.5 KiB · 9c3adfb Raw
205 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc2 3! Check OpenACC clause validity for the following construct and directive:4!   2.5.3 Kernels5 6program openacc_kernels_validity7 8  implicit none9 10  type atype11    real(8), dimension(10) :: arr12    real(8) :: s13  end type atype14 15  integer :: i, j, b, gang_size, vector_size, worker_size16  integer, parameter :: N = 25617  integer, dimension(N) :: c18  logical, dimension(N) :: d, e19  integer :: async120  integer :: wait1, wait221  real :: reduction_r22  logical :: reduction_l23  real(8), dimension(N, N) :: aa, bb, cc24  real(8), dimension(:), allocatable :: dd25  real(8), pointer :: p26  logical :: ifCondition = .TRUE.27  type(atype) :: t28  type(atype), dimension(10) :: ta29  real(8), dimension(N) :: a, f, g, h30 31  !$acc kernels async32  !$acc end kernels33 34  !$acc kernels async(1)35  !$acc end kernels36 37  !$acc kernels async(async1)38  !$acc end kernels39 40  !ERROR: At most one ASYNC clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause41  !$acc kernels async(async1) async(2)42  !$acc end kernels43 44  !$acc kernels async(async1) device_type(multicore) async(2) ! ok45  !$acc end kernels46 47  !ERROR: At most one ASYNC clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause48  !$acc kernels async(async1) device_type(multicore) async(2) async(3)49  !$acc end kernels50 51  !$acc kernels wait(wait1)52  !$acc end kernels53 54  !$acc kernels wait(wait1, wait2)55  !$acc end kernels56 57  !$acc kernels wait(1, 2) async(3)58  !$acc end kernels59 60  !$acc kernels wait(queues: 1, 2) async(3)61  !$acc end kernels62 63  !$acc kernels wait(1) wait(2) async(3)64  !$acc end kernels65 66  !$acc kernels wait(devnum: 1: 1, 2) async(3)67  !$acc end kernels68 69  !$acc kernels wait(devnum: 1: queues: 1, 2) async(3)70  !$acc end kernels71 72  !$acc kernels num_gangs(8)73  !$acc end kernels74 75  !ERROR: At most one NUM_GANGS clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause76  !$acc kernels num_gangs(8) num_gangs(10)77  !$acc end kernels78 79  !ERROR: At most one NUM_GANGS clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause80  !$acc kernels device_type(nvidia) num_gangs(8) num_gangs(10)81  !$acc end kernels82 83  !$acc kernels device_type(nvidia) num_gangs(8) device_type(radeon) num_gangs(10)84  !$acc end kernels85 86  !$acc kernels num_workers(8)87  !$acc end kernels88 89  !ERROR: At most one NUM_WORKERS clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause90  !$acc kernels num_workers(8) num_workers(4)91  !$acc end kernels92 93  !ERROR: At most one NUM_WORKERS clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause94  !$acc kernels device_type(nvidia) num_workers(8) num_workers(4)95  !$acc end kernels96 97  !$acc kernels device_type(nvidia) num_workers(8) device_type(radeon) num_workers(4)98  !$acc end kernels99 100  !$acc kernels vector_length(128)101  !$acc end kernels102 103  !ERROR: At most one VECTOR_LENGTH clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause104  !$acc kernels vector_length(128) vector_length(124)105  !$acc end kernels106 107  !ERROR: At most one VECTOR_LENGTH clause can appear on the KERNELS directive or in group separated by the DEVICE_TYPE clause108  !$acc kernels device_type(nvidia) vector_length(256) vector_length(128)109  !$acc end kernels110 111  !$acc kernels device_type(nvidia) vector_length(256) device_type(radeon) vector_length(128)112  !$acc end kernels113 114  !$acc kernels if(.true.)115  !$acc end kernels116 117  !$acc kernels if(ifCondition)118  !$acc end kernels119 120  !ERROR: At most one IF clause can appear on the KERNELS directive121  !$acc kernels if(.true.) if(ifCondition)122  !$acc end kernels123 124  !$acc kernels self125  !$acc end kernels126 127  !$acc kernels self(.true.)128  !$acc end kernels129 130  !$acc kernels self(ifCondition)131  !$acc end kernels132 133  !$acc kernels copy(aa) copyin(bb) copyout(cc)134  !$acc end kernels135 136  !$acc kernels copy(aa, bb) copyout(zero: cc)137  !$acc end kernels138 139  !$acc kernels present(aa, bb) create(cc)140  !$acc end kernels141 142  !$acc kernels copyin(readonly: aa, bb) create(zero: cc)143  !$acc end kernels144 145  !$acc kernels deviceptr(aa, bb) no_create(cc)146  !$acc end kernels147 148  !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute149  !$acc kernels attach(dd, p, aa)150  !$acc end kernels151 152  !ERROR: PRIVATE clause is not allowed on the KERNELS directive153  !$acc kernels private(aa, bb, cc)154  !$acc end kernels155 156  !$acc kernels default(none)157  !$acc end kernels158 159  !$acc kernels default(present)160  !$acc end kernels161 162  !ERROR: At most one DEFAULT clause can appear on the KERNELS directive163  !$acc kernels default(none) default(present)164  !$acc end kernels165 166  !$acc kernels device_type(*)167  !$acc end kernels168 169  !$acc kernels device_type(default)170  !$acc end kernels171 172  !$acc kernels device_type(default, host)173  !$acc end kernels174 175  !$acc kernels device_type(*) async wait num_gangs(8) num_workers(8) vector_length(128)176  !$acc end kernels177 178  !$acc kernels device_type(*) async179  do i = 1, N180    a(i) = 3.14d0181  end do182  !$acc end kernels183 184  !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS directive185  !$acc kernels device_type(*) if(.TRUE.)186  do i = 1, N187    a(i) = 3.14d0188  end do189  !$acc end kernels190 191  do i = 1, 100192    !$acc kernels193    !ERROR: CYCLE to construct outside of KERNELS construct is not allowed194    if (i == 10) cycle195    !$acc end kernels196  end do197 198  !$acc kernels199  do i = 1, 100200    if (i == 10) cycle201  end do202  !$acc end kernels203 204end program openacc_kernels_validity205