public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Martin Liska <mliska@suse.cz>
Subject: [hsa] Make debug stores conditional on a parameter
Date: Mon, 12 Oct 2015 17:55:00 -0000	[thread overview]
Message-ID: <20151012175548.GG14248@virgil.suse.cz> (raw)

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:

                 reply	other threads:[~2015-10-12 17:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151012175548.GG14248@virgil.suse.cz \
    --to=mjambor@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).