diff mbox

[hsa] Exclude parallel outlines from hsa_callable_functions_p

Message ID 20170111102530.uca7h6sd64i4dt3y@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Jan. 11, 2017, 10:25 a.m. UTC
Hi,

On Fri, Dec 02, 2016 at 02:55:46PM +0100, Martin Jambor wrote:
> Hi,
> 
> after the merge of nvidia OpenMP implementation, the normal parallel
> outline functions were also marked as "omp declare target" which lead
> to them being cloned and compiled to HSA which is not only unnecessary
> but often leads to a lot of useless HSA warning noise.  The following
> patch deal with this issue by making sure they are not considered
> callable from HSA.
> 
> 
> 2016-11-29  Martin Jambor  <mjambor@suse.cz>
> 
> 	    * hsa.c (hsa_callable_function_p): Return false for artificial
> 	      functions.

This actually broke a few HSA tests in libgomp suite when compiling
with -O0 and I apparently somehow did not inspected the test results
properly.  The artificial test must only apply to cloning decisions,
because later our own function (as opposed to kernel) decls have that
bit set too.  I will commit the following (bootstrapped and
hsa-tested) fix in a few moments.

Thanks,

Martin


2017-01-11  Martin Jambor  <mjambor@suse.cz>

	* hsa.c (hsa_callable_function_p): Revert addition of DECL_ARTIFICIAL
	test.
	* ipa-hsa.c (process_hsa_functions): Only duplicate non-artificial
	decorated functions.
---
 gcc/hsa.c     | 5 +----
 gcc/ipa-hsa.c | 5 ++++-
 2 files changed, 5 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/gcc/hsa.c b/gcc/hsa.c
index c0ed9f82bf3..2035ce446a1 100644
--- a/gcc/hsa.c
+++ b/gcc/hsa.c
@@ -90,10 +90,7 @@  bool
 hsa_callable_function_p (tree fndecl)
 {
   return (lookup_attribute ("omp declare target", DECL_ATTRIBUTES (fndecl))
-	  && !lookup_attribute ("oacc function", DECL_ATTRIBUTES (fndecl))
-	  /* At this point, this is enough to identify clones for
-	     parallel, which for HSA would need to be kernels anyway.  */
-	  && !DECL_ARTIFICIAL (fndecl));
+	  && !lookup_attribute ("oacc function", DECL_ATTRIBUTES (fndecl)));
 }
 
 /* Allocate HSA structures that are are used when dealing with different
diff --git a/gcc/ipa-hsa.c b/gcc/ipa-hsa.c
index 4391b580566..6a3f660672e 100644
--- a/gcc/ipa-hsa.c
+++ b/gcc/ipa-hsa.c
@@ -100,7 +100,10 @@  process_hsa_functions (void)
 		     clone->name (),
 		     s->m_kind == HSA_KERNEL ? "kernel" : "function");
 	}
-      else if (hsa_callable_function_p (node->decl))
+      else if (hsa_callable_function_p (node->decl)
+	       /* At this point, this is enough to identify clones for
+		  parallel, which for HSA would need to be kernels anyway.  */
+	       && !DECL_ARTIFICIAL (node->decl))
 	{
 	  if (!check_warn_node_versionable (node))
 	    continue;