diff options
author | Julian Brown <julian@codesourcery.com> | 2022-10-12 20:44:57 +0000 |
---|---|---|
committer | Julian Brown <julian@codesourcery.com> | 2022-10-14 11:47:38 +0000 |
commit | d4504346d2a1d6ffecb8b2d8e3e04ab8ea259785 (patch) | |
tree | 9f8cd59c4b6f438f2208a31dc2037811e972c327 /gcc | |
parent | 2bccd60658a168138f49578007cb0508deb4f793 (diff) | |
download | gcc-d4504346d2a1d6ffecb8b2d8e3e04ab8ea259785.zip gcc-d4504346d2a1d6ffecb8b2d8e3e04ab8ea259785.tar.gz gcc-d4504346d2a1d6ffecb8b2d8e3e04ab8ea259785.tar.bz2 |
[og12] OpenACC: Don't gang-privatize artificial variables
This patch prevents compiler-generated artificial variables from being
treated as privatization candidates for OpenACC.
The rationale is that e.g. "gang-private" variables actually must be
shared by each worker and vector spawned within a particular gang, but
that sharing is not necessary for any compiler-generated variable (at
least at present, but no such need is anticipated either). Variables on
the stack (and machine registers) are already private per-"thread"
(gang, worker and/or vector), and that's fine for artificial variables.
Several tests need their scan output patterns adjusted to compensate.
2022-10-14 Julian Brown <julian@codesourcery.com>
gcc/
* omp-low.cc (oacc_privatization_candidate_p): Artificial vars are not
privatization candidates.
libgomp/
* testsuite/libgomp.oacc-fortran/declare-1.f90: Adjust scan output.
* testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise.
* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/print-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.omp | 5 | ||||
-rw-r--r-- | gcc/omp-low.cc | 22 |
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index ceed4da..c34d0ec 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,5 +1,10 @@ 2022-10-14 Julian Brown <julian@codesourcery.com> + * omp-low.cc (oacc_privatization_candidate_p): Artificial vars are not + privatization candidates. + +2022-10-14 Julian Brown <julian@codesourcery.com> + * config/gcn/gcn.cc (gcn_detect_incoming_pointer_arg): Any pointer argument forces FLAT addressing mode, not just pointer-to-non-aggregate. diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index d726eea..f171181 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -11400,6 +11400,28 @@ oacc_privatization_candidate_p (const location_t loc, const tree c, } } + /* If an artificial variable has been added to a bind, e.g. + a compiler-generated temporary structure used by the Fortran front-end, do + not consider it as a privatization candidate. Note that variables on + the stack are private per-thread by default: making them "gang-private" + for OpenACC actually means to share a single instance of a variable + amongst all workers and threads spawned within each gang. + At present, no compiler-generated artificial variables require such + sharing semantics, so this is safe. */ + + if (res && DECL_ARTIFICIAL (decl)) + { + res = false; + + if (dump_enabled_p ()) + { + oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl); + dump_printf (l_dump_flags, + "isn%'t candidate for adjusting OpenACC privatization " + "level: %s\n", "artificial"); + } + } + if (res) { if (dump_enabled_p ()) |