From: Maxim Kuvyrkov <maxim@codesourcery.com>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Add capability to run several iterations of early optimizations
Date: Tue, 18 Oct 2011 03:00:00 -0000 [thread overview]
Message-ID: <01F22181-5EA1-46B1-95F6-0F24B92E5FC9@codesourcery.com> (raw)
In-Reply-To: <CAFiYyc3R0r2Gc4bn1dqsx3eiv76yMKj59y2-068mJh5AoAEnyw@mail.gmail.com>
On 13/10/2011, at 12:58 AM, Richard Guenther wrote:
> On Wed, Oct 12, 2011 at 8:50 AM, Maxim Kuvyrkov <maxim@codesourcery.com> wrote:
>> The following patch adds new knob to make GCC perform several iterations of early optimizations and inlining.
>>
>> This is for dont-care-about-compile-time-optimize-all-you-can scenarios. Performing several iterations of optimizations does significantly improve code speed on a certain proprietary source base. Some hand-tuning of the parameter value is required to get optimum performance. Another good use for this option is for search and ad-hoc analysis of cases where GCC misses optimization opportunities.
>>
>> With the default setting of '1', nothing is changed from the current status quo.
>>
>> The patch was bootstrapped and regtested with 3 iterations set by default on i686-linux-gnu. The only failures in regression testsuite were due to latent bugs in handling of EH information, which are being discussed in a different thread.
>>
>> Performance impact on the standard benchmarks is not conclusive, there are improvements in SPEC2000 of up to 4% and regressions down to -2%, see [*]. SPEC2006 benchmarks will take another day or two to complete and I will update the spreadsheet then. The benchmarks were run on a Core2 system for all combinations of {-m32/-m64}{-O2/-O3}.
>>
>> Effect on compilation time is fairly predictable, about 10% compile time increase with 3 iterations.
>>
>> OK for trunk?
>
> I don't think this is a good idea, especially in the form you implemented it.
>
> If we'd want to iterate early optimizations we'd want to do it by iterating
> an IPA pass so that we benefit from more precise size estimates
> when trying to inline a function the second time.
Could you elaborate on this a bit? Early optimizations are gimple passes, so I'm missing your point here.
> Also statically
> scheduling the passes will mess up dump files and you have no
> chance of say, noticing that nothing changed for function f and its
> callees in iteration N and thus you can skip processing them in
> iteration N + 1.
Yes, these are the shortcomings. The dump files name changes can be fixed, e.g., by adding a suffix to the passes on iterations after the first one. The analysis to avoid unnecessary iterations is more complex problem.
>
> So, at least you should split the pass_early_local_passes IPA pass
> into three, you'd iterate over the 2nd (definitely not over pass_split_functions
> though), the third would be pass_profile and pass_split_functions only.
> And you'd iterate from the place the 2nd IPA pass is executed, not
> by scheduling them N times.
OK, I will look into this.
>
> Then you'd have to analyze the compile-time impact of the IPA
> splitting on its own when not iterating. Then you should look
> at what actually was the optimizations that were performed
> that lead to the improvement (I can see some indirect inlining
> happening, but everything else would be a bug in present
> optimizers in the early pipeline - they are all designed to be
> roughly independent on each other and _not_ expose new
> opportunities by iteration). Thus - testcases?
The initial motivation for the patch was to enable more indirect inlining and devirtualization opportunities. Since then I found the patch to be helpful in searching for optimization opportunities and bugs. E.g., SPEC2006's 471.omnetpp drops 20% with 2 additional iterations of early optimizations [*]. Given that applying more optimizations should, theoretically, not decrease performance, there is likely a very real bug or deficiency behind that.
Thank you,
[*] https://docs.google.com/spreadsheet/ccc?key=0AvK0Y-Pgj7bNdFBQMEJ6d3laeFdvdk9lQ1p0LUFkVFE&hl=en_US
--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics
next prev parent reply other threads:[~2011-10-17 23:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-12 8:14 Maxim Kuvyrkov
2011-10-12 12:15 ` Richard Guenther
2011-10-18 3:00 ` Maxim Kuvyrkov [this message]
2011-10-18 9:09 ` Richard Guenther
2011-10-27 23:29 ` Maxim Kuvyrkov
2011-10-28 11:12 ` Richard Guenther
2011-10-28 23:07 ` Maxim Kuvyrkov
2011-10-29 0:10 ` Matt
2011-11-01 20:48 ` Martin Jambor
2011-11-01 21:33 ` Richard Guenther
2011-11-08 7:23 ` Maxim Kuvyrkov
2011-11-08 11:18 ` Richard Guenther
2011-10-27 22:47 Matt
2011-10-28 10:01 ` Richard Guenther
2011-10-28 22:30 ` Matt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01F22181-5EA1-46B1-95F6-0F24B92E5FC9@codesourcery.com \
--to=maxim@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).