Message ID | alpine.LNX.2.20.1510301900180.23484@monopod.intra.ispras.ru |
---|---|
State | New |
Headers | show |
On 10/30/2015 05:44 PM, Alexander Monakov wrote: > + /* Ignore "omp target entrypoint" here: OpenMP target region functions are > + called from gomp_nvptx_main. The corresponding kernel entry is emitted > + from write_omp_entry. */ > } I'm probably confused, but didn't we agree that this should be changed so that the entry point isn't gomp_nvptx_main but instead something that wraps a call to that function? This patch creates a new "omp target entrypoint" annotation that appears not to be used - it would be better to just not annotate a function if it's not going to need entrypoint treatment. IMO a single type of attribute should be sufficient for that. Bernd
On Fri, Nov 06, 2015 at 03:05:05PM +0100, Bernd Schmidt wrote: > This patch creates a new "omp target entrypoint" annotation that appears not > to be used - it would be better to just not annotate a function if it's not > going to need entrypoint treatment. IMO a single type of attribute should be > sufficient for that. But NVPTX is just one backend, perhaps other backends need different treatment of the entry points? Jakub
On 11/06/2015 03:08 PM, Jakub Jelinek wrote: > On Fri, Nov 06, 2015 at 03:05:05PM +0100, Bernd Schmidt wrote: >> This patch creates a new "omp target entrypoint" annotation that appears not >> to be used - it would be better to just not annotate a function if it's not >> going to need entrypoint treatment. IMO a single type of attribute should be >> sufficient for that. > > But NVPTX is just one backend, perhaps other backends need different > treatment of the entry points? If we don't know, then it's not a problem we have to solve now. We can change it at any time later. For now, let's just keep it simple - no need to invent special annotations that end up unused. Bernd
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 21c59ef..ac021fc 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -402,7 +402,10 @@ static bool write_as_kernel (tree attrs) { return (lookup_attribute ("kernel", attrs) != NULL_TREE - || lookup_attribute ("omp target entrypoint", attrs) != NULL_TREE); + || lookup_attribute ("omp acc target entrypoint", attrs) != NULL_TREE); + /* Ignore "omp target entrypoint" here: OpenMP target region functions are + called from gomp_nvptx_main. The corresponding kernel entry is emitted + from write_omp_entry. */ } /* Write a function decl for DECL to S, where NAME is the name to be used. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 06b4a5e..696889d 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -2245,9 +2245,16 @@ create_omp_child_function (omp_context *ctx, bool task_copy) 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)); + { + const char *target_attr = (is_gimple_omp_offloaded (ctx->stmt) + ? (is_gimple_omp_oacc (ctx->stmt) + ? "omp acc target entrypoint" + : "omp target entrypoint") + : "omp declare target"); + DECL_ATTRIBUTES (decl) + = tree_cons (get_identifier (target_attr), + NULL_TREE, DECL_ATTRIBUTES (decl)); + } t = build_decl (DECL_SOURCE_LOCATION (decl), RESULT_DECL, NULL_TREE, void_type_node);