This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

nvptx offloading: Tag entrypoint functions with a special attribute (was: OpenACC middle end changes)


Hi!

On Fri, 20 Feb 2015 10:47:13 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> 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
> node.

Heh, that's precisely the question I had just drafted in an email, just
about to send, when your email arrived.  ;-)

> As nvptx backend already recognizes it and we have "omp declare target"
> attribute already, this is ok for trunk.

Bernd, are you going to commit this, and the other approved changes of
yours?

> > 	* 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
> > task_copy)
> >             break;
> >           }
> >      }
> > +  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);


GrÃÃe,
 Thomas

Attachment: pgpGLfU0W37CK.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]