diff mbox

[hsa] Fail in presence of atomic operations in private segment

Message ID 20160226155733.GC3094@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Feb. 26, 2016, 3:57 p.m. UTC
Hi,

the HSA does not allow atomic instructions operating on the private
segment because they are quite pointless.  In the long term, we should
put addressable local variables in the global memory somewhere (I'm
going to look at the nvidia stack effort soon).  But for now we need
to fail in the compiler, because otherwise there is testcase in the
libgomp testsuite that complains about the finalizer errors in the
output of the execute test.  Bootstrapped and tested, I'll commit it
to trunk shortly.

Thanks,

Martin

2016-02-17  Martin Jambor  <mjambor@suse.cz>

	* hsa-gen.c (gen_hsa_ternary_atomic_for_builtin): Fail in presence of
	atomic operations in private segment.
---
 gcc/hsa-gen.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 28e8b6f..717e755 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -4557,8 +4557,13 @@  gen_hsa_ternary_atomic_for_builtin (bool ret_orig,
 
   hsa_op_address *addr;
   addr = get_address_from_value (gimple_call_arg (stmt, 0), hbb);
-  /* TODO: Warn if addr has private segment, because the finalizer will not
-     accept that (and it does not make much sense).  */
+  if (addr->m_symbol && addr->m_symbol->m_segment == BRIG_SEGMENT_PRIVATE)
+    {
+      HSA_SORRY_AT (gimple_location (stmt),
+		    "HSA does not implement atomic operations in private "
+		    "segment");
+      return;
+    }
   hsa_op_base *op = hsa_reg_or_immed_for_gimple_op (gimple_call_arg (stmt, 1),
 						    hbb);