This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch,openacc] use firstprivate pointers for subarrays in c and c++
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Cesar Philippidis <cesar at codesourcery dot com>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 1 Jun 2016 19:52:47 +0200
- Subject: Re: [patch,openacc] use firstprivate pointers for subarrays in c and c++
- Authentication-results: sourceware.org; auth=none
- References: <573244BE dot 5010708 at codesourcery dot com> <20160520094231 dot GF28550 at tucnak dot redhat dot com> <5743BD19 dot 4090708 at codesourcery dot com> <20160524060955 dot GB28550 at tucnak dot redhat dot com> <5744A893 dot 3040204 at codesourcery dot com> <87d1ozxr8l dot fsf at hertz dot schwinge dot homeip dot net> <20160524192209 dot GR28550 at tucnak dot redhat dot com> <8760u2t7vn dot fsf at kepler dot schwinge dot homeip dot net> <574F1C6C dot 5020704 at codesourcery dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Jun 01, 2016 at 10:33:32AM -0700, Cesar Philippidis wrote:
> >> switch (OMP_CLAUSE_MAP_KIND (c))
> >> {
> >> case GOMP_MAP_ALLOC:
> > | case GOMP_MAP_TO:
> > | case GOMP_MAP_FROM:
> > | case GOMP_MAP_TOFROM:
> > | case GOMP_MAP_ALWAYS_TO:
> > | case GOMP_MAP_ALWAYS_FROM:
> > | case GOMP_MAP_ALWAYS_TOFROM:
> > | case GOMP_MAP_RELEASE:
> > | case GOMP_MAP_DELETE:
> > | OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION (c) = 1;
> > | break;
> > | default:
> >> break;
> >> }
> >
> > Why doesn't that apply also to the other (OpenACC) map kinds? Comparing
> > to the full list in include/gomp-constants.h:enum gomp_map_kind, there
> > are several missing here.
>
> It does look like there are situations where OpenACC can take
> zero-length arrays, e.g. when the length argument is a variable. This
> will be fixed in my follow up patch.
The question is if you need/want the OpenMP 4.5 mandated handling of zero length
array sections for those, where mapping of zero length array section (unlike
e.g. GNU extension zero length object) doesn't actually map it if not
already mapped, but sets the corresponding pointer to NULL. If already
mapped, it increments refcount.
> >> @@ -6054,7 +6070,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
> >> omp_note_field_privatization (t, OMP_CLAUSE_DECL (c));
> >> else
> >> t = OMP_CLAUSE_DECL (c);
> >> - if (t == current_class_ptr)
> >> + if (ort != C_ORT_ACC && t == current_class_ptr)
> >> {
> >> error ("%<this%> allowed in OpenMP only in %<declare simd%>"
> >> " clauses");
> >
> > ;-) Hmm, reminds me of the unresolved task to support the C++ "this"
> > pointer in OpenACC... Anyway, in GCC trunk, we're not allowing "this"
> > usage, I think, so I suppose this should stay as-is? (Possibly with an
> > OpenACC-specific error message.)
>
> What do you want to do about c++'s 'this' in OpenACC? It looks like
> gomp4 partially supports it. Maybe we should wait to get clarification
> from the technical committee?
In OpenMP 4.5 it is only allowed in declare simd clauses, but that might
change in OpenMP 5.0.
Jakub