public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Vladimir Makarov <vmakarov@redhat.com>
Subject: [PATCH] Support disabling of sched autoprefetcher from command line
Date: Sun, 01 Feb 2015 07:56:00 -0000	[thread overview]
Message-ID: <83557C87-8594-4191-B760-1CC7D06C14D2@linaro.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

Hi,

It turned out that the values for PARAM_SCHED_AUTOPREF_QUEUE_DEPTH that I initially selected were unfortunate.  The value of "-1" is special in parameter handling code, and it can't be used on command line.  This makes it impossible to disable scheduler autoprefetcher from command line ("-1" corresponds to "disable autoprefetcher model").

This patch shifts the set of a allowed values for PARAM_SCHED_AUTOPREF_QUEUE_DEPTH by +1, so that the "disable" value is "0".

OK for stage 1?  Tested on arm-linux-gnueabihf, and I will bootstrap and test the patch on trunk before committing.

Thank you,

--
Maxim Kuvyrkov
www.linaro.org



[-- Attachment #2: 0002-Support-disabling-of-sched-autoprefetcher-from-comma.patch --]
[-- Type: application/octet-stream, Size: 4838 bytes --]

From b86515013dec067419d16d11c138ba8b74ede1c5 Mon Sep 17 00:00:00 2001
From: Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
Date: Sun, 18 Jan 2015 13:22:56 +0000
Subject: [PATCH 2/2] Support disabling of sched autoprefetcher from command
 line

	* config/arm/arm.c (arm_cortex_a15_tune, arm_cortex_a57_tune): Update.
	* haifa-sched.c: Increase values for PARAM_SCHED_AUTOPREF_QUEUE_DEPTH
	by +1 throughout.
	(rank_for_schedule, autopref_multipass_dfa_lookahead_guard): Update.
	* params.def (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH): Update.
---
 gcc/config/arm/arm.c |    6 +++---
 gcc/haifa-sched.c    |   16 ++++++++--------
 gcc/params.def       |    4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 246298a..cbf6ce0 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3173,11 +3173,11 @@ arm_option_override (void)
      relevant for L2 auto-prefetcher.  */
   int param_sched_autopref_queue_depth;
   if (current_tune->sched_autopref == ARM_SCHED_AUTOPREF_OFF)
-    param_sched_autopref_queue_depth = -1;
-  else if (current_tune->sched_autopref == ARM_SCHED_AUTOPREF_RANK)
     param_sched_autopref_queue_depth = 0;
+  else if (current_tune->sched_autopref == ARM_SCHED_AUTOPREF_RANK)
+    param_sched_autopref_queue_depth = 1;
   else if (current_tune->sched_autopref == ARM_SCHED_AUTOPREF_FULL)
-    param_sched_autopref_queue_depth = max_insn_queue_index + 1;
+    param_sched_autopref_queue_depth = max_insn_queue_index + 2;
   else
     gcc_unreachable ();
   maybe_set_param_value (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH,
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 25b96d3..3f934b8 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2744,7 +2744,7 @@ rank_for_schedule (const void *x, const void *y)
   if (flag_sched_critical_path_heuristic && priority_val)
     return rfs_result (RFS_PRIORITY, priority_val, tmp, tmp2);
 
-  if (PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) >= 0)
+  if (PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) >= 1)
     {
       int autopref = autopref_rank_for_schedule (tmp, tmp2);
       if (autopref != 0)
@@ -5552,11 +5552,11 @@ insn_finishes_cycle_p (rtx_insn *insn)
    insns in the ready list (or the queue) that have same memory base, but
    different offsets, then we delay the insns with larger offsets until insns
    with smaller offsets get scheduled.  If PARAM_SCHED_AUTOPREF_QUEUE_DEPTH
-   is "1", then we look at the ready list; if it is N>1, then we also look
-   through N-1 queue entries.
-   If the param is N>=0, then rank_for_schedule will consider auto-prefetching
+   is "2", then we look at the ready list; if it is N>2, then we also look
+   through N-2 queue entries.
+   If the param is N>=1, then rank_for_schedule will consider auto-prefetching
    among its heuristics.
-   Param value of "-1" disables modelling of the auto-prefetcher.  */
+   Param value of "0" disables modelling of the auto-prefetcher.  */
 
 /* Initialize autoprefetcher model data for INSN.  */
 static void
@@ -5680,7 +5680,7 @@ autopref_multipass_dfa_lookahead_guard (rtx_insn *insn1, int ready_index)
 {
   int r = 0;
 
-  if (PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) <= 0)
+  if (PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) <= 1)
     return 0;
 
   if (sched_verbose >= 2 && ready_index == 0)
@@ -5733,14 +5733,14 @@ autopref_multipass_dfa_lookahead_guard (rtx_insn *insn1, int ready_index)
 	    }
 	}
 
-      if (PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) == 1)
+      if (PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) <= 2)
 	continue;
 
       /* Everything from the current queue slot should have been moved to
 	 the ready list.  */
       gcc_assert (insn_queue[NEXT_Q_AFTER (q_ptr, 0)] == NULL_RTX);
 
-      int n_stalls = PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) - 1;
+      int n_stalls = PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) - 2;
       if (n_stalls > max_insn_queue_index)
 	n_stalls = max_insn_queue_index;
 
diff --git a/gcc/params.def b/gcc/params.def
index 4d3b398..a422078 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -670,8 +670,8 @@ DEFPARAM (PARAM_SCHED_MEM_TRUE_DEP_COST,
 
 DEFPARAM (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH,
 	  "sched-autopref-queue-depth",
-	  "Hardware autoprefetcher scheduler model control flag.  Number of lookahead cycles the model looks into; at '0' only enable instruction sorting heuristic.  Disabled by default.",
-	  -1, 0, 0)
+	  "Hardware autoprefetcher scheduler model control flag.  Number of lookahead cycles the model looks into; at '1' only enable instruction sorting heuristic.  Disabled by default.",
+	  0, 0, 0)
 
 DEFPARAM(PARAM_MAX_LAST_VALUE_RTL,
 	 "max-last-value-rtl",
-- 
1.7.9.5


             reply	other threads:[~2015-02-01  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01  7:56 Maxim Kuvyrkov [this message]
2015-04-13 12:39 ` Jeff Law

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=83557C87-8594-4191-B760-1CC7D06C14D2@linaro.org \
    --to=maxim.kuvyrkov@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=vmakarov@redhat.com \
    /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).