[RFC PATCH] Coalesce host to device transfers in libgomp

Jakub Jelinek jakub@redhat.com
Thu Dec 6 17:19:00 GMT 2018


On Thu, Dec 06, 2018 at 06:01:48PM +0100, Thomas Schwinge wrote:
> While reviewing Chung-Lin's
> <https://gcc.gnu.org/ml/gcc-patches/2018-09/msg01428.html> "[PATCH 4/6,
> OpenACC, libgomp] Async re-work, libgomp/target.c changes", I noticed the
> following unrelated hunk.  Is that intentional or just an oversight that
> it hasn't been included in your "gomp_coalesce_buf" changes (quoted below
> for reference)?

I believe it is intentional, the coalescing code coalesces only stuff
allocated by the current gomp_map_vars call, for the link_key case we know
that is not the case, it is a copy to a file scope data variable in the PTX
code.  Perhaps we could do the change but pass NULL instead
of cbufp as the last argument?

> commit 2abec5454063076ebd0fddf6ed25a3459c4f5ac3
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Thu Dec 6 17:52:34 2018 +0100
> 
>     Coalesce host to device transfers in libgomp: link pointer
>     
>             libgomp/
>             * target.c (gomp_map_vars): Call "gomp_copy_host2dev" instead of
>             "devicep->host2dev_func".
> ---
>  libgomp/target.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git libgomp/target.c libgomp/target.c
> index 8ebc2a370a16..9cb2ec8d026f 100644
> --- libgomp/target.c
> +++ libgomp/target.c
> @@ -957,9 +957,9 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
>  		    /* Set link pointer on target to the device address of the
>  		       mapped object.  */
>  		    void *tgt_addr = (void *) (tgt->tgt_start + k->tgt_offset);
> -		    devicep->host2dev_func (devicep->target_id,
> -					    (void *) n->tgt_offset,
> -					    &tgt_addr, sizeof (void *));
> +		    gomp_copy_host2dev (devicep, (void *) n->tgt_offset,
> +					&tgt_addr, sizeof (void *), cbufp);
> +
>  		  }
>  		array++;
>  	      }
> 

	Jakub



More information about the Gcc-patches mailing list