This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] [PACH] [modulo-sched] fix handling of anti-dependences


This patch addresses the fourth item on
http://gcc.gnu.org/wiki/SwingModuloScheduling:
 The way the profitability estimation of SMS currently works cripples SMS.
 This is because SMS attempts to verify that the insertion of all regmoves
 into the kernel does not increase its total cycle count, as determined by
 using the DFA engine (i.e. considering resource utilization and
 disregarding dependences). This inaccurate estimate was found to be overly
 conservative. We have a patch that drops the attempt to estimate the cost
 of inserting regmoves to the kernel, to help test and tune SMS. If the
 insertion of regmoves is found to be costly, one will be able to restrict
 SMS not to use regmoves

 The patch is not submitted yet for inclusion, just for comments (will be
 submitted for inclusion as soon as the SPU port is in, and retesting with
 updated mainline is done). It is part of the prerequisite to get the
 speedups described here: http://gcc.gnu.org/ml/gcc/2006-11/msg00577.html

thanks,

Vladimir.


Patch:

Index: modulo-sched.c
===================================================================
--- modulo-sched.c      (revision 623)
+++ modulo-sched.c      (working copy)
@@ -1173,7 +1221,7 @@
       mii = 1; /* Need to pass some estimate of mii.  */
       rec_mii = sms_order_nodes (g, mii, node_order);
       mii = MAX (res_MII (g), rec_mii);
-      maxii = (calculate_maxii (g) * SMS_MAX_II_FACTOR) / 100;
+      maxii = 2*mii;

@@ -1173,7 +1221,7 @@
       mii = 1; /* Need to pass some estimate of mii.  */
       rec_mii = sms_order_nodes (g, mii, node_order);
       mii = MAX (res_MII (g), rec_mii);
-      maxii = (calculate_maxii (g) * SMS_MAX_II_FACTOR) / 100;
+      maxii = 2*mii;

       if (stats_file)
        fprintf (stats_file, "SMS iis %d %d %d (rec_mii, mii, maxii)\n",
@@ -1207,8 +1255,6 @@
        }
       else
        {
-         int orig_cycles = kernel_number_of_cycles (BB_HEAD (g->bb),
BB_END (g->bb));
-         int new_cycles;
          struct undo_replace_buff_elem *reg_move_replaces;

          if (stats_file)
@@ -1221,7 +1267,7 @@
                       "SMS Branch (%d) will later be scheduled at cycle
%d.\n",
                       g->closing_branch->cuid, PS_MIN_CYCLE (ps) - 1);
            }
-
+
          /* Set the stage boundaries.  If the DDG is built with
closing_branch_deps,
             the closing_branch was scheduled and should appear in the last
(ii-1)
             row.  Otherwise, we are free to schedule the branch, and we
let nodes
@@ -1230,29 +1276,7 @@
          normalize_sched_times (ps);
          rotate_partial_schedule (ps, PS_MIN_CYCLE (ps));
          set_columns_for_ps (ps);
-
-         /* Generate the kernel just to be able to measure its cycles.  */
-         permute_partial_schedule (ps, g->closing_branch->first_note);
-         reg_move_replaces = generate_reg_moves (ps);
-
-         /* Get the number of cycles the new kernel expect to execute in.
*/
-         new_cycles = kernel_number_of_cycles (BB_HEAD (g->bb), BB_END
(g->bb));
-
-         /* Get back to the original loop so we can do loop versioning.
*/
-         undo_permute_partial_schedule (ps,
g->closing_branch->first_note);
-         if (reg_move_replaces)
-           undo_generate_reg_moves (ps, reg_move_replaces);
-
-         if ( new_cycles >= orig_cycles)
-           {
-             /* SMS is not profitable so undo the permutation and reg move
generation
-                and return the kernel to its original state.  */
-             if (dump_file)
-               fprintf (dump_file, "Undoing SMS because it is not
profitable.\n");
-
-           }
-         else
-           {
+
              canon_loop (loop);

               /* case the BCT count is not known , Do loop-versioning */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]