File tree Expand file tree Collapse file tree 6 files changed +22
-14
lines changed Expand file tree Collapse file tree 6 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -13529,7 +13529,7 @@ def err_acc_invalid_modifier
13529
13529
def err_acc_invalid_default_type
13530
13530
: Error<"invalid value %0 in '%1' clause; valid values are %2">;
13531
13531
def err_acc_device_type_multiple_archs
13532
- : Error<"OpenACC 'device_type' clause on a 'set ' construct only permits "
13532
+ : Error<"OpenACC 'device_type' clause on a '%0 ' construct only permits "
13533
13533
"one architecture">;
13534
13534
def warn_acc_var_referenced_non_const_array
13535
13535
: Warning<"variable of array type %0 referenced in OpenACC '%1' clause "
Original file line number Diff line number Diff line change @@ -1054,13 +1054,17 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitWaitClause(
1054
1054
OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceTypeClause (
1055
1055
SemaOpenACC::OpenACCParsedClause &Clause) {
1056
1056
1057
- // Based on discussions, having more than 1 'architecture' on a 'set' is
1058
- // nonsensical, so we're going to fix the standard to reflect this. Implement
1059
- // the limitation, since the Dialect requires this.
1060
- if (Clause.getDirectiveKind () == OpenACCDirectiveKind::Set &&
1057
+ // OpenACC Pull #550 (https://github.com/OpenACC/openacc-spec/pull/550)
1058
+ // clarified that Init, Shutdown, and Set only support a single architecture.
1059
+ // Though the dialect only requires it for 'set' as far as we know, we'll just
1060
+ // implement all 3 here.
1061
+ if ((Clause.getDirectiveKind () == OpenACCDirectiveKind::Init ||
1062
+ Clause.getDirectiveKind () == OpenACCDirectiveKind::Shutdown ||
1063
+ Clause.getDirectiveKind () == OpenACCDirectiveKind::Set) &&
1061
1064
Clause.getDeviceTypeArchitectures ().size () > 1 ) {
1062
1065
SemaRef.Diag (Clause.getDeviceTypeArchitectures ()[1 ].getLoc (),
1063
- diag::err_acc_device_type_multiple_archs);
1066
+ diag::err_acc_device_type_multiple_archs)
1067
+ << Clause.getDirectiveKind ();
1064
1068
return nullptr ;
1065
1069
}
1066
1070
Original file line number Diff line number Diff line change @@ -11,12 +11,8 @@ void acc_init(int cond) {
11
11
// CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<star>]}
12
12
#pragma acc init device_type(nvidia)
13
13
// CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<nvidia>]}
14
- #pragma acc init device_type(host, multicore)
15
- // CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
16
14
#pragma acc init device_type(NVIDIA)
17
15
// CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<nvidia>]}
18
- #pragma acc init device_type(HoSt, MuLtIcORe)
19
- // CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
20
16
#pragma acc init device_type(HoSt) device_type(MuLtIcORe)
21
17
// CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
22
18
Original file line number Diff line number Diff line change @@ -11,12 +11,8 @@ void acc_shutdown(int cond) {
11
11
// CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<star>]}
12
12
#pragma acc shutdown device_type(nvidia)
13
13
// CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<nvidia>]}
14
- #pragma acc shutdown device_type(host, multicore)
15
- // CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
16
14
#pragma acc shutdown device_type(NVIDIA)
17
15
// CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<nvidia>]}
18
- #pragma acc shutdown device_type(HoSt, MuLtIcORe)
19
- // CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
20
16
#pragma acc shutdown device_type(HoSt) device_type(MuLtIcORe)
21
17
// CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
22
18
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ void uses() {
34
34
// expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}}
35
35
// expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
36
36
#pragma acc init device_num(Explicit)
37
+
38
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'init' construct only permits one architecture}}
39
+ #pragma acc init device_type(nvidia, radeon)
40
+
41
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'init' construct only permits one architecture}}
42
+ #pragma acc init device_type(nonsense, nvidia, radeon)
37
43
}
38
44
39
45
template <typename T>
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ void uses() {
34
34
// expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}}
35
35
// expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
36
36
#pragma acc shutdown device_num(Explicit)
37
+
38
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'shutdown' construct only permits one architecture}}
39
+ #pragma acc shutdown device_type(nvidia, radeon)
40
+
41
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'shutdown' construct only permits one architecture}}
42
+ #pragma acc shutdown device_type(nonsense, nvidia, radeon)
37
43
}
38
44
39
45
template <typename T>
You can’t perform that action at this time.
0 commit comments