brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 69c9ecf Raw
24 lines · plain
1! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s2 3! Check for implicit data transfer of managed variable4 5subroutine testr2(N1,N2)6  real(4), managed :: ai4(N1,N2)7  real(4), allocatable :: bRefi4(:)8 9  integer :: i1, i210 11  allocate(bRefi4(N1))12  do i1 = 1, N113    bRefi4(i1) = (ai4(i1,1)+ai4(i1,N2))*N2/214  enddo15  deallocate(bRefi4)16 17end subroutine18 19! CHECK-LABEL: func.func @_QPtestr220! CHECK:  %[[MANAGED:.*]]:2 = hlfir.declare %22(%23) {data_attr = #cuf.cuda<managed>, uniq_name = "_QFtestr2Eai4"} : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<2>) -> (!fir.box<!fir.array<?x?xf32>>, !fir.ref<!fir.array<?x?xf32>>)21! CHECK: %[[TMP:.*]] = fir.allocmem !fir.array<?x?xf32>, %16, %21 {bindc_name = ".tmp", uniq_name = ""}22! CHECK: %[[TMP_DECL:.*]]:2 = hlfir.declare %[[TMP]](%{{.*}}) {uniq_name = ".tmp"} : (!fir.heap<!fir.array<?x?xf32>>, !fir.shape<2>) -> (!fir.box<!fir.array<?x?xf32>>, !fir.heap<!fir.array<?x?xf32>>)23! CHECK: cuf.data_transfer %[[MANAGED]]#1 to %[[TMP_DECL]]#0 {transfer_kind = #cuf.cuda_transfer<device_host>} : !fir.ref<!fir.array<?x?xf32>>, !fir.box<!fir.array<?x?xf32>>24