This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp4 01/14] nvptx: emit kernels for 'omp target entrypoint' only for OpenACC
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jakub Jelinek <jakub at redhat dot com>, Dmitry Melnik <dm at ispras dot ru>
- Date: Tue, 20 Oct 2015 21:34:23 +0300
- Subject: [gomp4 01/14] nvptx: emit kernels for 'omp target entrypoint' only for OpenACC
- Authentication-results: sourceware.org; auth=none
- References: <1445366076-16082-1-git-send-email-amonakov at ispras dot ru>
The NVPTX backend emits each functions either as .func (callable only from the
device code) or as .kernel (entry point for a parallel region). OpenMP
lowering adds "omp target entrypoint" attribute to functions outlined from
target regions. Unlike OpenACC offloading, OpenMP offloading does not invoke
such outlined functions directly, but instead passes their address to
'gomp_nvptx_main'. Restrict the special attribute treatment to OpenACC only.
* config/nvptx/nvptx.c (write_as_kernel): Additionally test
flag_openacc for "omp_target_entrypoint".
---
gcc/config/nvptx/nvptx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 21c59ef..df7b61f 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -401,8 +401,10 @@ write_one_arg (std::stringstream &s, tree type, int i, machine_mode mode,
static bool
write_as_kernel (tree attrs)
{
- return (lookup_attribute ("kernel", attrs) != NULL_TREE
- || lookup_attribute ("omp target entrypoint", attrs) != NULL_TREE);
+ if (flag_openacc
+ && lookup_attribute ("omp target entrypoint", attrs) != NULL_TREE)
+ return true;
+ return lookup_attribute ("kernel", attrs) != NULL_TREE;
}
/* Write a function decl for DECL to S, where NAME is the name to be used.