[hsa-branch 8/9] Fail instead of calling an unknown GOMP builtin

Martin Jambor mjambor@suse.cz
Mon Oct 10 16:09:00 GMT 2016


Hi,

this patch is a bit of a hack to make sure we do not emit calls to
libgomp run-time functions which are not available at the HSA GPU side,
such as run-time loop scheduling routines.  If we fail at the caller
side, we avoid issues with finalizer looking at calls to non-existing
functions.

Committed to the branch, queued for merge to trunk soon.
Thanks,

Martin

2016-10-03  Martin Jambor  <mjambor@suse.cz>

	* hsa-gen.c (gen_hsa_insns_for_call): Fail when encountering a
	GOMP builtin that we cannot process ourselves.
---
 gcc/hsa-gen.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 8893a28..fd0dbcd 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -5972,7 +5972,15 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb)
       break;
     default:
       {
-	gen_hsa_insns_for_direct_call (stmt, hbb);
+	tree name_tree = DECL_NAME (fndecl);
+	const char *s = IDENTIFIER_POINTER (name_tree);
+	size_t len = strlen (s);
+	if (len > 4 && (strncmp (s, "__builtin_GOMP_", 15) == 0))
+	  HSA_SORRY_ATV (gimple_location (stmt),
+			 "support for HSA does not implement GOMP function %s",
+			 s);
+	else
+	  gen_hsa_insns_for_direct_call (stmt, hbb);
 	return;
       }
     }
-- 
2.10.0



More information about the Gcc-patches mailing list