This is the mail archive of the
mailing list for the GCC project.
Re: OpenACC middle end changes
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 20 Feb 2015 10:47:13 +0100
- Subject: Re: OpenACC middle end changes
- Authentication-results: sourceware.org; auth=none
- References: <87fvdnnijk dot fsf at schwinge dot name> <546BF74F dot 9020709 at codesourcery dot com> <546CF508 dot 9010807 at codesourcery dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 19, 2014 at 08:52:40PM +0100, Bernd Schmidt wrote:
> Another change that's required is (something like) the following. For ptx,
> we need to know whether to output something as a .func (callable from ptx
> code) or a .kernel (callable from the host). That means we need to mark the
> kernel functions somehow in omp-low.c, and the following does that by way of
> a new attribute (already recognized by the nvptx backend).
On a second though, I guess this is ok. Adding a cgraph bit that is
interesting to just a single target and is quite rare is probably waste,
especially when it would need to be streamed in and out in every cgraph
As nvptx backend already recognizes it and we have "omp declare target"
attribute already, this is ok for trunk.
> * omp-low.c (create_omp_child_function): Tag entrypoint
> functions with a special attribute.
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index 42ba317..8408025 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -2228,6 +2228,12 @@ create_omp_child_function (omp_context *ctx, bool
> + if (cgraph_node::get_create (decl)->offloadable
> + && !lookup_attribute ("omp declare target",
> + DECL_ATTRIBUTES (current_function_decl)))
> + DECL_ATTRIBUTES (decl)
> + = tree_cons (get_identifier ("omp target entrypoint"),
> + NULL_TREE, DECL_ATTRIBUTES (decl));
> t = build_decl (DECL_SOURCE_LOCATION (decl),
> RESULT_DECL, NULL_TREE, void_type_node);