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]

Re: OpenACC middle end changes


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.
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
> 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);

	Jakub


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