[PATCH, OpenACC] Enable GOMP_MAP_FIRSTPRIVATE_INT for OpenACC

Julian Brown julian@codesourcery.com
Thu Dec 6 22:56:00 GMT 2018


On Tue, 4 Dec 2018 15:27:12 +0100
Jakub Jelinek <jakub@redhat.com> wrote:

> On Thu, Sep 20, 2018 at 07:38:04PM -0400, Julian Brown wrote:
> > 2018-09-20  Cesar Philippidis  <cesar@codesourcery.com>
> >             Julian Brown  <julian@codesourcery.com>
> > 
> > 	gcc/
> > 	* omp-low.c (maybe_lookup_field_in_outer_ctx): New function.
> > 	(convert_to_firstprivate_int): New function.
> > 	(convert_from_firstprivate_int): New function.
> > 	(lower_omp_target): Enable GOMP_MAP_FIRSTPRIVATE_INT in
> > OpenACC.
> > 
> > 	libgomp/
> > 	* oacc-parallel.c (GOACC_parallel_keyed): Handle
> > 	GOMP_MAP_FIRSTPRIVATE_INT host addresses.
> > 	* plugin/plugin-nvptx.c (nvptx_exec): Handle
> > 	GOMP_MAP_FIRSTPRIVATE_INT host addresses.
> > 	* testsuite/libgomp.oacc-c++/firstprivate-int.C: New test.
> > 	* testsuite/libgomp.oacc-c-c++-common/firstprivate-int.c:
> > New test.
> > 	* testsuite/libgomp.oacc-fortran/firstprivate-int.f90: New
> > test.  
> 
> > @@ -8039,7 +8182,7 @@ lower_omp_target (gimple_stmt_iterator
> > *gsi_p, omp_context *ctx) if (omp_is_reference (ovar))
> >  	      type = TREE_TYPE (type);
> >  	    if ((INTEGRAL_TYPE_P (type)
> > -		 && TYPE_PRECISION (type) <= POINTER_SIZE)
> > +		 && tree_to_uhwi (TYPE_SIZE (type)) <=
> > POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
> >  	      {
> >  		tkind = GOMP_MAP_FIRSTPRIVATE_INT;
> > @@ -8194,7 +8337,7 @@ lower_omp_target (gimple_stmt_iterator
> > *gsi_p, omp_context *ctx) if (omp_is_reference (var))
> >  		  type = TREE_TYPE (type);
> >  		if ((INTEGRAL_TYPE_P (type)
> > -		     && TYPE_PRECISION (type) <= POINTER_SIZE)
> > +		     && tree_to_uhwi (TYPE_SIZE (type)) <=
> > POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
> >  		  {
> >  		    x = build_receiver_ref (var, false, ctx);  
> 
> Why this?

My *guess* is that it was an attempt to handle cases where the type
precision is less than the type size, and maybe it was feared that
type-punning to an int would then copy the wrong bits. Those changes
appear to not have been necessary though, at least with respect to
testsuite coverage. I also fixed the Fortran test to use "STOP n"
instead of "call abort".

I re-tested the attached with offloading to nvptx. OK?

Thanks,

Julian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: firstprivate-int-2.diff
Type: text/x-patch
Size: 18735 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20181206/e8ad40d6/attachment.bin>


More information about the Fortran mailing list