public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, SMS] Fix marking of SMSed loops as BB_DISABLE_SCHEDULE
@ 2011-10-27 15:26 Revital Eres
  2011-10-27 22:05 ` Ayal Zaks
  0 siblings, 1 reply; 3+ messages in thread
From: Revital Eres @ 2011-10-27 15:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ayal Zaks, Patch Tracking

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

Hello,

The attach patch fixes the current marking of SMS loops to prevent
further scheduling as follows: it marks *all* the loop's bbs with
BB_DISABLE_SCHEDULE which prevents them from been scheduled later.
(with the current implementation if the loop has non empty latch then
it will be considered for scheduling based on
sched_is_disabled_for_current_region_p () in in sched-rgn.c).
It also marks the epilogue and prologue as BB_DISABLE_SCHEDULE which
was shown in my experiments as a good influence on performance as
scheduling those regions after SMS increased register pressure in some
cases.

Tested and bootstrap on all languages except java (PR50879) on
ppc64-redhat-linux, enabling SMS on loops with SC 1.

OK for mainline?

Thanks,
Revital


Changelog:

        * modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog
        as BB_DISABLE_SCHEDULE.
        (mark_loop_unsched): New function.
        (sms_schedule): Call it.

[-- Attachment #2: patch_unsched.txt --]
[-- Type: text/plain, Size: 1444 bytes --]

Index: modulo-sched.c
===================================================================
--- modulo-sched.c	(revision 180557)
+++ modulo-sched.c	(working copy)
@@ -1173,6 +1173,7 @@ generate_prolog_epilog (partial_schedule
   /* Put the prolog on the entry edge.  */
   e = loop_preheader_edge (loop);
   split_edge_and_insert (e, get_insns ());
+  e->dest->flags |= BB_DISABLE_SCHEDULE;
 
   end_sequence ();
 
@@ -1186,9 +1187,23 @@ generate_prolog_epilog (partial_schedule
   gcc_assert (single_exit (loop));
   e = single_exit (loop);
   split_edge_and_insert (e, get_insns ());
+  e->dest->flags |= BB_DISABLE_SCHEDULE;
+
   end_sequence ();
 }
 
+/* Mark LOOP as software pipelined so the later
+   scheduling passes doesn't touch it.  */
+static void
+mark_loop_unsched (struct loop *loop)
+{
+  unsigned i;
+  basic_block *bbs = get_loop_body (loop);
+
+  for (i = 0; i < loop->num_nodes; i++)
+    bbs[i]->flags |= BB_DISABLE_SCHEDULE;
+}
+
 /* Return true if all the BBs of the loop are empty except the
    loop header.  */
 static bool
@@ -1716,7 +1731,8 @@ sms_schedule (void)
           /* Mark this loop as software pipelined so the later
 	     scheduling passes doesn't touch it.  */
 	  if (! flag_resched_modulo_sched)
-	    g->bb->flags |= BB_DISABLE_SCHEDULE;
+	    mark_loop_unsched (loop);
+	  
 	  /* The life-info is not valid any more.  */
 	  df_set_bb_dirty (g->bb);
 

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

* Re: [PATCH, SMS] Fix marking of SMSed loops as BB_DISABLE_SCHEDULE
  2011-10-27 15:26 [PATCH, SMS] Fix marking of SMSed loops as BB_DISABLE_SCHEDULE Revital Eres
@ 2011-10-27 22:05 ` Ayal Zaks
  2011-10-28  8:22   ` Revital Eres
  0 siblings, 1 reply; 3+ messages in thread
From: Ayal Zaks @ 2011-10-27 22:05 UTC (permalink / raw)
  To: Revital Eres; +Cc: gcc-patches, Patch Tracking

On Thu, Oct 27, 2011 at 4:47 PM, Revital Eres <revital.eres@linaro.org> wrote:
> Hello,
>
> The attach patch fixes the current marking of SMS loops to prevent
> further scheduling as follows: it marks *all* the loop's bbs with
> BB_DISABLE_SCHEDULE which prevents them from been scheduled later.
> (with the current implementation if the loop has non empty latch then
> it will be considered for scheduling based on
> sched_is_disabled_for_current_region_p () in in sched-rgn.c).
> It also marks the epilogue and prologue as BB_DISABLE_SCHEDULE which
> was shown in my experiments as a good influence on performance as
> scheduling those regions after SMS increased register pressure in some
> cases.
>
> Tested and bootstrap on all languages except java (PR50879) on
> ppc64-redhat-linux, enabling SMS on loops with SC 1.
>
> OK for mainline?
>

OK, seems reasonable.

Please fix typo (in original comment):
- 	     scheduling passes doesn't touch it.  */
+	     scheduling passes don't touch it.  */

Thanks,
Ayal.


> Thanks,
> Revital
>
>
> Changelog:
>
>        * modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog
>        as BB_DISABLE_SCHEDULE.
>        (mark_loop_unsched): New function.
>        (sms_schedule): Call it.
>

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

* Re: [PATCH, SMS] Fix marking of SMSed loops as BB_DISABLE_SCHEDULE
  2011-10-27 22:05 ` Ayal Zaks
@ 2011-10-28  8:22   ` Revital Eres
  0 siblings, 0 replies; 3+ messages in thread
From: Revital Eres @ 2011-10-28  8:22 UTC (permalink / raw)
  To: Ayal Zaks; +Cc: gcc-patches, Patch Tracking

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

Hello,

>> Tested and bootstrap on all languages except java (PR50879) on
>> ppc64-redhat-linux, enabling SMS on loops with SC 1.
>>
>> OK for mainline?
>>
>
> OK, seems reasonable.
>
> Please fix typo (in original comment):
> -            scheduling passes doesn't touch it.  */
> +            scheduling passes don't touch it.  */

I realize that I forgot to guard the marking in the epilogue and
prologue with -fresched-modulo-sched, sorry about that. I am testing
the attached patch and will commit it after testing completes if there
are no further comments.

Thanks,
Revital

[-- Attachment #2: patch_mark_fix.txt --]
[-- Type: text/plain, Size: 1635 bytes --]

Index: modulo-sched.c
===================================================================
--- modulo-sched.c	(revision 180557)
+++ modulo-sched.c	(working copy)
@@ -1173,6 +1173,8 @@ generate_prolog_epilog (partial_schedule
   /* Put the prolog on the entry edge.  */
   e = loop_preheader_edge (loop);
   split_edge_and_insert (e, get_insns ());
+  if (!flag_resched_modulo_sched)
+    e->dest->flags |= BB_DISABLE_SCHEDULE;
 
   end_sequence ();
 
@@ -1186,9 +1188,24 @@ generate_prolog_epilog (partial_schedule
   gcc_assert (single_exit (loop));
   e = single_exit (loop);
   split_edge_and_insert (e, get_insns ());
+  if (!flag_resched_modulo_sched)
+    e->dest->flags |= BB_DISABLE_SCHEDULE;
+
   end_sequence ();
 }
 
+/* Mark LOOP as software pipelined so the later
+   scheduling passes don't touch it.  */
+static void
+mark_loop_unsched (struct loop *loop)
+{
+  unsigned i;
+  basic_block *bbs = get_loop_body (loop);
+
+  for (i = 0; i < loop->num_nodes; i++)
+    bbs[i]->flags |= BB_DISABLE_SCHEDULE;
+}
+
 /* Return true if all the BBs of the loop are empty except the
    loop header.  */
 static bool
@@ -1714,9 +1731,10 @@ sms_schedule (void)
 	  permute_partial_schedule (ps, g->closing_branch->first_note);
 
           /* Mark this loop as software pipelined so the later
-	     scheduling passes doesn't touch it.  */
+	     scheduling passes don't touch it.  */
 	  if (! flag_resched_modulo_sched)
-	    g->bb->flags |= BB_DISABLE_SCHEDULE;
+	    mark_loop_unsched (loop);
+	  
 	  /* The life-info is not valid any more.  */
 	  df_set_bb_dirty (g->bb);
 

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

end of thread, other threads:[~2011-10-28  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-27 15:26 [PATCH, SMS] Fix marking of SMSed loops as BB_DISABLE_SCHEDULE Revital Eres
2011-10-27 22:05 ` Ayal Zaks
2011-10-28  8:22   ` Revital Eres

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