[RFC] [PACH] [modulo-sched] avoid register moves

Vladimir Yanovsky volodyan@gmail.com
Thu Nov 16 17:31:00 GMT 2006


This patch addresses the third item on
http://gcc.gnu.org/wiki/SwingModuloScheduling:
Register moves are currently used to deal with overlapping life ranges
of the same variable from different iterations of the original loop
kernel. These register moves proved to be very costly causing SMS to
be virtually never profitable. In addition, if new instructions (i.e.
- register moves) are added, good profitability estimation is
necessary because we are risking a degradation here. One way to avoid
register moves would be to unroll and do register renaming to resolve
such dependences. Meanwhile, we have a patch to prevent insertion of
regmoves by scheduling each instruction not farther than II-1 cycles
from instructions dependent upon it, so that register moves will not
be necessary. In other words, we changed the scheduling windows
computation to prevent register moves.

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: common.opt
===================================================================
--- common.opt  (revision 623)
+++ common.opt  (working copy)
@@ -590,6 +590,14 @@
 Common Report Var(flag_modulo_sched)
 Perform SMS based modulo scheduling before the first scheduling pass

+
+fmodulo-sched-allow-regmoves
+Common Report Var(flag_modulo_sched_allow_regmoves)
+Perform SMS based modulo scheduling with register moves allowed
+
 fmove-loop-invariants
 Common Report Var(flag_move_loop_invariants)
 Move loop invariant computations out of loops



Index: modulo-sched.c
===================================================================
--- modulo-sched.c      (revision 623)
+++ modulo-sched.c      (working copy)
@@ -1424,7 +1447,7 @@

              early_start = MAX (early_start, node_st);

-             if (e->data_type == MEM_DEP)
+             if (!flag_modulo_sched_allow_regmoves || e->data_type == MEM_DEP)
                end = MIN (end, SCHED_TIME (v_node) + ii - 1);
            }
        }
@@ -1446,7 +1469,7 @@
              late_start = MIN (late_start,
                                SCHED_TIME (v_node) - e->latency
                                + (e->distance * ii));
-             if (e->data_type == MEM_DEP)
+             if (!flag_modulo_sched_allow_regmoves || e->data_type == MEM_DEP)
                end = MAX (end, SCHED_TIME (v_node) - ii + 1);
            }
        }
@@ -1471,7 +1494,7 @@
              early_start = MAX (early_start,
                                 SCHED_TIME (v_node) + e->latency
                                 - (e->distance * ii));
-             if (e->data_type == MEM_DEP)
+             if (!flag_modulo_sched_allow_regmoves || e->data_type == MEM_DEP)
                end = MIN (end, SCHED_TIME (v_node) + ii - 1);
            }
        }
@@ -1484,7 +1507,7 @@
              late_start = MIN (late_start,
                                SCHED_TIME (v_node) - e->latency
                                + (e->distance * ii));
-             if (e->data_type == MEM_DEP)
+             if (!flag_modulo_sched_allow_regmoves || e->data_type == MEM_DEP)
                start = MAX (start, SCHED_TIME (v_node) - ii + 1);
            }
        }



More information about the Gcc-patches mailing list