public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Revital Eres <revital.eres@linaro.org>
To: Ayal Zaks <zaks@il.ibm.com>
Cc: gcc-patches@gcc.gnu.org, Patch Tracking <patches@linaro.org>
Subject: [PATCH, SMS] Fix calculation of issue_rate
Date: Thu, 19 May 2011 10:33:00 -0000	[thread overview]
Message-ID: <BANLkTim=4Ao0B1fFs8kBZuN5oqfvFGT+fA@mail.gmail.com> (raw)

Hello,

The issue rate is currently been set in SMS by calling
targetm.sched.issue_rate  function if it is defined.  For rs6000 the
issue_rate is 1 if !reload_completed && !flag_sched_pressure.
To bypass that, SMS sets reload_completed to 1 before calling
targetm.sched.issue_rate and restores it's original value after the call.
The problem is that the issue rate is changed again to 1 because of the
following chain of calls which occurs right after setting issue_rate
in targetm.sched.issue_rate  ():

sms_schedule -> haifa_sched_init -> sched_init () ->
targetm.sched.issue_rate () (in haifa-sched.c:3474)

This time, when calling targetm.sched.issue_rate the issue_rate is
set to 1 as reload_completed  contains it's original value (zero).
The attached patch tries to fix that.

Tested (bootstrap and regtest) on ppc64-redhat-linux.

OK for mainline?

Thanks,
Revital


Changelog:

* modulo-sched.c (sms_schedule): Fix stage_count calculation.



Index: modulo-sched.c
===================================================================
--- modulo-sched.c      (revision 173786)
+++ modulo-sched.c      (working copy)
@@ -924,6 +924,7 @@ sms_schedule (void)
   basic_block condition_bb = NULL;
   edge latch_edge;
   gcov_type trip_count = 0;
+  int temp;

   loop_optimizer_init (LOOPS_HAVE_PREHEADERS
                       | LOOPS_HAVE_RECORDED_EXITS);
@@ -933,22 +934,19 @@ sms_schedule (void)
       return;  /* There are no loops to schedule.  */
     }

+  temp = reload_completed;
+  reload_completed = 1;
   /* Initialize issue_rate.  */
   if (targetm.sched.issue_rate)
-    {
-      int temp = reload_completed;
-
-      reload_completed = 1;
-      issue_rate = targetm.sched.issue_rate ();
-      reload_completed = temp;
-    }
+    issue_rate = targetm.sched.issue_rate ();
   else
     issue_rate = 1;
-
+
   /* Initialize the scheduler.  */
   setup_sched_infos ();
   haifa_sched_init ();
-
+  reload_completed = temp;
+
   /* Allocate memory to hold the DDG array one entry for each loop.
      We use loop->num as index into this array.  */
   g_arr = XCNEWVEC (ddg_ptr, number_of_loops ());

             reply	other threads:[~2011-05-19  6:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 10:33 Revital Eres [this message]
2011-05-19 10:44 ` Revital Eres

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='BANLkTim=4Ao0B1fFs8kBZuN5oqfvFGT+fA@mail.gmail.com' \
    --to=revital.eres@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=patches@linaro.org \
    --cc=zaks@il.ibm.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).