brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · b44c0b2 Raw
41 lines · plain
1!Offloading test for AUTOMAP modifier in declare target enter2! REQUIRES: flang, amdgpu3 4! FIXME: https://github.com/llvm/llvm-project/issues/1612655! XFAIL: amdgpu6 7! RUN: %libomptarget-compile-fortran-run-and-check-generic8program automap_program9   use iso_c_binding, only: c_loc10   use omp_lib, only: omp_get_default_device, omp_target_is_present11   integer, parameter :: N = 1012   integer :: i13   integer, allocatable, target :: automap_array(:)14   !$omp declare target enter(automap:automap_array)15 16   ! false since the storage is not present even though the descriptor is present17   write (*, *) omp_target_is_present(c_loc(automap_array), omp_get_default_device())18   ! CHECK: 019 20   allocate (automap_array(N))21   ! true since the storage should be allocated and reference count incremented by the allocate22   write (*, *) omp_target_is_present(c_loc(automap_array), omp_get_default_device())23   ! CHECK: 124 25   ! since storage is present this should not be a runtime error26   !$omp target teams loop27   do i = 1, N28      automap_array(i) = i29   end do30 31   !$omp target update from(automap_array)32   write (*, *) automap_array33   ! CHECK: 1 2 3 4 5 6 7 8 9 1034 35   deallocate (automap_array)36 37   ! automap_array should have it's storage unmapped on device here38   write (*, *) omp_target_is_present(c_loc(automap_array), omp_get_default_device())39   ! CHECK: 040end program41