public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Support disabling of sched autoprefetcher from command line
@ 2015-02-01  7:56 Maxim Kuvyrkov
  2015-04-13 12:39 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Kuvyrkov @ 2015-02-01  7:56 UTC (permalink / raw)
  To: GCC Patches; +Cc: Vladimir Makarov

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Support disabling of sched autoprefetcher from command line
  2015-02-01  7:56 [PATCH] Support disabling of sched autoprefetcher from command line Maxim Kuvyrkov
@ 2015-04-13 12:39 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-04-13 12:39 UTC (permalink / raw)
  To: Maxim Kuvyrkov, GCC Patches; +Cc: Vladimir Makarov

On 02/01/2015 12:55 AM, Maxim Kuvyrkov wrote:
> 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
>
>
>
> 0002-Support-disabling-of-sched-autoprefetcher-from-comma.patch
>
>
> 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.
OK once the final bootstrap and testing are complete.
Jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-13 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-01  7:56 [PATCH] Support disabling of sched autoprefetcher from command line Maxim Kuvyrkov
2015-04-13 12:39 ` Jeff Law

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).