Files
clang-p2996/offload/test/offloading/fortran/target_map_present_success.f90
agozillon f1178815d2 [Flang][OpenMP][MLIR] Implement close, present and ompx_hold modifiers for Flang maps (#129586)
This PR adds an initial implementation for the map modifiers close,
present and ompx_hold, primarily just required adding the appropriate
map type flags to the map type bits. In the case of ompx_hold it
required adding the map type to the OpenMP dialect. Close has a bit of a
problem when utilised with the ALWAYS map type on descriptors, so it is
likely we'll have to make sure close and always are not applied to the
descriptor simultaneously in the future when we apply always to the
descriptors to facilitate movement of descriptor information to device
for consistency, however, we may find an alternative to this with
further investigation. For the moment, it is a TODO/Note to keep track
of it.
2025-03-07 22:22:30 +01:00

42 lines
802 B
Fortran

! This checks that the basic functionality of map type present functions as
! expected, no-op'ng when present
! REQUIRES: flang, amdgpu
! RUN: %libomptarget-compile-fortran-run-and-check-generic
subroutine target_data_present()
double precision, dimension(:), allocatable :: arr
integer, parameter :: N = 16
integer :: i
allocate(arr(N))
arr(:) = 10.0d0
!$omp target data map(tofrom:arr)
!$omp target data map(present,alloc:arr)
!$omp target
do i = 1,N
arr(i) = 42.0d0
end do
!$omp end target
!$omp end target data
!$omp end target data
print *, arr
deallocate(arr)
return
end subroutine
program map_present
implicit none
call target_data_present()
end program
!CHECK: 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42.