Commit 00631022 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/71349 (Combined async target clause parsing issues)

	PR c++/71349
	* c-parser.c (c_parser_omp_for): Don't disallow nowait clause
	when combined with target construct.

	* parser.c (cp_parser_omp_for): Don't disallow nowait clause
	when combined with target construct.
	(cp_parser_omp_parallel): Pass cclauses == NULL as last argument
	to cp_parser_omp_all_clauses.

	* c-omp.c (c_omp_split_clauses): Put OMP_CLAUSE_DEPEND to
	C_OMP_CLAUSE_SPLIT_TARGET.  Put OMP_CLAUSE_NOWAIT to
	C_OMP_CLAUSE_SPLIT_TARGET if combined with target construct,
	instead of C_OMP_CLAUSE_SPLIT_FOR.

	* c-c++-common/gomp/clauses-1.c (bar): Add dd argument.  Add
	nowait depend(inout: dd[0]) clauses where permitted.

From-SVN: r236900
parent c8743fc5
2016-05-30 Jakub Jelinek <jakub@redhat.com>
PR c++/71349
* c-omp.c (c_omp_split_clauses): Put OMP_CLAUSE_DEPEND to
C_OMP_CLAUSE_SPLIT_TARGET. Put OMP_CLAUSE_NOWAIT to
C_OMP_CLAUSE_SPLIT_TARGET if combined with target construct,
instead of C_OMP_CLAUSE_SPLIT_FOR.
2016-05-24 Richard Biener <rguenther@suse.de> 2016-05-24 Richard Biener <rguenther@suse.de>
PR middle-end/70434 PR middle-end/70434
......
...@@ -983,6 +983,7 @@ c_omp_split_clauses (location_t loc, enum tree_code code, ...@@ -983,6 +983,7 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
case OMP_CLAUSE_MAP: case OMP_CLAUSE_MAP:
case OMP_CLAUSE_IS_DEVICE_PTR: case OMP_CLAUSE_IS_DEVICE_PTR:
case OMP_CLAUSE_DEFAULTMAP: case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE_DEPEND:
s = C_OMP_CLAUSE_SPLIT_TARGET; s = C_OMP_CLAUSE_SPLIT_TARGET;
break; break;
case OMP_CLAUSE_NUM_TEAMS: case OMP_CLAUSE_NUM_TEAMS:
...@@ -998,7 +999,6 @@ c_omp_split_clauses (location_t loc, enum tree_code code, ...@@ -998,7 +999,6 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
s = C_OMP_CLAUSE_SPLIT_PARALLEL; s = C_OMP_CLAUSE_SPLIT_PARALLEL;
break; break;
case OMP_CLAUSE_ORDERED: case OMP_CLAUSE_ORDERED:
case OMP_CLAUSE_NOWAIT:
s = C_OMP_CLAUSE_SPLIT_FOR; s = C_OMP_CLAUSE_SPLIT_FOR;
break; break;
case OMP_CLAUSE_SCHEDULE: case OMP_CLAUSE_SCHEDULE:
...@@ -1333,6 +1333,18 @@ c_omp_split_clauses (location_t loc, enum tree_code code, ...@@ -1333,6 +1333,18 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
else else
s = C_OMP_CLAUSE_SPLIT_FOR; s = C_OMP_CLAUSE_SPLIT_FOR;
break; break;
case OMP_CLAUSE_NOWAIT:
/* Nowait clause is allowed on target, for and sections, but
is not allowed on parallel for or parallel sections. Therefore,
put it on target construct if present, because that can only
be combined with parallel for{, simd} and not with for{, simd},
otherwise to the worksharing construct. */
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP))
!= 0)
s = C_OMP_CLAUSE_SPLIT_TARGET;
else
s = C_OMP_CLAUSE_SPLIT_FOR;
break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
......
2016-05-30 Jakub Jelinek <jakub@redhat.com>
PR c++/71349
* c-parser.c (c_parser_omp_for): Don't disallow nowait clause
when combined with target construct.
2016-05-26 Jakub Jelinek <jakub@redhat.com> 2016-05-26 Jakub Jelinek <jakub@redhat.com>
* c-parser.c (c_parser_omp_clause_schedule): Warn if * c-parser.c (c_parser_omp_clause_schedule): Warn if
......
...@@ -15113,7 +15113,9 @@ c_parser_omp_for (location_t loc, c_parser *parser, ...@@ -15113,7 +15113,9 @@ c_parser_omp_for (location_t loc, c_parser *parser,
strcat (p_name, " for"); strcat (p_name, " for");
mask |= OMP_FOR_CLAUSE_MASK; mask |= OMP_FOR_CLAUSE_MASK;
if (cclauses) /* parallel for{, simd} disallows nowait clause, but for
target {teams distribute ,}parallel for{, simd} it should be accepted. */
if (cclauses && (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP)) == 0)
mask &= ~(OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT); mask &= ~(OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT);
/* Composite distribute parallel for{, simd} disallows ordered clause. */ /* Composite distribute parallel for{, simd} disallows ordered clause. */
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0) if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0)
......
2016-05-30 Jakub Jelinek <jakub@redhat.com>
PR c++/71349
* parser.c (cp_parser_omp_for): Don't disallow nowait clause
when combined with target construct.
(cp_parser_omp_parallel): Pass cclauses == NULL as last argument
to cp_parser_omp_all_clauses.
2016-05-30 Paolo Carlini <paolo.carlini@oracle.com> 2016-05-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71238 PR c++/71238
......
...@@ -33919,7 +33919,9 @@ cp_parser_omp_for (cp_parser *parser, cp_token *pragma_tok, ...@@ -33919,7 +33919,9 @@ cp_parser_omp_for (cp_parser *parser, cp_token *pragma_tok,
strcat (p_name, " for"); strcat (p_name, " for");
mask |= OMP_FOR_CLAUSE_MASK; mask |= OMP_FOR_CLAUSE_MASK;
if (cclauses) /* parallel for{, simd} disallows nowait clause, but for
target {teams distribute ,}parallel for{, simd} it should be accepted. */
if (cclauses && (mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP)) == 0)
mask &= ~(OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT); mask &= ~(OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT);
/* Composite distribute parallel for{, simd} disallows ordered clause. */ /* Composite distribute parallel for{, simd} disallows ordered clause. */
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0) if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0)
...@@ -34258,7 +34260,8 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok, ...@@ -34258,7 +34260,8 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok,
} }
} }
clauses = cp_parser_omp_all_clauses (parser, mask, p_name, pragma_tok); clauses = cp_parser_omp_all_clauses (parser, mask, p_name, pragma_tok,
cclauses == NULL);
if (cclauses) if (cclauses)
{ {
cp_omp_split_clauses (loc, OMP_PARALLEL, mask, clauses, cclauses); cp_omp_split_clauses (loc, OMP_PARALLEL, mask, clauses, cclauses);
2016-05-30 Jakub Jelinek <jakub@redhat.com>
PR c++/71349
* c-c++-common/gomp/clauses-1.c (bar): Add dd argument. Add
nowait depend(inout: dd[0]) clauses where permitted.
2016-05-30 Paolo Carlini <paolo.carlini@oracle.com> 2016-05-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71238 PR c++/71238
......
...@@ -34,7 +34,7 @@ foo (int d, int m, int i1, int i2, int p, int *idp, int s, ...@@ -34,7 +34,7 @@ foo (int d, int m, int i1, int i2, int p, int *idp, int s,
void void
bar (int d, int m, int i1, int i2, int p, int *idp, int s, bar (int d, int m, int i1, int i2, int p, int *idp, int s,
int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q) int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd)
{ {
#pragma omp for simd \ #pragma omp for simd \
private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait \ private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait \
...@@ -63,29 +63,30 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s, ...@@ -63,29 +63,30 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s,
} }
#pragma omp target parallel \ #pragma omp target parallel \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
nowait depend(inout: dd[0])
; ;
#pragma omp target parallel for \ #pragma omp target parallel for \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
ll++; ll++;
#pragma omp target parallel for simd \ #pragma omp target parallel for simd \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \ if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) \ lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) \
safelen(8) simdlen(4) aligned(q: 32) safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
ll++; ll++;
#pragma omp target teams \ #pragma omp target teams \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0])
; ;
#pragma omp target teams distribute \ #pragma omp target teams distribute \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
; ;
#pragma omp target teams distribute parallel for \ #pragma omp target teams distribute parallel for \
...@@ -93,7 +94,7 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s, ...@@ -93,7 +94,7 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s,
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) \ collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \ if (parallel: i2) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) lastprivate (l) schedule(static, 4) nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
ll++; ll++;
#pragma omp target teams distribute parallel for simd \ #pragma omp target teams distribute parallel for simd \
...@@ -102,19 +103,20 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s, ...@@ -102,19 +103,20 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s,
collapse(1) dist_schedule(static, 16) \ collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \ if (parallel: i2) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) \ lastprivate (l) schedule(static, 4) \
safelen(8) simdlen(4) aligned(q: 32) safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
ll++; ll++;
#pragma omp target teams distribute simd \ #pragma omp target teams distribute simd \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) \ collapse(1) dist_schedule(static, 16) \
safelen(8) simdlen(4) aligned(q: 32) safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
ll++; ll++;
#pragma omp target simd \ #pragma omp target simd \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \ device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
safelen(8) simdlen(4) lastprivate (l) linear(ll: 1) aligned(q: 32) reduction(+:r) safelen(8) simdlen(4) lastprivate (l) linear(ll: 1) aligned(q: 32) reduction(+:r) \
nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
ll++; ll++;
#pragma omp taskloop simd \ #pragma omp taskloop simd \
...@@ -128,7 +130,7 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s, ...@@ -128,7 +130,7 @@ bar (int d, int m, int i1, int i2, int p, int *idp, int s,
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(+:r) safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(+:r)
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
ll++; ll++;
#pragma omp target #pragma omp target nowait depend(inout: dd[0])
#pragma omp teams distribute \ #pragma omp teams distribute \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \ private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) collapse(1) dist_schedule(static, 16)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment