diff mbox

Adjust debug output from SMS's get_schdedule_window

Message ID g439hhwho8.fsf@linaro.org
State New
Headers show

Commit Message

Richard Sandiford Aug. 4, 2011, 11:16 a.m. UTC
This patch adjusts the dump output from modulo-sched.c:get_schdedule_window.
Dump output is very much down to personal preference, so please feel free
just to reject the change.

Anyway, the current output for a typical scheduling window looks like this:

---------------------------------------------------------------------------
Processing edge:  [29 -(T,2,1)-> 21] 
Scheduling 1 (21) in psp_not_empty, checking p 7 (29): the node is not scheduled

Processing edge:  [27 -(O,0,1)-> 21] 
Scheduling 1 (21) in psp_not_empty, checking p 5 (27): pred st = 4; early_start 
= -8; latency: 0; end: 15

Processing edge:  [25 -(A,0,1)-> 21] 
Scheduling 1 (21) in psp_not_empty, checking p 4 (25): pred st = 1; early_start 
= -8; latency: 0; end: 12

Processing edge:  [24 -(O,0,1)-> 21] 
Scheduling 1 (21) in psp_not_empty, checking p 3 (24): pred st = 0; early_start 
= -8; latency: 0; end: 11

Processing edge:  [22 -(A,0,1)-> 21] 
Scheduling 1 (21) in psp_not_empty, checking p 2 (22): the node is not scheduled

Processing edge:  [18 -(T,3,0)-> 21] 
Scheduling 1 (21) in psp_not_empty, checking p 0 (18): the node is not scheduled

Processing edge: [21 -(O,0,0)-> 40] 
Scheduling 1 (21) in pss_not_empty, checking s 9 (40): the node is not scheduled

Processing edge: [21 -(O,0,0)-> 27] 
Scheduling 1 (21) in pss_not_empty, checking s 5 (27): succ st = 4; late_start =
 4; latency = 0; start=-7
Processing edge: [21 -(T,0,1)-> 25] 
Scheduling 1 (21) in pss_not_empty, checking s 4 (25): succ st = 1; late_start =
 4; latency = 0; start=-7
Processing edge: [21 -(T,0,0)-> 25] 
Scheduling 1 (21) in pss_not_empty, checking s 4 (25): succ st = 1; late_start =
 1; latency = 0; start=-7
Processing edge: [21 -(O,0,0)-> 24] 
Scheduling 1 (21) in pss_not_empty, checking s 3 (24): succ st = 0; late_start =
 0; latency = 0; start=-7
Processing edge: [21 -(T,0,1)-> 22] 
Scheduling 1 (21) in pss_not_empty, checking s 2 (22): the node is not scheduled

Processing edge: [21 -(T,0,0)-> 22] 
Scheduling 1 (21) in pss_not_empty, checking s 2 (22): the node is not scheduled

Processing edge: [21 -(T,0,1)-> 18] 
Scheduling 1 (21) in pss_not_empty, checking s 0 (18): the node is not scheduled

Trying to schedule node 1                         INSN = 21  in (0 .. -8) step ----------------------------------------------------------------------------

I found this a bit difficult to read for a couple of reasons:

- There's no easy way of telling what the current value of ii is.

- The dump only gives the result of the mininum and maximum operations,
  so it's not always easy to tell what the limit calculated for each
  edge actually was.  E.g., in the output above, it's the first edge
  that sets the eventual early start of -8, so it's not obvious what
  (smaller) values were calculated for the other edges.

The output after the patch is:

---------------------------------------------------------------------------
Analyzing dependencies for node 1 (INSN 21); ii = 12

      start early start  late start         end  time

Comments

Revital1 Eres Aug. 4, 2011, 11:56 a.m. UTC | #1
Hello Richard,

> This patch adjusts the dump output from
modulo-sched.c:get_schdedule_window.
> Dump output is very much down to personal preference, so please feel free
> just to reject the change.

The output format looks great to me although I cannot approve it.

Thanks,
Revital
Bernd Schmidt Aug. 4, 2011, 12:23 p.m. UTC | #2
On 08/04/11 13:16, Richard Sandiford wrote:
> Tested in the same way as the previous patch.  OK to install?

You don't actually need to ask, and based on Revital's reaction, yes.


Bernd
diff mbox

Patch

=========== =========== =========== =========== =====
                     -8                      15     4 [27 -(O,0,1)-> 21] 
                    -11                      12     1 [25 -(A,0,1)-> 21] 
                    -12                      11     0 [24 -(O,0,1)-> 21] 
         -7                       4                 4 [21 -(O,0,0)-> 27] 
        -10                      13                 1 [21 -(T,0,1)-> 25] 
        -10                       1                 1 [21 -(T,0,0)-> 25] 
        -11                       0                 0 [21 -(O,0,0)-> 24] 
----------- ----------- ----------- ----------- -----
         -7          -8           0          11       (max, max, min, min)
                     -7           0                   final window

Trying to schedule node 1 INSN = 21  in (0 .. -8) step -1
---------------------------------------------------------------------------

Tested in the same way as the previous patch.  OK to install?

Richard


gcc/
	* modulo-sched.c (get_sched_window): Use a table for the debug output.
	Print the current ii.

Index: gcc/modulo-sched.c
===================================================================
--- gcc/modulo-sched.c	2011-08-04 12:03:53.000000000 +0100
+++ gcc/modulo-sched.c	2011-08-04 12:11:43.000000000 +0100
@@ -1658,44 +1658,41 @@  get_sched_window (partial_schedule_ptr p
   count_preds = psp_not_empty;
   count_succs = pss_not_empty;
 
+  if (dump_file && (psp_not_empty || pss_not_empty))
+    {
+      fprintf (dump_file, "\nAnalyzing dependencies for node %d (INSN %d)"
+	       "; ii = %d\n\n", u_node->cuid, INSN_UID (u_node->insn), ii);
+      fprintf (dump_file, "%11s %11s %11s %11s %5s\n",
+	       "start", "early start", "late start", "end", "time");
+      fprintf (dump_file, "=========== =========== =========== ==========="
+	       " =====\n");
+    }
   /* Calculate early_start and limit end.  Both bounds are inclusive.  */
   if (psp_not_empty)
     for (e = u_node->in; e != 0; e = e->next_in)
       {
 	ddg_node_ptr v_node = e->src;
 
-	if (dump_file)
-	  {
-	    fprintf (dump_file, "\nProcessing edge: ");
-	    print_ddg_edge (dump_file, e);
-	    fprintf (dump_file,
-		     "\nScheduling %d (%d) in psp_not_empty,"
-		     " checking p %d (%d): ", u_node->cuid,
-		     INSN_UID (u_node->insn), v_node->cuid, INSN_UID
-		     (v_node->insn));
-	  }
-
 	if (TEST_BIT (sched_nodes, v_node->cuid))
 	  {
 	    int p_st = SCHED_TIME (v_node);
+	    int earliest = p_st + e->latency - (e->distance * ii);
+	    int latest = (e->data_type == MEM_DEP ? p_st + ii - 1 : INT_MAX);
 
-	    early_start = MAX (early_start,
-			       p_st + e->latency - (e->distance * ii));
+	    if (dump_file)
+	      {
+		fprintf (dump_file, "%11s %11d %11s %11d %5d",
+			 "", earliest, "", latest, p_st);
+		print_ddg_edge (dump_file, e);
+		fprintf (dump_file, "\n");
+	      }
 
-	    if (e->data_type == MEM_DEP)
-	      end = MIN (end, p_st + ii - 1);
+	    early_start = MAX (early_start, earliest);
+	    end = MIN (end, latest);
 
 	    if (e->type == TRUE_DEP && e->data_type == REG_DEP)
 	      count_preds++;
-
-	    if (dump_file)
-	      fprintf (dump_file,
-		       "pred st = %d; early_start = %d; latency: %d;"
-		       " end: %d\n", p_st, early_start, e->latency, end);
-
 	  }
-	else if (dump_file)
-	  fprintf (dump_file, "the node is not scheduled\n");
       }
 
   /* Calculate late_start and limit start.  Both bounds are inclusive.  */
@@ -1704,40 +1701,37 @@  get_sched_window (partial_schedule_ptr p
       {
 	ddg_node_ptr v_node = e->dest;
 
-	if (dump_file)
-	  {
-	    fprintf (dump_file, "\nProcessing edge:");
-	    print_ddg_edge (dump_file, e);
-	    fprintf (dump_file,
-		     "\nScheduling %d (%d) in pss_not_empty,"
-		     " checking s %d (%d): ", u_node->cuid,
-		     INSN_UID (u_node->insn), v_node->cuid, INSN_UID
-		     (v_node->insn));
-	  }
-
 	if (TEST_BIT (sched_nodes, v_node->cuid))
 	  {
 	    int s_st = SCHED_TIME (v_node);
+	    int earliest = (e->data_type == MEM_DEP ? s_st - ii + 1 : INT_MIN);
+	    int latest = s_st - e->latency + (e->distance * ii);
 
-	    late_start = MIN (late_start,
-			      s_st - e->latency + (e->distance * ii));
+	    if (dump_file)
+	      {
+		fprintf (dump_file, "%11d %11s %11d %11s %5d",
+			 earliest, "", latest, "", s_st);
+		print_ddg_edge (dump_file, e);
+		fprintf (dump_file, "\n");
+	      }
 
-	    if (e->data_type == MEM_DEP)
-	      start = MAX (start, s_st - ii + 1);
+	    start = MAX (start, earliest);
+	    late_start = MIN (late_start, latest);
 
 	    if (e->type == TRUE_DEP && e->data_type == REG_DEP)
 	      count_succs++;
-
-	    if (dump_file)
-	      fprintf (dump_file,
-		       "succ st = %d; late_start = %d; latency = %d;"
-		       " start=%d", s_st, late_start, e->latency, start);
-
 	  }
-	else if (dump_file)
-	  fprintf (dump_file, "the node is not scheduled\n");
       }
 
+  if (dump_file && (psp_not_empty || pss_not_empty))
+    {
+      fprintf (dump_file, "----------- ----------- ----------- -----------"
+	       " -----\n");
+      fprintf (dump_file, "%11d %11d %11d %11d %5s %s\n",
+	       start, early_start, late_start, end, "",
+	       "(max, max, min, min)");
+    }
+
   /* Get a target scheduling window no bigger than ii.  */
   if (early_start == INT_MIN && late_start == INT_MAX)
     early_start = SCHED_ASAP (u_node);
@@ -1750,6 +1744,10 @@  get_sched_window (partial_schedule_ptr p
   end = MIN (end, late_start);
   step = 1;
 
+  if (dump_file && (psp_not_empty || pss_not_empty))
+    fprintf (dump_file, "%11s %11d %11d %11s %5s final window\n",
+	     "", start, end, "", "");
+
   /* If there are at least as many successors as predecessors, schedule the
      node close to its successors.  */
   if (count_succs && count_succs >= count_preds)
@@ -1957,8 +1955,8 @@  sms_schedule_by_order (ddg_ptr g, int mi
                                 &step, &end) == 0)
             {
               if (dump_file)
-                fprintf (dump_file, "\nTrying to schedule node %d \
-                        INSN = %d  in (%d .. %d) step %d\n", u, (INSN_UID
+                fprintf (dump_file, "\nTrying to schedule node %d "
+			 "INSN = %d  in (%d .. %d) step %d\n", u, (INSN_UID
                         (g->nodes[u].insn)), start, end, step);
 
               gcc_assert ((step > 0 && start < end)