brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 069d4a7 Raw
38 lines · plain
1! Basic test of use_device_ptr, checking if the appropriate2! addresses are maintained across target boundaries3! REQUIRES: clang, flang, amdgcn-amd-amdhsa4 5! RUN: %clang -c -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \6! RUN:   %S/../../Inputs/target-use-dev-ptr.c -o target-use-dev-ptr_c.o7! RUN: %libomptarget-compile-fortran-generic target-use-dev-ptr_c.o8! RUN: %t | %fcheck-generic9 10program use_device_test11   use iso_c_binding12   interface13      type(c_ptr) function get_ptr() BIND(C)14         USE, intrinsic :: iso_c_binding15         implicit none16      end function get_ptr17 18      integer(c_int) function check_result(host, dev) BIND(C)19         USE, intrinsic :: iso_c_binding20         implicit none21         type(c_ptr), value, intent(in) :: host, dev22      end function check_result23   end interface24 25   type(c_ptr) :: device_ptr, x26 27   x = get_ptr()28   device_ptr = x29 30   !$omp target data map(tofrom: x) use_device_ptr(x)31   device_ptr = x32   !$omp end target data33 34   print *, check_result(x, device_ptr)35end program use_device_test36 37! CHECK: SUCCESS38