public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [hsa] Exclude parallel outlines from hsa_callable_functions_p
@ 2016-12-02 13:56 Martin Jambor
  2017-01-11 10:25 ` Martin Jambor
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2016-12-02 13:56 UTC (permalink / raw)
  To: GCC Patches

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.

Bootstrapped and tested on x86_64-linux.  I will commit it to trunk in
a few moments (it is already part of my most recent merge from trunk
to the hsa branch.

Thanks,

Martin

Exclude parallel outlines from hsa_callable_functions_p

2016-11-29  Martin Jambor  <mjambor@suse.cz>

	    * hsa.c (hsa_callable_function_p): Return false for artificial
	      functions.
---
 gcc/hsa.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/hsa.c b/gcc/hsa.c
index f881e78..31e3252 100644
--- a/gcc/hsa.c
+++ b/gcc/hsa.c
@@ -90,7 +90,10 @@ bool
 hsa_callable_function_p (tree fndecl)
 {
   return (lookup_attribute ("omp declare target", DECL_ATTRIBUTES (fndecl))
-	  && !lookup_attribute ("oacc function", 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));
 }
 
 /* Allocate HSA structures that are are used when dealing with different
-- 
2.10.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [hsa] Exclude parallel outlines from hsa_callable_functions_p
  2016-12-02 13:56 [hsa] Exclude parallel outlines from hsa_callable_functions_p Martin Jambor
@ 2017-01-11 10:25 ` Martin Jambor
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Jambor @ 2017-01-11 10:25 UTC (permalink / raw)
  To: GCC Patches

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 --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;
-- 
2.11.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-11 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 13:56 [hsa] Exclude parallel outlines from hsa_callable_functions_p Martin Jambor
2017-01-11 10:25 ` Martin Jambor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).