[RFC PATCH] Coalesce host to device transfers in libgomp
Thu Dec 6 17:57:00 GMT 2018
On Thu, Dec 06, 2018 at 06:54:20PM +0100, Thomas Schwinge wrote:
> On Thu, 6 Dec 2018 18:18:56 +0100, Jakub Jelinek <email@example.com> wrote:
> > 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.
> Hmm, I thought this would just copy an address (as opposed to data) from
> the host to the device, so that would be fine for coalescing. But I'm
> not familiar with that code, so it's certainly possible that I'm not
> understanding this correctly.
The actual data transfer can be coalesced, just the address is copied into
the offloaded file scope var and so that exact transfer can't be coalesced.
> > Perhaps we could do the change but pass NULL instead
> > of cbufp as the last argument?
> Like this?
> commit 241027a03b70c788ef94ccf258b799332fb1b20e
> Author: Thomas Schwinge <firstname.lastname@example.org>
> Date: Thu Dec 6 18:53:16 2018 +0100
> Coalesce host to device transfers in libgomp: not for link pointer
> 2018-12-06 Thomas Schwinge <email@example.com>
> Jakub Jelinek <firstname.lastname@example.org>
> * target.c (gomp_map_vars): Call "gomp_copy_host2dev" instead of
Ok for trunk, thanks. Perhaps no need for the "s in the ChangeLog.
> libgomp/target.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
> diff --git libgomp/target.c libgomp/target.c
> index 8ebc2a370a16..60f4c96f3908 100644
> --- libgomp/target.c
> +++ libgomp/target.c
> @@ -957,9 +957,11 @@ 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 *));
> + /* We intentionally do not use coalescing here, as it's not
> + data allocated by the current call to this function. */
> + gomp_copy_host2dev (devicep, (void *) n->tgt_offset,
> + &tgt_addr, sizeof (void *), NULL);
More information about the Gcc-patches