From: Aldy Hernandez <aldyh@redhat.com>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: Andrew MacLeod <amacleod@redhat.com>,
GCC patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Replace VRP threader with a hybrid forward threader.
Date: Mon, 27 Sep 2021 17:27:43 +0200 [thread overview]
Message-ID: <0dc3521b-8d91-6e55-5d7d-7ee513c17c0f@redhat.com> (raw)
In-Reply-To: <5cd175c7-5dbb-e160-9dd2-85dcfe438059@gmail.com>
On 9/27/21 5:01 PM, Jeff Law wrote:
>
>
> On 9/24/2021 9:46 AM, Aldy Hernandez wrote:
>> This patch implements the new hybrid forward threader and replaces the
>> embedded VRP threader with it.
> But most importantly, it pulls it out of the VRP pass as we no longer
> need the VRP data or ASSERT_EXPRs.
Yes, I have a follow-up patch removing the old mini-pass.
>
>>
>> With all the pieces that have gone in, the implementation of the hybrid
>> threader is straightforward: convert the current state into
>> SSA imports that the solver will understand, and let the path solver
>> precompute ranges and relations for the path. After this setup is done,
>> we can use the range_query API to solve gimple statements in the
>> threader.
>> The forward threader is now engine agnostic so there are no changes to
>> the threader per se.
> So the big question is do we think it's going to be this clean when we
> try to divorce the threading from DOM?
Interestingly, yes. With all the refactoring I've done, it turns out
that divorcing evrp from the DOM threader is a matter of having
dom_jt_simplifier inherit from hybrid_jt_simplifier instead of the base
class. Then we have simplify() look at the const_copies/avails,
otherwise let the hybrid simplifier do its thing. Yes, I was amazed too.
As usual there are caveats:
First, notice that we'd still depend on const_copies/avails, because
we'd need them for floats anyhow. But this has the added benefit of
catching a few things in the presence of the IL changing from under us.
Second, it turns out that DOM has other uses of evrp that need to be
addressed-- particularly its use of evrp to do its simple copy prop.
Be that as it may, none of these are show stoppers. I have a proof of
concept that converts everything with a few lines of code.
The big issue now is performance. Plugging in the full ranger makes it
uncomfortably slower than just using evrp. Andrew has some ideas for a
super fast ranger that doesn't do full look-ups, so we have finally
found a good use case for something we had in the back burner.
Now, numbers...
Converting the DOM threader to a hybrid client improves DOM threading
counts by 4%, but it's all at the expense of other passes. The total
threading counts was unchanged (well, it got worse by -0.05%). It
doesn't look like there's any gain. We're shuffling things around at
this point.
>
>>
>> I have put the hybrid bits in tree-ssa-threadedge.*, instead of VRP,
>> because they will also be used in the evrp removal of the DOM/threader,
>> which is my next task.
> Sweet.
>
>>
>> Most of the patch, is actually test changes. I have gone through every
>> single one and verified that we're correct. Most were trivial dump
>> file name changes, but others required going through the IL an
>> certifying that the different IL was expected.
>>
>> For example, in pr59597.c, we have one less thread because the
>> ASSERT_EXPR was getting in the way, and making it seem like things were
>> not crossing loops. The hybrid threader sees the correct representation
>> of the IL, and avoids threading this one case.
>>
>> The final numbers are a 12.16% improvement in jump threads immediately
>> after VRP, and a 0.82% improvement in overall jump threads. The
>> performance drop is 0.6% (plus the 1.43% hit from moving the embedded
>> threader into its own pass). As I've said, I'd prefer to keep the
>> threader in its own pass, but if this is an issue, we can address this
>> with a shared ranger when VRP is replaced with an evrp instance
>> (upcoming).
> Presumably we're also seeing a cannibalization of threads from later
> passes. And just to be clear, this is good.
>
> And the big question, is the pass running after VRP2 doing anything
> particularly useful? Do we want to try and kill it now, or later?
Interesting question. Perhaps if we convert DOM threading to a hybrid
model, it will render the post-VRP threader completely useless. Huhh...
That could kill 2 birds with one stone... we get rid of a threading
pass, and we don't need to worry about as much about the super-fast ranger.
Huh...good idea. I will experiment.
Thanks.
Aldy
next prev parent reply other threads:[~2021-09-27 15:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 15:46 Aldy Hernandez
2021-09-25 19:25 ` Bernhard Reutner-Fischer
[not found] ` <C9A89E9C-89D4-45A9-8DFC-BA0536D24611@gmail.com>
[not found] ` <CAGm3qMVTw4hEvqNJmSaXbuUArYjMUoX7o-YOgMi2bLAm1i12-Q@mail.gmail.com>
2021-09-29 9:20 ` Bernhard Reutner-Fischer
2021-09-29 15:45 ` Jeff Law
2021-09-27 15:01 ` Jeff Law
2021-09-27 15:27 ` Aldy Hernandez [this message]
2021-09-27 16:07 ` Aldy Hernandez
2021-09-27 17:28 ` Richard Biener
2021-10-14 12:29 ` Aldy Hernandez
2021-10-14 12:47 ` Richard Biener
2021-10-01 10:55 ` Gerald Pfeifer
2021-10-01 11:03 ` Aldy Hernandez
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=0dc3521b-8d91-6e55-5d7d-7ee513c17c0f@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@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).