diff options
author | Cesar Philippidis <cesar@codesourcery.com> | 2017-05-01 18:27:59 -0700 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2021-11-30 12:58:45 +0100 |
commit | 2b7dac2c0dcb087da9e4018943c023c0678234a3 (patch) | |
tree | 6b3aaedcca9f164f344583c5734b28bfb554ff36 /gcc/omp-low.c | |
parent | a83a07557085f6da83c63e86c1cd2e719a39b8b2 (diff) | |
download | gcc-2b7dac2c0dcb087da9e4018943c023c0678234a3.zip gcc-2b7dac2c0dcb087da9e4018943c023c0678234a3.tar.gz gcc-2b7dac2c0dcb087da9e4018943c023c0678234a3.tar.bz2 |
Make OpenACC orphan gang reductions errors
This patch promotes all OpenACC gang reductions on orphan loops as
errors. Accord to the spec, orphan loops are those which are not
lexically nested inside an OpenACC parallel or kernels regions. I.e.,
acc loops inside acc routines.
At first I thought this could be a warning because the gang reduction
finalizer uses an atomic update. However, because there is no
synchronization between gangs, there is way to guarantee that reduction
will have completed once a single gang entity returns from the acc
routine call.
gcc/c/
* c-typeck.c (c_finish_omp_clauses): Emit an error on orphan
OpenACC gang reductions.
gcc/cp/
* semantics.c (finish_omp_clauses): Emit an error on orphan
OpenACC gang reductions.
gcc/fortran/
* openmp.c (oacc_is_parallel, oacc_is_kernels): New 'static'
functions.
(resolve_oacc_loop_blocks): Emit an error on orphan OpenACC gang
reductions.
gcc/
* omp-general.h (enum oacc_loop_flags): Add OLF_REDUCTION enum.
* omp-low.c (lower_oacc_head_mark): Use it to mark OpenACC
reductions.
* omp-offload.c (oacc_loop_auto_partitions): Don't assign gang
level parallelism to orphan reductions.
gcc/testsuite/
* c-c++-common/goacc/nested-reductions-1-routine.c: Adjust.
* c-c++-common/goacc/nested-reductions-2-routine.c: Likewise.
* gcc.dg/goacc/loop-processing-1.c: Likewise.
* gfortran.dg/goacc/nested-reductions-1-routine.f90: Likewise.
* gfortran.dg/goacc/nested-reductions-2-routine.f90: Likewise.
* c-c++-common/goacc/orphan-reductions-1.c: New test.
* c-c++-common/goacc/orphan-reductions-2.c: New test.
* gfortran.dg/goacc/orphan-reductions-1.f90: New test.
* gfortran.dg/goacc/orphan-reductions-2.f90: New test.
libgomp/
* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Temporarily
skip.
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 63a47f6..de3a26e 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -8271,6 +8271,10 @@ lower_oacc_head_mark (location_t loc, tree ddvar, tree clauses, tag |= OLF_TILE; break; + case OMP_CLAUSE_REDUCTION: + tag |= OLF_REDUCTION; + break; + default: continue; } |