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
This commit is contained in:
Jakub Jelinek 2016-05-30 23:36:24 +02:00 committed by Jakub Jelinek
parent c8743fc5e5
commit 00631022d8
8 changed files with 62 additions and 15 deletions

View File

@ -1,3 +1,11 @@
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>
PR middle-end/70434

View File

@ -983,6 +983,7 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
case OMP_CLAUSE_MAP:
case OMP_CLAUSE_IS_DEVICE_PTR:
case OMP_CLAUSE_DEFAULTMAP:
case OMP_CLAUSE_DEPEND:
s = C_OMP_CLAUSE_SPLIT_TARGET;
break;
case OMP_CLAUSE_NUM_TEAMS:
@ -998,7 +999,6 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
s = C_OMP_CLAUSE_SPLIT_PARALLEL;
break;
case OMP_CLAUSE_ORDERED:
case OMP_CLAUSE_NOWAIT:
s = C_OMP_CLAUSE_SPLIT_FOR;
break;
case OMP_CLAUSE_SCHEDULE:
@ -1333,6 +1333,18 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
else
s = C_OMP_CLAUSE_SPLIT_FOR;
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:
gcc_unreachable ();
}

View File

@ -1,3 +1,9 @@
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>
* c-parser.c (c_parser_omp_clause_schedule): Warn if

View File

@ -15113,7 +15113,9 @@ c_parser_omp_for (location_t loc, c_parser *parser,
strcat (p_name, " for");
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);
/* Composite distribute parallel for{, simd} disallows ordered clause. */
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) != 0)

View File

@ -1,3 +1,11 @@
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>
PR c++/71238

View File

@ -33919,7 +33919,9 @@ cp_parser_omp_for (cp_parser *parser, cp_token *pragma_tok,
strcat (p_name, " for");
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);
/* Composite distribute parallel for{, simd} disallows ordered clause. */
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,
}
}
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)
{
cp_omp_split_clauses (loc, OMP_PARALLEL, mask, clauses, cclauses);

View File

@ -1,3 +1,9 @@
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>
PR c++/71238

View File

@ -34,7 +34,7 @@ foo (int d, int m, int i1, int i2, int p, int *idp, int s,
void
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 \
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,
}
#pragma omp target parallel \
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 \
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) \
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++)
ll++;
#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) \
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) \
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++)
ll++;
#pragma omp target teams \
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 \
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) \
collapse(1) dist_schedule(static, 16)
collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0])
for (int i = 0; i < 64; i++)
;
#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,
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) \
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++)
ll++;
#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,
collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
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++)
ll++;
#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) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
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++)
ll++;
#pragma omp target simd \
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++)
ll++;
#pragma omp taskloop simd \
@ -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)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target
#pragma omp target nowait depend(inout: dd[0])
#pragma omp teams distribute \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16)