| 1 |
// RUN: %clang_cc1 %s -fopenacc -verify |
| 2 |
|
| 3 |
template<unsigned I> |
| 4 |
void TemplUses() { |
| 5 |
|
| 6 |
#pragma acc parallel loop worker |
| 7 |
for(int i = 0; i < 5; ++i); |
| 8 |
|
| 9 |
// expected-error@+1{{expected expression}} |
| 10 |
#pragma acc parallel loop worker() |
| 11 |
for(int i = 0; i < 5; ++i); |
| 12 |
|
| 13 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'parallel loop' construct}} |
| 14 |
#pragma acc parallel loop worker(I) |
| 15 |
for(int i = 0; i < 5; ++i); |
| 16 |
|
| 17 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'parallel loop' construct}} |
| 18 |
#pragma acc parallel loop worker(num:I) |
| 19 |
for(int i = 0; i < 5; ++i); |
| 20 |
|
| 21 |
#pragma acc serial loop worker |
| 22 |
for(int i = 0; i < 5; ++i); |
| 23 |
|
| 24 |
// expected-error@+1{{expected expression}} |
| 25 |
#pragma acc serial loop worker() |
| 26 |
for(int i = 0; i < 5; ++i); |
| 27 |
|
| 28 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'serial loop' construct}} |
| 29 |
#pragma acc serial loop worker(I) |
| 30 |
for(int i = 0; i < 5; ++i); |
| 31 |
|
| 32 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'serial loop' construct}} |
| 33 |
#pragma acc serial loop worker(num:I) |
| 34 |
for(int i = 0; i < 5; ++i); |
| 35 |
|
| 36 |
#pragma acc kernels loop worker(I) |
| 37 |
for(int i = 0; i < 5; ++i); |
| 38 |
|
| 39 |
#pragma acc kernels loop worker(num:I) |
| 40 |
for(int i = 0; i < 5; ++i); |
| 41 |
|
| 42 |
// expected-error@+2{{'num' argument to 'worker' clause not allowed on a 'kernels loop' construct that has a 'num_workers' clause}} |
| 43 |
// expected-note@+1{{previous 'num_workers' clause is here}} |
| 44 |
#pragma acc kernels loop num_workers(1) worker(num:I) |
| 45 |
for(int i = 0; i < 5; ++i); |
| 46 |
|
| 47 |
// expected-error@+2{{'num_workers' clause not allowed on a 'kernels loop' construct that has a 'worker' clause with an argument}} |
| 48 |
// expected-note@+1{{previous 'worker' clause is here}} |
| 49 |
#pragma acc kernels loop worker(num:I) num_workers(1) |
| 50 |
for(int i = 0; i < 5; ++i); |
| 51 |
} |
| 52 |
|
| 53 |
void NormalUses() { |
| 54 |
TemplUses<4>(); |
| 55 |
|
| 56 |
int I; |
| 57 |
#pragma acc parallel loop worker |
| 58 |
for(int i = 0; i < 5; ++i); |
| 59 |
|
| 60 |
// expected-error@+1{{expected expression}} |
| 61 |
#pragma acc parallel loop worker() |
| 62 |
for(int i = 0; i < 5; ++i); |
| 63 |
|
| 64 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'parallel loop' construct}} |
| 65 |
#pragma acc parallel loop worker(I) |
| 66 |
for(int i = 0; i < 5; ++i); |
| 67 |
|
| 68 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'parallel loop' construct}} |
| 69 |
#pragma acc parallel loop worker(num:I) |
| 70 |
for(int i = 0; i < 5; ++i); |
| 71 |
|
| 72 |
#pragma acc serial loop worker |
| 73 |
for(int i = 0; i < 5; ++i); |
| 74 |
|
| 75 |
// expected-error@+1{{expected expression}} |
| 76 |
#pragma acc serial loop worker() |
| 77 |
for(int i = 0; i < 5; ++i); |
| 78 |
|
| 79 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'serial loop' construct}} |
| 80 |
#pragma acc serial loop worker(I) |
| 81 |
for(int i = 0; i < 5; ++i); |
| 82 |
|
| 83 |
// expected-error@+1{{'num' argument on 'worker' clause is not permitted on a 'serial loop' construct}} |
| 84 |
#pragma acc serial loop worker(num:I) |
| 85 |
for(int i = 0; i < 5; ++i); |
| 86 |
|
| 87 |
#pragma acc kernels loop worker(I) |
| 88 |
for(int i = 0; i < 5; ++i); |
| 89 |
|
| 90 |
#pragma acc kernels loop worker(num:I) |
| 91 |
for(int i = 0; i < 5; ++i); |
| 92 |
|
| 93 |
// expected-error@+2{{'num' argument to 'worker' clause not allowed on a 'kernels loop' construct that has a 'num_workers' clause}} |
| 94 |
// expected-note@+1{{previous 'num_workers' clause is here}} |
| 95 |
#pragma acc kernels loop num_workers(1) worker(num:I) |
| 96 |
for(int i = 0; i < 5; ++i); |
| 97 |
|
| 98 |
// expected-error@+2{{'num_workers' clause not allowed on a 'kernels loop' construct that has a 'worker' clause with an argument}} |
| 99 |
// expected-note@+1{{previous 'worker' clause is here}} |
| 100 |
#pragma acc kernels loop worker(num:I) num_workers(1) |
| 101 |
for(int i = 0; i < 5; ++i); |
| 102 |
|
| 103 |
// OK, kernels loop is a new compute construct |
| 104 |
#pragma acc kernels num_workers(1) |
| 105 |
for(int i = 0; i < 5; ++i) { |
| 106 |
#pragma acc kernels loop worker(num:1) |
| 107 |
for(int i = 0; i < 5; ++i); |
| 108 |
} |
| 109 |
#pragma acc kernels loop num_workers(1) |
| 110 |
for(int i = 0; i < 5; ++i) { |
| 111 |
#pragma acc kernels loop worker(num:1) |
| 112 |
for(int i = 0; i < 5; ++i); |
| 113 |
} |
| 114 |
|
| 115 |
#pragma acc kernels loop num_workers(1) |
| 116 |
for(int i = 0; i < 5; ++i) { |
| 117 |
// expected-error@+2{{'num' argument to 'worker' clause not allowed on a 'loop' construct associated with a 'kernels loop' construct that has a 'num_workers' clause}} |
| 118 |
// expected-note@-3{{previous 'num_workers' clause is here}} |
| 119 |
#pragma acc loop worker(num:1) |
| 120 |
for(int i = 0; i < 5; ++i); |
| 121 |
} |
| 122 |
|
| 123 |
#pragma acc parallel loop worker |
| 124 |
for(int i = 0; i < 5; ++i) { |
| 125 |
// expected-error@+4{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}} |
| 126 |
// expected-note@-3{{previous 'worker' clause is here}} |
| 127 |
// expected-error@+2{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}} |
| 128 |
// expected-note@-5{{previous 'worker' clause is here}} |
| 129 |
#pragma acc loop gang, worker, vector |
| 130 |
for(int i = 0; i < 5; ++i); |
| 131 |
} |
| 132 |
#pragma acc kernels loop worker |
| 133 |
for(int i = 0; i < 5; ++i) { |
| 134 |
// expected-error@+4{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}} |
| 135 |
// expected-note@-3{{previous 'worker' clause is here}} |
| 136 |
// expected-error@+2{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}} |
| 137 |
// expected-note@-5{{previous 'worker' clause is here}} |
| 138 |
#pragma acc loop gang, worker, vector |
| 139 |
for(int i = 0; i < 5; ++i); |
| 140 |
} |
| 141 |
#pragma acc serial loop worker |
| 142 |
for(int i = 0; i < 5; ++i) { |
| 143 |
// expected-error@+4{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}} |
| 144 |
// expected-note@-3{{previous 'worker' clause is here}} |
| 145 |
// expected-error@+2{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}} |
| 146 |
// expected-note@-5{{previous 'worker' clause is here}} |
| 147 |
#pragma acc loop gang, worker, vector |
| 148 |
for(int i = 0; i < 5; ++i); |
| 149 |
} |
| 150 |
} |