This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/n] OpenMP 4.0 offloading infrastructure: offload tables
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ilya Verbin <iverbin at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Bernd Schmidt <bernds at codesourcery dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Mon, 8 Dec 2014 10:31:49 +0100
- Subject: Re: [PATCH 3/n] OpenMP 4.0 offloading infrastructure: offload tables
- Authentication-results: sourceware.org; auth=none
- References: <20140930145320 dot GA19623 at msticlxl57 dot ims dot intel dot com> <20141204193519 dot GA8024 at msticlxl57 dot ims dot intel dot com> <CAFiYyc36Yv11LbbpCMfRWjPW2QkStf+Y6vgyVj6PF-QY56_OMg at mail dot gmail dot com> <CADG=Z0EWWe1ySrMQt7WnEOWOzvYL_AD1xq6ihtJoH4Yfuzc==w at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Dec 08, 2014 at 01:28:10PM +0400, Ilya Verbin wrote:
> 2014-12-08 12:18 GMT+03:00 Richard Biener <richard.guenther@gmail.com>:
> > On Thu, Dec 4, 2014 at 8:35 PM, Ilya Verbin <iverbin@gmail.com> wrote:
> >> Hi,
> >>
> >> On 30 Sep 18:53, Ilya Verbin wrote:
> >>> This patch creates 2 vectors with decls: offload_funcs and offload_vars.
> >>> libgomp will use addresses from these arrays to look up offloaded code.
> >>>
> >>> During the compilation they are outputted to:
> >>> * binary __gnu_offload_funcs/vars sections, or using
> >>> targetm.record_offload_symbol hook for PTX.
> >>
> >> In some cases LTO may optimize out a global variable, declared as target, but
> >> it still will be referenced from the offload table, that will cause a linking
> >> error. Here is the example:
> >>
> >> #pragma omp declare target
> >> int G;
> >> #pragma omp end declare target
> >
> > So where is that "magic" target use then? Why doesn't the symtab
> > reachability code see the use? (why don't we prune it from the offload
> > table?)
> >
> > Richard.
>
> Nowhere on host-side, but it can remain non-optimized on target-side,
> therefore we can not remove it only from the host offload table.
Note, the two tables have to match, and after streaming the offloading LTO
IL, it can't be easily adjusted anymore.
Unless we'd allow some magic value (say NULL) for vars that were optimized
away on the host side, then libgomp and/or mkoffload would need to be
adjusted to ignore or remove pairs from the table where the host var has
been optimized away, but the target one not necessarily so.
Jakub