1 /* { dg-additional-options "-flto" } */
2 /* { dg-additional-options "-foffload-options=nvptx-none=-misa=sm_35" { target { offload_target_nvptx } } } */
3 /* { dg-additional-sources requires-4-aux.c } */
4
5 /* Check no diagnostic by device-compiler's or host compiler's lto1.
6 Other file uses: 'requires reverse_offload', but that's inactive as
7 there are no declare target directives, device constructs nor device routines */
8
9 /* Depending on offload device capabilities, it may print something like the
10 following (only) if GOMP_DEBUG=1:
11 "devices present but 'omp requires unified_address, unified_shared_memory, reverse_offload' cannot be fulfilled"
12 and in that case does host-fallback execution.
13
14 No offload devices support USM at present, so we may verify host-fallback
15 execution by presence of separate memory spaces. */
16
17 #pragma omp requires unified_address,unified_shared_memory
18
19 int a[10] = { 0 };
20 extern void foo (void);
21
22 int
23 main (void)
24 {
25 #pragma omp target map(to: a)
26 for (int i = 0; i < 10; i++)
27 a[i] = i;
28
29 for (int i = 0; i < 10; i++)
30 if (a[i] != i)
31 __builtin_abort ();
32
33 foo ();
34 return 0;
35 }