This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/n] OpenMP 4.0 offloading infrastructure: LTO streaming
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ilya Verbin <iverbin at gmail dot com>
- Cc: Richard Biener <rguenther at suse dot de>, Thomas Schwinge <thomas at codesourcery dot com>, Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Ilya Tocar <tocarip at gmail dot com>, Andrey Turetskiy <andrey dot turetskiy at gmail dot com>, Bernd Schmidt <bernds at codesourcery dot com>
- Date: Mon, 3 Nov 2014 10:24:47 +0100
- Subject: Re: [PATCH 2/n] OpenMP 4.0 offloading infrastructure: LTO streaming
- Authentication-results: sourceware.org; auth=none
- References: <20140927181647 dot GA1819 at msticlxl57 dot ims dot intel dot com> <20140929011014 dot GA11758 at kam dot mff dot cuni dot cz> <20140929173704 dot GA7526 at msticlxl57 dot ims dot intel dot com> <878ul172w5 dot fsf at schwinge dot name> <20141001161332 dot GB54978 at msticlxl57 dot ims dot intel dot com> <alpine dot LSU dot 2 dot 11 dot 1410151612470 dot 20733 at zhemvz dot fhfr dot qr> <20141020111935 dot GA9362 at msticlxl57 dot ims dot intel dot com> <20141024141601 dot GA62562 at msticlxl57 dot ims dot intel dot com> <20141024142028 dot GD10376 at tucnak dot redhat dot com> <20141028193047 dot GA17865 at msticlxl57 dot ims dot intel dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Oct 28, 2014 at 10:30:47PM +0300, Ilya Verbin wrote:
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
> #include "tree-dfa.h"
> #include "profile.h"
> #include "params.h"
> +#include "context.h"
>
> /* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */
> #include "tree-pass.h"
> @@ -474,6 +475,13 @@ cgraph_node::create (tree decl)
> gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
>
> node->decl = decl;
> +
> + if (lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
> + {
> + node->offloadable = 1;
> + g->have_offload = true;
> + }
I wonder if we shouldn't optimize here and call lookup_attribute only
if there is a chance that the attribute might be present, so guard with
flag_openmp (and flag_openacc later on?). During LTO the cgraph nodes
are streamed in and supposedly the flag offloadable too.
> @@ -2129,8 +2141,12 @@ symbol_table::compile (void)
> fprintf (stderr, "Performing interprocedural optimizations\n");
> state = IPA;
>
> + /* OpenMP offloading requires LTO infrastructure. */
> + if (!in_lto_p && flag_openmp && g->have_offload)
> + flag_generate_lto = 1;
On the other side, do you need flag_openmp here? Supposedly g->have_offload
would already been set if needed.
Jakub