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
1352913529def err_acc_invalid_default_type
1353013530 : Error<"invalid value %0 in '%1' clause; valid values are %2">;
1353113531def 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 "
1353313533 "one architecture">;
1353413534def warn_acc_var_referenced_non_const_array
1353513535 : 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(
10541054OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceTypeClause (
10551055 SemaOpenACC::OpenACCParsedClause &Clause) {
10561056
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) &&
10611064 Clause.getDeviceTypeArchitectures ().size () > 1 ) {
10621065 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 ();
10641068 return nullptr ;
10651069 }
10661070
Original file line number Diff line number Diff line change @@ -11,12 +11,8 @@ void acc_init(int cond) {
1111 // CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<star>]}
1212#pragma acc init device_type(nvidia)
1313 // 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>]}
1614#pragma acc init device_type(NVIDIA)
1715 // 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>]}
2016#pragma acc init device_type(HoSt) device_type(MuLtIcORe)
2117 // CHECK-NEXT: acc.init attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
2218
Original file line number Diff line number Diff line change @@ -11,12 +11,8 @@ void acc_shutdown(int cond) {
1111 // CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<star>]}
1212#pragma acc shutdown device_type(nvidia)
1313 // 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>]}
1614#pragma acc shutdown device_type(NVIDIA)
1715 // 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>]}
2016#pragma acc shutdown device_type(HoSt) device_type(MuLtIcORe)
2117 // CHECK-NEXT: acc.shutdown attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
2218
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ void uses() {
3434 // expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}}
3535 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
3636#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)
3743}
3844
3945template <typename T>
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ void uses() {
3434 // expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}}
3535 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
3636#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)
3743}
3844
3945template <typename T>
You can’t perform that action at this time.
0 commit comments