Skip to content

Commit 608ff34

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.4
1 parent e37d736 commit 608ff34

File tree

82 files changed

+1433
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1433
-193
lines changed

offload/test/offloading/fortran/basic-target-region-1D-array-section.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
! Basic offloading test of arrays with provided lower
2-
! and upper bounds as specified by OpenMP's sectioning
1+
! Basic offloading test of arrays with provided lower and upper bounds as
2+
! specified by OpenMP's sectioning
33
! REQUIRES: flang, amdgpu
44

55
! RUN: %libomptarget-compile-fortran-run-and-check-generic

offload/test/offloading/fortran/basic-target-region-3D-array-section.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
! Basic offloading test of a regular array explicitly
2-
! passed within a target region
1+
! Basic offloading test of a regular array explicitly passed within a target
2+
! region
33
! REQUIRES: flang, amdgpu
44

55
! RUN: %libomptarget-compile-fortran-run-and-check-generic

offload/test/offloading/fortran/basic-target-region-3D-array.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
! Basic offloading test of a regular array explicitly
2-
! passed within a target region
1+
! Basic offloading test of a regular array explicitly passed within a target
2+
! region
33
! REQUIRES: flang
44
! REQUIRES: gpu
55
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO

offload/test/offloading/fortran/constant-arr-index.f90

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
! Basic offloading test with a target region
2-
! that checks constant indexing on device
3-
! correctly works (regression test for prior
4-
! bug).
1+
! Basic offloading test with a target region that checks constant indexing on
2+
! device correctly works (regression test for prior bug).
53
! REQUIRES: flang, amdgpu
64

75
! RUN: %libomptarget-compile-fortran-run-and-check-generic

offload/test/offloading/fortran/declare-target-vars-in-target-region.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
! Offloading test with a target region mapping a declare target
2-
! Fortran array writing some values to it and checking the host
3-
! correctly receives the updates made on the device.
1+
! Offloading test with a target region mapping a declare target Fortran array
2+
! writing some values to it and checking the host correctly receives the
3+
! updates made on the device.
44
! REQUIRES: flang, amdgpu
55

66
! RUN: %libomptarget-compile-fortran-run-and-check-generic

offload/test/offloading/fortran/double-target-call-with-declare-target.f90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
! Offloading test with two target regions mapping the same
2-
! declare target Fortran array and writing some values to
3-
! it before checking the host correctly receives the
4-
! correct updates made on the device.
1+
! Offloading test with two target regions mapping the same declare target
2+
! Fortran array and writing some values to it before checking the host
3+
! correctly receives the correct updates made on the device.
54
! REQUIRES: flang, amdgpu
65

76
! RUN: %libomptarget-compile-fortran-run-and-check-generic

offload/test/offloading/fortran/dtype-array-constant-index-map.f90

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
! Offloading test which maps a specific element of a
2-
! derived type to the device and then accesses the
3-
! element alongside an individual element of an array
4-
! that the derived type contains. In particular, this
5-
! test helps to check that we can replace the constants
6-
! within the kernel with instructions and then replace
7-
! these instructions with the kernel parameters.
8-
! REQUIRES: flang
9-
! UNSUPPORTED: nvptx64-nvidia-cuda
10-
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
11-
! UNSUPPORTED: aarch64-unknown-linux-gnu
12-
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
13-
! UNSUPPORTED: x86_64-unknown-linux-gnu
14-
! UNSUPPORTED: x86_64-unknown-linux-gnu-LTO
1+
! Offloading test which maps a specific element of a derived type to the device
2+
! and then accesses the element alongside an individual element of an array
3+
! that the derived type contains. In particular, this test helps to check that
4+
! we can replace the constants within the kernel with instructions and then
5+
! replace these instructions with the kernel parameters.
6+
! REQUIRES: flang, amdgpu
157

168
! RUN: %libomptarget-compile-fortran-run-and-check-generic
179
module test_0
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
! This test checks a number of more complex derived type member mapping
2+
! syntaxes utilising a non-allocatable parent derived type.
3+
4+
! REQUIRES: flang, amdgpu
5+
6+
! RUN: %libomptarget-compile-fortran-run-and-check-generic
7+
program main
8+
type dtype2
9+
integer int
10+
real float
11+
real float_elements(10)
12+
end type dtype2
13+
14+
type dtype1
15+
character (LEN=30) characters
16+
character (LEN=1) character
17+
type(dtype2) number
18+
end type dtype1
19+
20+
type nonallocatabledtype
21+
integer elements(20)
22+
type(dtype1) num_chars
23+
integer value
24+
type(dtype2) internal_dtypes(5)
25+
end type nonallocatabledtype
26+
27+
type (nonallocatabledtype) array_dtype(5)
28+
29+
!$omp target map(tofrom: array_dtype(5))
30+
do i = 1, 20
31+
array_dtype(5)%elements(i) = 20 + i
32+
end do
33+
34+
array_dtype(5)%num_chars%number%float_elements(5) = 10
35+
array_dtype(5)%value = 40
36+
!$omp end target
37+
38+
print *, array_dtype(5)%elements
39+
print *, array_dtype(5)%num_chars%number%float_elements(5)
40+
print *, array_dtype(5)%value
41+
42+
!$omp target map(tofrom: array_dtype(4)%elements(3))
43+
array_dtype(4)%elements(3) = 74
44+
!$omp end target
45+
46+
print *, array_dtype(4)%elements(3)
47+
48+
!$omp target map(tofrom: array_dtype(5)%elements(3:5))
49+
do i = 3, 5
50+
array_dtype(5)%elements(i) = i + 1
51+
end do
52+
!$omp end target
53+
54+
do i = 3, 5
55+
print *, array_dtype(5)%elements(i)
56+
end do
57+
58+
!$omp target map(tofrom: array_dtype(3:5))
59+
do i = 3, 5
60+
array_dtype(i)%value = i + 2
61+
end do
62+
!$omp end target
63+
64+
do i = 3, 5
65+
print *, array_dtype(i)%value
66+
end do
67+
68+
!$omp target map(tofrom: array_dtype(4)%num_chars%number%float_elements(8))
69+
array_dtype(4)%num_chars%number%float_elements(8) = 250
70+
!$omp end target
71+
72+
print *, array_dtype(4)%num_chars%number%float_elements(8)
73+
74+
!$omp target map(tofrom: array_dtype(4)%num_chars%number%float_elements(5:10))
75+
do i = 5, 10
76+
array_dtype(4)%num_chars%number%float_elements(i) = i + 3
77+
end do
78+
!$omp end target
79+
80+
do i = 5, 10
81+
print *, array_dtype(4)%num_chars%number%float_elements(i)
82+
end do
83+
84+
!$omp target map(tofrom: array_dtype(4)%internal_dtypes(3)%float_elements(4))
85+
array_dtype(4)%internal_dtypes(3)%float_elements(4) = 200
86+
!$omp end target
87+
88+
print *, array_dtype(4)%internal_dtypes(3)%float_elements(4)
89+
90+
end program main
91+
92+
! CHECK: 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
93+
! CHECK: 10.
94+
! CHECK: 40
95+
! CHECK: 74
96+
! CHECK: 4
97+
! CHECK: 5
98+
! CHECK: 6
99+
! CHECK: 5
100+
! CHECK: 6
101+
! CHECK: 7
102+
! CHECK: 250.
103+
! CHECK: 8.
104+
! CHECK: 9.
105+
! CHECK: 10.
106+
! CHECK: 11.
107+
! CHECK: 12.
108+
! CHECK: 13.
109+
! CHECK: 200
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
! This test checks a number of more complex derived type member mapping
2+
! syntaxes utilising an allocatable parent derived type and mixed
3+
! allocatable members.
4+
5+
! REQUIRES: flang, amdgpu
6+
7+
! RUN: %libomptarget-compile-fortran-run-and-check-generic
8+
program main
9+
implicit none
10+
11+
integer :: i
12+
integer :: N1, N2
13+
14+
type :: vertexes
15+
integer :: test
16+
integer :: testarray(10)
17+
integer(4), allocatable :: vertexx(:)
18+
integer(4), allocatable :: vertexy(:)
19+
end type vertexes
20+
21+
type testing_tile_type
22+
TYPE(vertexes) :: field
23+
end type testing_tile_type
24+
25+
type :: dtype
26+
real(4) :: i
27+
type(vertexes), allocatable :: vertexes(:)
28+
TYPE(testing_tile_type), DIMENSION(:), allocatable :: test_tile
29+
integer(4) :: array_i(10)
30+
real(4) :: j
31+
integer, allocatable :: array_j(:)
32+
integer(4) :: k
33+
end type dtype
34+
35+
type(dtype) :: alloca_dtype
36+
type(dtype), DIMENSION(:), allocatable :: alloca_dtype_arr
37+
38+
allocate(alloca_dtype%vertexes(4))
39+
allocate(alloca_dtype%vertexes(1)%vertexx(10))
40+
allocate(alloca_dtype%vertexes(1)%vertexy(10))
41+
allocate(alloca_dtype%vertexes(2)%vertexx(10))
42+
allocate(alloca_dtype%vertexes(2)%vertexy(10))
43+
allocate(alloca_dtype%vertexes(3)%vertexx(10))
44+
allocate(alloca_dtype%vertexes(3)%vertexy(10))
45+
allocate(alloca_dtype%vertexes(4)%vertexx(10))
46+
allocate(alloca_dtype%vertexes(4)%vertexy(10))
47+
allocate(alloca_dtype%test_tile(4))
48+
allocate(alloca_dtype%test_tile(1)%field%vertexx(10))
49+
allocate(alloca_dtype%test_tile(1)%field%vertexy(10))
50+
allocate(alloca_dtype%test_tile(2)%field%vertexx(10))
51+
allocate(alloca_dtype%test_tile(2)%field%vertexy(10))
52+
allocate(alloca_dtype%test_tile(3)%field%vertexx(10))
53+
allocate(alloca_dtype%test_tile(3)%field%vertexy(10))
54+
allocate(alloca_dtype%test_tile(4)%field%vertexx(10))
55+
allocate(alloca_dtype%test_tile(4)%field%vertexy(10))
56+
57+
allocate(alloca_dtype_arr(3))
58+
59+
N1 = 1
60+
N2 = 2
61+
62+
!$omp target map(tofrom: alloca_dtype%vertexes(N1)%test)
63+
alloca_dtype%vertexes(N1)%test = 3
64+
!$omp end target
65+
66+
print *, alloca_dtype%vertexes(N1)%test
67+
68+
!$omp target map(tofrom: alloca_dtype%vertexes(N1)%test, alloca_dtype%vertexes(N2)%test)
69+
alloca_dtype%vertexes(N1)%test = 5
70+
alloca_dtype%vertexes(N2)%test = 10
71+
!$omp end target
72+
73+
print *, alloca_dtype%vertexes(N1)%test
74+
print *, alloca_dtype%vertexes(N2)%test
75+
76+
!$omp target map(tofrom: alloca_dtype%test_tile(N1)%field%vertexx, &
77+
!$omp alloca_dtype%test_tile(N1)%field%vertexy)
78+
do i = 1, 10
79+
alloca_dtype%test_tile(N1)%field%vertexx(i) = i + 4
80+
alloca_dtype%test_tile(N1)%field%vertexy(i) = i + 4
81+
end do
82+
!$omp end target
83+
84+
print *, alloca_dtype%test_tile(N1)%field%vertexx
85+
print *, alloca_dtype%test_tile(N1)%field%vertexy
86+
87+
!$omp target map(tofrom: alloca_dtype%test_tile(N1)%field%test, &
88+
!$omp alloca_dtype%test_tile(N2)%field%test, &
89+
!$omp alloca_dtype%test_tile(N1)%field%vertexy, &
90+
!$omp alloca_dtype%test_tile(N2)%field%vertexy)
91+
alloca_dtype%test_tile(N2)%field%test = 9999
92+
alloca_dtype%test_tile(N2)%field%vertexy(2) = 9998
93+
alloca_dtype%test_tile(N1)%field%test = 9997
94+
alloca_dtype%test_tile(N1)%field%vertexy(2) = 9996
95+
!$omp end target
96+
97+
print *, alloca_dtype%test_tile(N1)%field%test
98+
print *, alloca_dtype%test_tile(N2)%field%test
99+
print *, alloca_dtype%test_tile(N1)%field%vertexy(2)
100+
print *, alloca_dtype%test_tile(N2)%field%vertexy(2)
101+
102+
!$omp target map(tofrom: alloca_dtype%test_tile(N2)%field%vertexy)
103+
alloca_dtype%test_tile(N2)%field%vertexy(2) = 2000
104+
!$omp end target
105+
106+
!$omp target map(tofrom: alloca_dtype%vertexes(N1)%vertexx, &
107+
!$omp alloca_dtype%vertexes(N1)%vertexy, &
108+
!$omp alloca_dtype%vertexes(N2)%vertexx, &
109+
!$omp alloca_dtype%vertexes(N2)%vertexy)
110+
do i = 1, 10
111+
alloca_dtype%vertexes(N1)%vertexx(i) = i * 2
112+
alloca_dtype%vertexes(N1)%vertexy(i) = i * 2
113+
alloca_dtype%vertexes(N2)%vertexx(i) = i * 2
114+
alloca_dtype%vertexes(N2)%vertexy(i) = i * 2
115+
end do
116+
!$omp end target
117+
118+
print *, alloca_dtype%vertexes(N1)%vertexx
119+
print *, alloca_dtype%vertexes(N1)%vertexy
120+
print *, alloca_dtype%vertexes(N2)%vertexx
121+
print *, alloca_dtype%vertexes(N2)%vertexy
122+
123+
!$omp target map(tofrom: alloca_dtype%vertexes(N1)%vertexx, &
124+
!$omp alloca_dtype%vertexes(N1)%vertexy, &
125+
!$omp alloca_dtype%vertexes(4)%vertexy, &
126+
!$omp alloca_dtype%vertexes(4)%vertexx, &
127+
!$omp alloca_dtype%vertexes(N2)%vertexx, &
128+
!$omp alloca_dtype%vertexes(N2)%vertexy)
129+
do i = 1, 10
130+
alloca_dtype%vertexes(N1)%vertexx(i) = i * 3
131+
alloca_dtype%vertexes(N1)%vertexy(i) = i * 3
132+
alloca_dtype%vertexes(4)%vertexx(i) = i * 3
133+
alloca_dtype%vertexes(4)%vertexy(i) = i * 3
134+
alloca_dtype%vertexes(N2)%vertexx(i) = i * 3
135+
alloca_dtype%vertexes(N2)%vertexy(i) = i * 3
136+
end do
137+
!$omp end target
138+
139+
140+
print *, alloca_dtype%vertexes(1)%vertexx
141+
print *, alloca_dtype%vertexes(1)%vertexy
142+
print *, alloca_dtype%vertexes(4)%vertexx
143+
print *, alloca_dtype%vertexes(4)%vertexy
144+
print *, alloca_dtype%vertexes(2)%vertexx
145+
print *, alloca_dtype%vertexes(2)%vertexy
146+
147+
!$omp target map(tofrom: alloca_dtype_arr(N2)%array_i)
148+
do i = 1, 10
149+
alloca_dtype_arr(N2)%array_i(i) = i + 2
150+
end do
151+
!$omp end target
152+
153+
print *, alloca_dtype_arr(N2)%array_i
154+
155+
end program main
156+
157+
! CHECK: 3
158+
! CHECK: 5
159+
! CHECK: 10
160+
! CHECK: 5 6 7 8 9 10 11 12 13 14
161+
! CHECK: 5 6 7 8 9 10 11 12 13 14
162+
! CHECK: 9997
163+
! CHECK: 9999
164+
! CHECK: 9996
165+
! CHECK: 9998
166+
! CHECK: 2 4 6 8 10 12 14 16 18 20
167+
! CHECK: 2 4 6 8 10 12 14 16 18 20
168+
! CHECK: 2 4 6 8 10 12 14 16 18 20
169+
! CHECK: 2 4 6 8 10 12 14 16 18 20
170+
! CHECK: 3 6 9 12 15 18 21 24 27 30
171+
! CHECK: 3 6 9 12 15 18 21 24 27 30
172+
! CHECK: 3 6 9 12 15 18 21 24 27 30
173+
! CHECK: 3 6 9 12 15 18 21 24 27 30
174+
! CHECK: 3 6 9 12 15 18 21 24 27 30
175+
! CHECK: 3 6 9 12 15 18 21 24 27 30
176+
! CHECK: 3 4 5 6 7 8 9 10 11 12

offload/test/offloading/fortran/dump_map_tables.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
! Offloading test with runtine call to ompx_dump_mapping_tables
2-
! Fortran array writing some values and printing the variable mapped to device
3-
! correctly receives the updates made on the device.
1+
! Offloading test with runtine call to ompx_dump_mapping_tables Fortran array
2+
! writing some values and printing the variable mapped to device correctly
3+
! receives the updates made on the device.
44
! REQUIRES: flang
55
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
66
! UNSUPPORTED: aarch64-unknown-linux-gnu

0 commit comments

Comments
 (0)