blob: 993ac2e251305830b481c7933afcd842bfecebff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
!REQUIRES: flang, amdgpu
!RUN: %libomptarget-compile-fortran-run-and-check-generic
subroutine f
type :: t1
integer :: x, y, z
end type
integer, parameter :: n = 9
type(t1) :: b(n)
integer :: i
do i = 1, n
b(i)%x = 0
b(i)%y = 0
b(i)%z = 0
enddo
!$omp target data map(tofrom: b(1:3)) use_device_addr(b)
!$omp target has_device_addr(b(2)%x)
b(2)%x = 1
!$omp end target
!$omp end target data
print *, "b1", b
end
subroutine g
type :: t1
integer :: x(3), y(7), z(5)
end type
integer, parameter :: n = 5
type(t1) :: b(n)
integer :: i
do i = 1, n
b(i)%x = 0
b(i)%y = 0
b(i)%z = 0
enddo
!$omp target data map(tofrom: b(1:3)) use_device_addr(b)
!$omp target has_device_addr(b(2)%x)
b(2)%x(3) = 1
!$omp end target
!$omp end target data
print *, "b2", b
end
call f()
call g()
end
!CHECK: b1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
!CHECK: b2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|