diff mbox

[hsa] Make debug stores conditional on a parameter

Message ID 20151012175548.GG14248@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Oct. 12, 2015, 5:55 p.m. UTC
Hi,

because HSA run-time currently offers very few options to debug the
HSAIL, especially when it comes to tricky things like executing a
kernel from kernel, we have resorted to introducing memory stores
solely for the purpose of debugging.  While we will gladly throw them
away when HSA supports at least a debugging trap, until then we
actually quite like them.

However, they can interfere with benchmarks so we need a way of
controlling them.  This patch introduces a parameter for them.  I have
chosen a parameter rather than a swithch to emphasize the fact that
this part of the interface is likely to change and go away completely
in the future.

If it is too controversial, we can remove the whole concept before
merging to trunk, meanwhile, I have committed the following patch.

Thanks,

Martin


2015-10-12  Martin Jambor  <mjambor@suse.cz>

	* params.def (PARAM_HSA_GEN_DEBUG_STORES): New parameter.
	* hsa-gen.c: Include params.h.
	(init_omp_in_prologue): Emit debug store only if
	hsa-gen-debug-stores allow it.
diff mbox

Patch

diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 85107c9..8f707b5 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -77,6 +77,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cfgloop.h"
 #include "cfganal.h"
 #include "builtins.h"
+#include "params.h"
 
 /* Print a warning message and set that we have seen an error.  */
 
@@ -4643,7 +4644,8 @@  init_omp_in_prologue (void)
   unsigned index = hsa_get_number_decl_kernel_mappings ();
 
   /* Emit store to debug argument.  */
-  set_debug_value (prologue, new hsa_op_immed (1000 + index, BRIG_TYPE_U64));
+  if (PARAM_VALUE (PARAM_HSA_GEN_DEBUG_STORES) > 0)
+    set_debug_value (prologue, new hsa_op_immed (1000 + index, BRIG_TYPE_U64));
 }
 
 /* Go over gimple representation and generate our internal HSA one.  SSA_MAP
diff --git a/gcc/params.def b/gcc/params.def
index 3f91992..9a12238 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -1152,6 +1152,11 @@  DEFPARAM (PARAM_PARLOOPS_CHUNK_SIZE,
 	  "parloops-chunk-size",
 	  "Chunk size of omp schedule for loops parallelized by parloops",
 	  0, 0, 0)
+
+DEFPARAM (PARAM_HSA_GEN_DEBUG_STORES,
+	  "hsa-gen-debug-stores",
+	  "Level of hsa debug stores verbosity",
+	  0, 0, 1)
 /*
 
 Local variables: