public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39141]  New: overzealous unrolling (peeling) destroys code locality
@ 2009-02-09 16:18 amylaar at gcc dot gnu dot org
  2009-03-04 19:09 ` [Bug tree-optimization/39141] " amylaar at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2009-02-09 16:18 UTC (permalink / raw)
  To: gcc-bugs

I see a 50% cycle increase for EEMBC idctrn01 going from gcc 4.2.1 to gcc 4.4 .
There are two issues, overzealous unrolling, and constant propagation in the
unrolled loops.
While both issues can be avoided by reducing the parameter
"max-completely-peeled-insns" to 200, this is not really satisfactory, since
that is a rather fragile parameter setting and is not really related to the
problem, and it holds other code back, like EEMBC viterb00 benchmark, which
looses 5% performance with that setting.

There are a number of loops which are completely unrolled,
thus pushing their containing loop size above the size of the instruction
cache.  There is no point in doing such unrolling, since it is more expensive
to fill the instruction cache with an unrolled loop than to execute a rolled
loop.
I have implemented a heuristic to estimate the size of the outer loop (or
function in absence of an outer loop) assuming that its inner loops will be
unrolled in accordance with PARAM_MAX_UNROLL_TIMES, PARAM_MAX_UNROLLED_INSNS
and PARAM_MAX_COMPLETELY_PEEL_TIMES, and if that size exceeds a threshold
(a new parameter), complete unrolling is inhibited.

This change has reduced the idctrn01 regression to 13.7% while leaving the
other EEMBC benchmarks alone.
I expect that I can address the remaining performance regression by
inhibiting inappropriate constant propagation - there are 798 addresses
of the form absolute address+offset in the main benchmark assembly file,
each of which translates into one instruction word too many, in total
20% of the text size of that module.

I can post the unroller heuristic patch as soon as we have the confirmation
from the FSF that they have filed the Copyright Assignment we gave them
last year.


-- 
           Summary: overzealous unrolling (peeling) destroys code locality
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39141


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

* [Bug tree-optimization/39141] overzealous unrolling (peeling) destroys code locality
  2009-02-09 16:18 [Bug tree-optimization/39141] New: overzealous unrolling (peeling) destroys code locality amylaar at gcc dot gnu dot org
@ 2009-03-04 19:09 ` amylaar at gcc dot gnu dot org
  2009-03-05  0:34 ` amylaar at gcc dot gnu dot org
  2010-01-27 20:04 ` amylaar at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2009-03-04 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from amylaar at gcc dot gnu dot org  2009-03-04 19:08 -------
patch submitted


-- 

amylaar at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|39302                       |
         AssignedTo|unassigned at gcc dot gnu   |amylaar at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
           Keywords|                            |patch
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-04 19:08:52
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39141


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

* [Bug tree-optimization/39141] overzealous unrolling (peeling) destroys code locality
  2009-02-09 16:18 [Bug tree-optimization/39141] New: overzealous unrolling (peeling) destroys code locality amylaar at gcc dot gnu dot org
  2009-03-04 19:09 ` [Bug tree-optimization/39141] " amylaar at gcc dot gnu dot org
@ 2009-03-05  0:34 ` amylaar at gcc dot gnu dot org
  2010-01-27 20:04 ` amylaar at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2009-03-05  0:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from amylaar at gcc dot gnu dot org  2009-03-05 00:33 -------
The patch is here:
http://gcc.gnu.org/ml/gcc-patches/2009-03/msg00231.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39141


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

* [Bug tree-optimization/39141] overzealous unrolling (peeling) destroys code locality
  2009-02-09 16:18 [Bug tree-optimization/39141] New: overzealous unrolling (peeling) destroys code locality amylaar at gcc dot gnu dot org
  2009-03-04 19:09 ` [Bug tree-optimization/39141] " amylaar at gcc dot gnu dot org
  2009-03-05  0:34 ` amylaar at gcc dot gnu dot org
@ 2010-01-27 20:04 ` amylaar at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2010-01-27 20:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from amylaar at gcc dot gnu dot org  2010-01-27 20:04 -------
Subject: Bug 39141

Author: amylaar
Date: Wed Jan 27 20:03:57 2010
New Revision: 156301

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156301
Log:
        PR tree-optimization/39141
        * tree-ssa-loop-manip.c (gimple_can_duplicate_loop_to_header_edge):
        New function.
        * tree-ssa-loop-ivcanon.c (enum unroll_level): New value
        UL_ESTIMATE_GROWTH.
        (try_unroll_loop_completely): Handle UL_ESTIMATE_GROWTH.
        (canonicalize_loop_induction_variables): Likewise.
        (tree_unroll_loops_completely): Don't completely unroll loops where
        the outer loop/function is larger than
        PARAM_MAX_COMPLETELY_PEELED_OUTER_INSNS, or will/would become thus
        due to unrolling.
        * cfgloop.h (enum li_flags): New value LI_REALLY_FROM_INNERMOST.
        (fel_init): Handle LI_REALLY_FROM_INNERMOST.
        * tree-flow.h (gimple_can_duplicate_loop_to_header_edge): Declare.
        * params.def (PARAM_MAX_COMPLETELY_PEELED_OUTER_INSNS): New parameter.

Added:
    branches/mpost-opt-imp-20100127/gcc/ChangeLog.mpost
Modified:
    branches/mpost-opt-imp-20100127/gcc/cfgloop.h
    branches/mpost-opt-imp-20100127/gcc/params.def
    branches/mpost-opt-imp-20100127/gcc/tree-flow.h
    branches/mpost-opt-imp-20100127/gcc/tree-ssa-loop-ivcanon.c
    branches/mpost-opt-imp-20100127/gcc/tree-ssa-loop-manip.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39141


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

end of thread, other threads:[~2010-01-27 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-09 16:18 [Bug tree-optimization/39141] New: overzealous unrolling (peeling) destroys code locality amylaar at gcc dot gnu dot org
2009-03-04 19:09 ` [Bug tree-optimization/39141] " amylaar at gcc dot gnu dot org
2009-03-05  0:34 ` amylaar at gcc dot gnu dot org
2010-01-27 20:04 ` amylaar at gcc dot gnu dot org

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