[PATCH SMS 2/2, RFC] Register pressure estimation for the partial schedule (re-submission)

Revital1 Eres ERES@il.ibm.com
Tue Jan 3 09:26:00 GMT 2012


Hello,

> On Mon, Jan 2, 2012 at 3:30 PM, Richard Sandiford
> <rdsandiford@googlemail.com> wrote:
> > Ayal Zaks <ayal.zaks@gmail.com> writes:
> >> +  for (i = 0; i < ira_pressure_classes_num; i++)
> >> +    {
> >> +      enum reg_class pressure_class;
> >> +
> >> +      pressure_class = ira_pressure_classes[i];
> >> +
> >> +      if (max_reg_pressure[pressure_class] == 0)
> >> +     continue;
> >> +
> >> +      if (dump_file)
> >> +     fprintf (dump_file, "%s=%d  %d ", reg_class_names
[pressure_class],
> >> +              max_reg_pressure[pressure_class],
> >> +              ira_available_class_regs[pressure_class]);
> >> +
> >> +      if (max_reg_pressure[pressure_class]
> >> +       > ira_class_hard_regs_num[pressure_class])
> >> +     {
> >> +       if (dump_file)
> >> +         fprintf (dump_file, "(pressure)\n");
> >> +
> >> +       pressure_p = true;
> >>
> >> you can "break;" now.
> >
> > FWIW, I thought the same thing at first, but I think Revital's wayis
better.
> > It's nice to know when looking at dumps whether there is excess
pressure
> > in more than one class.  This isn't performance-critical code after
all.
> >
>
> ok
>
> >> however, you have everything setup to compute the amount of spill, so
> >> suggest to do the following instead:
> >>
> >>           pressure += max_reg_pressure[pressure_class]
> >>                       - ira_class_hard_regs_num[pressure_class]);
> >>
> >> or better call the variable "spillage" instead of "pressure", and
> >> return it. Current use will only check if it's zero or positive.
> >
> > I read this suggestion in the same way as Revital seems to have done:
> > that we sum the pressure change over all classes.  But that isn't the
idea.
> > Using N too many registers in one pressure class cannot be mitigated by
> > leaving N registers in another pressure class unused.
> >
>
> of-course (wasn't thinking of spilling from one register file to
> another); meant to suggest doing:
>
> if (max_reg_pressure[pressure_class] > ira_class_hard_regs_num
> [pressure_class])
>   spillage += max_reg_pressure[pressure_class] -
> ira_class_hard_regs_num[pressure_class]);
>
>
> > TBH, the original version of this function looked better to me.
> >
>
> ok, it would surely suffice for now.
>

Attached is an updated version with the two changes mentioned above taken
from the previous patch.

Tested and bootstrap with the other patch in the series on
ppc64-redhat-linux, enabling SMS on loops with SC 1.

Thanks again,
Revital

2012-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
            Revital Eres  <revital.eres@linaro.org>

        * loop-invariant.c (get_regno_pressure_class): Move function to...
        * ira.c: Here.
        * common.opt (fmodulo-sched-reg-pressure, -fmodulo-sched-verbose):
        New flags.
        * doc/invoke.texi (fmodulo-sched-reg-pressure,
        -fmodulo-sched-verbose): Document the flags.
        * ira.h (get_regno_pressure_class,
        reset_pseudo_classes_defined_p): Declare.
        * ira-costs.c (reset_pseudo_classes_defined_p): New function.
        * Makefile.in (modulo-sched.o): Include ira.h and modulo-sched.h.
        (modulo-sched-pressure.o): New.
        * modulo-sched.c (ira.h, modulo-sched.h): New includes.
        (partial_schedule_ptr, ps_insn_ptr, struct ps_insn,
        struct ps_reg_move_info, struct partial_schedule): Move to
        modulo-sched.h.
        (ps_rtl_insn, ps_reg_move): Remove static.
        (apply_reg_moves): Remove static and call df_insn_rescan only
        if PS is final.
        (undo_reg_moves): New function.
        (sms_schedule): Call register pressure estimation.
        * modulo-sched.h: New file.
        * modulo-sched-pressure.c: New file.

(See attached file: patch_pressure_3_1_12.txt)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_pressure_3_1_12.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120103/5287f792/attachment.txt>


More information about the Gcc-patches mailing list