From: Teresa Johnson <tejohnson@google.com>
To: Jeff Law <law@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Jan Hubicka <hubicka@ucw.cz>, David Li <davidxl@google.com>
Subject: Re: [PATCH] Redesign jump threading profile updates
Date: Wed, 23 Jul 2014 21:52:00 -0000 [thread overview]
Message-ID: <CAAe5K+UM+gXeSuunYbMz-Ln14kbb5-v0=Ysox1CUQ2esrfwU-A@mail.gmail.com> (raw)
In-Reply-To: <53CF1DFD.7080805@redhat.com>
On Tue, Jul 22, 2014 at 7:29 PM, Jeff Law <law@redhat.com> wrote:
> On 03/26/14 17:44, Teresa Johnson wrote:
>>
>> Recently I discovered that the profile updates being performed by jump
>> threading were incorrect in many cases, particularly in the case where
>> the threading path contains a joiner. Some of the duplicated
>> blocks/edges were not getting any counts, leading to incorrect
>> function splitting and other downstream optimizations, and there were
>> other insanities as well. After making a few attempts to fix the
>> handling I ended up completely redesigning the profile update code,
>> removing a few places throughout the code where it was attempting to
>> do some updates.
>>
>> The biggest complication (see the large comment and example above the
>> new routine compute_path_counts) is that we duplicate a conditional
>> jump in the joiner case, possibly multiple times for multiple jump
>> thread paths through that joiner, and it isn't trivial to figure out
>> what probability to assign each of the duplicated successor edges (and
>> the original after threading). Each jump thread path may need to have
>> a different probability of staying on path through the joiner in order
>> to keep the counts going out of the threading path sane.
>>
>> The patch below was bootstrapped and tested on
>> x86_64-unknown-linux-gnu, and also tested with a profiledbootstrap. I
>> additionally tested with cpu2006, confirming that the amount of
>> resulting cycle samples in the split cold sections reduced, and
>> through manual inspection that many different cases were now correct.
>> I also measured performance with cpu2006, running each benchmark
>> multiple times on a Westmere and see some speedups (453.povray 1-2%,
>> 403.gcc 1-1.5%, and noisy but positive speedups in 471.omnetpp and
>> 483.xalancbmk).
>>
>> Looks like my mailer is corrupting the spacing, which makes it harder
>> to look at the CFG examples in the big header comment block I added.
>> So I have also included the patch as an attachment.
>>
>> Ok for stage 1?
>>
>> Thanks,
>> Teresa
>>
>> 2014-03-26 Teresa Johnson <tejohnson@google.com>
>>
>> * tree-ssa-threadupdate.c (struct ssa_local_info_t): New
>> duplicate_blocks bitmap.
>> (remove_ctrl_stmt_and_useless_edges): Ditto.
>> (create_block_for_threading): Ditto.
>> (compute_path_counts): New function.
>> (update_profile): Ditto.
>> (deduce_freq): Ditto.
>> (recompute_probabilities): Ditto.
>> (update_joiner_offpath_counts): Ditto.
>> (ssa_fix_duplicate_block_edges): Update profile info.
>> (ssa_create_duplicates): Pass new parameter.
>> (ssa_redirect_edges): Remove old profile update.
>> (thread_block_1): New duplicate_blocks bitmap,
>> remove old profile update.
>> (thread_single_edge): Pass new parameter.
>
> First off, sorry this took so long to get reviewed.
>
> Most of what's going on in here is similar to something I sketched out, but
> never coded up a while back -- with the significant difference that you're
> handling joiner blocks as well.
>
> Everything looks to be well thought through and documented in the code at a
> level I wish existed throughout GCC.
>
> The only thing I see missing is regression tests. I don't think you need to
> do anything huge here, but it ought to be possible to set up relatively
> simple cases which show the probabilities/counts being updated properly.
>
> Otherwise it looks excellent. It's pre-approved once you've added some kind
> of testing and fixed the nits noted below.
Thanks! I will fix the issues you note below and create some test
cases before I commit.
Teresa
>
>
>
>> + In the aboe example, after all jump threading is complete, we will
>
> s/aboe/above/
>
>
>
>> + struct el *next, *el;
>> + bitmap in_edge_srcs = BITMAP_ALLOC (NULL);
>> + for (el = rd->incoming_edges; el; el = next)
>> + {
>> + next = el->next;
>> + bitmap_set_bit (in_edge_srcs, el->e->src->index);
>> + }
>
> Please add vertical whitespace after this loop, but before declaring
> variables for the next loop.
>
> Jeff
>
--
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
next prev parent reply other threads:[~2014-07-23 21:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-26 23:57 Teresa Johnson
2014-04-17 5:58 ` Jeff Law
2014-04-17 13:46 ` Teresa Johnson
2014-05-27 14:11 ` Teresa Johnson
2014-07-07 21:22 ` Teresa Johnson
2014-07-07 21:24 ` Jeff Law
2014-07-23 13:47 ` Jeff Law
2014-07-23 21:52 ` Teresa Johnson [this message]
2014-08-02 5:10 ` Teresa Johnson
2014-08-02 5:16 ` Andrew Pinski
2014-09-29 14:20 ` Teresa Johnson
2014-09-30 4:33 ` Jeff Law
2014-09-30 18:20 ` Teresa Johnson
2014-10-01 7:03 ` Christophe Lyon
2014-10-01 13:21 ` Teresa Johnson
2014-10-01 14:05 ` Teresa Johnson
2014-10-01 15:23 ` Sebastian Pop
2014-10-01 15:25 ` Christophe Lyon
2014-10-01 15:29 ` Teresa Johnson
2014-10-01 16:20 ` H.J. Lu
2014-10-01 16:23 ` Teresa Johnson
2014-10-01 20:05 ` Teresa Johnson
2014-10-01 22:46 ` Steve Ellcey
2014-10-02 5:02 ` Teresa Johnson
2014-10-02 15:44 ` Teresa Johnson
2014-10-02 15:45 ` Steve Ellcey
2014-10-02 16:01 ` Teresa Johnson
2014-10-01 23:09 ` Jan Hubicka
2014-10-02 5:07 ` Teresa Johnson
2014-10-02 18:34 ` Jeff Law
2014-10-28 16:01 ` Renlin Li
2014-10-01 15:36 ` Sebastian Pop
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='CAAe5K+UM+gXeSuunYbMz-Ln14kbb5-v0=Ysox1CUQ2esrfwU-A@mail.gmail.com' \
--to=tejohnson@google.com \
--cc=davidxl@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=law@redhat.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).