| 1 |
#pragma omp declare target |
| 2 |
|
| 3 |
__attribute__ ((noipa)) |
| 4 |
int |
| 5 |
gfx900 (void) |
| 6 |
{ |
| 7 |
return 0x900; |
| 8 |
} |
| 9 |
|
| 10 |
__attribute__ ((noipa)) |
| 11 |
int |
| 12 |
gfx906 (void) |
| 13 |
{ |
| 14 |
return 0x906; |
| 15 |
} |
| 16 |
|
| 17 |
__attribute__ ((noipa)) |
| 18 |
int |
| 19 |
gfx908 (void) |
| 20 |
{ |
| 21 |
return 0x908; |
| 22 |
} |
| 23 |
|
| 24 |
__attribute__ ((noipa)) |
| 25 |
int |
| 26 |
gfx90a (void) |
| 27 |
{ |
| 28 |
return 0x90a; |
| 29 |
} |
| 30 |
|
| 31 |
__attribute__ ((noipa)) |
| 32 |
int |
| 33 |
gfx90c (void) |
| 34 |
{ |
| 35 |
return 0x90c; |
| 36 |
} |
| 37 |
|
| 38 |
__attribute__ ((noipa)) |
| 39 |
int |
| 40 |
gfx1030 (void) |
| 41 |
{ |
| 42 |
return 0x1030; |
| 43 |
} |
| 44 |
|
| 45 |
__attribute__ ((noipa)) |
| 46 |
int |
| 47 |
gfx1036 (void) |
| 48 |
{ |
| 49 |
return 0x1036; |
| 50 |
} |
| 51 |
|
| 52 |
__attribute__ ((noipa)) |
| 53 |
int |
| 54 |
gfx1100 (void) |
| 55 |
{ |
| 56 |
return 0x1100; |
| 57 |
} |
| 58 |
|
| 59 |
__attribute__ ((noipa)) |
| 60 |
int |
| 61 |
gfx1103 (void) |
| 62 |
{ |
| 63 |
return 0x1103; |
| 64 |
} |
| 65 |
|
| 66 |
#pragma omp declare variant(gfx900) match(device = {isa("gfx900")}) |
| 67 |
#pragma omp declare variant(gfx906) match(device = {isa("gfx906")}) |
| 68 |
#pragma omp declare variant(gfx908) match(device = {isa("gfx908")}) |
| 69 |
#pragma omp declare variant(gfx90a) match(device = {isa("gfx90a")}) |
| 70 |
#pragma omp declare variant(gfx90c) match(device = {isa("gfx90c")}) |
| 71 |
#pragma omp declare variant(gfx1030) match(device = {isa("gfx1030")}) |
| 72 |
#pragma omp declare variant(gfx1036) match(device = {isa("gfx1036")}) |
| 73 |
#pragma omp declare variant(gfx1100) match(device = {isa("gfx1100")}) |
| 74 |
#pragma omp declare variant(gfx1103) match(device = {isa("gfx1103")}) |
| 75 |
__attribute__ ((noipa)) |
| 76 |
int |
| 77 |
f (void) |
| 78 |
{ |
| 79 |
return 0; |
| 80 |
} |
| 81 |
|
| 82 |
#pragma omp end declare target |
| 83 |
|
| 84 |
int |
| 85 |
main (void) |
| 86 |
{ |
| 87 |
int v = 0; |
| 88 |
|
| 89 |
#pragma omp target map(from : v) |
| 90 |
v = f (); |
| 91 |
|
| 92 |
#ifdef OFFLOAD_DEVICE_GCN |
| 93 |
if (v == 0) |
| 94 |
__builtin_abort (); |
| 95 |
|
| 96 |
__builtin_printf ("AMDGCN accelerator: gfx%x\n", v); |
| 97 |
#else |
| 98 |
if (v != 0) |
| 99 |
__builtin_abort (); |
| 100 |
#endif |
| 101 |
|
| 102 |
return 0; |
| 103 |
} |