This is the mail archive of the
mailing list for the GCC project.
Re: [RFC PATCH] Coalesce host to device transfers in libgomp
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Martin Jambor <mjambor at suse dot cz>, Alexander Monakov <amonakov at ispras dot ru>, Chung-Lin Tang <cltang at codesourcery dot com>
- Date: Thu, 6 Dec 2018 18:57:31 +0100
- Subject: Re: [RFC PATCH] Coalesce host to device transfers in libgomp
- References: <20171024095527.GJ14653@tucnak> <alpine.LNX.email@example.com> <20171025113850.GR14653@tucnak> <firstname.lastname@example.org> <20181206171856.GS12380@tucnak> <email@example.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 06, 2018 at 06:54:20PM +0100, Thomas Schwinge wrote:
> On Thu, 6 Dec 2018 18:18:56 +0100, Jakub Jelinek <firstname.lastname@example.org> 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 <email@example.com>
> 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 <firstname.lastname@example.org>
> Jakub Jelinek <email@example.com>
> * 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);