public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [hsa] Make debug stores conditional on a parameter
@ 2015-10-12 17:55 Martin Jambor
  0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2015-10-12 17:55 UTC (permalink / raw)
  To: GCC Patches; +Cc: Martin Liska

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 --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:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-12 17:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 17:55 [hsa] Make debug stores conditional on a parameter 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).