1 // Check that omp tile (introduced in OpenMP 5.1) is permitted and behaves when
2 // strictly nested within omp target.
4 // RUN: %libomptarget-compile-generic -fopenmp-version=51
5 // RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic
15 int order
[I_NTILES
][J_NTILES
][I_NELEMS
][J_NELEMS
];
17 #pragma omp target map(tofrom: i, j)
20 #pragma omp tile sizes(I_NELEMS, J_NELEMS)
21 for (i
= 0; i
< I_NTILES
* I_NELEMS
; ++i
) {
22 for (j
= 0; j
< J_NTILES
* J_NELEMS
; ++j
) {
23 int iTile
= i
/ I_NELEMS
;
24 int jTile
= j
/ J_NELEMS
;
25 int iElem
= i
% I_NELEMS
;
26 int jElem
= j
% J_NELEMS
;
27 order
[iTile
][jTile
][iElem
][jElem
] = next
++;
32 for (int iTile
= 0; iTile
< I_NTILES
; ++iTile
) {
33 for (int jTile
= 0; jTile
< J_NTILES
; ++jTile
) {
34 for (int iElem
= 0; iElem
< I_NELEMS
; ++iElem
) {
35 for (int jElem
= 0; jElem
< J_NELEMS
; ++jElem
) {
36 int actual
= order
[iTile
][jTile
][iElem
][jElem
];
37 if (expected
!= actual
) {
38 printf("error: order[%d][%d][%d][%d] = %d, expected %d\n",
39 iTile
, jTile
, iElem
, jElem
, actual
, expected
);
47 // Tiling leaves the loop variables with their values from the final iteration
48 // rather than with the usual +1.
49 expected
= I_NTILES
* I_NELEMS
- 1;
51 printf("error: i = %d, expected %d\n", i
, expected
);
54 expected
= J_NTILES
* J_NELEMS
- 1;
56 printf("error: j = %d, expected %d\n", j
, expected
);