From: Andrea Corallo <andrea.corallo@arm.com>
To: Andrew Pinski <pinskia@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, nd <nd@arm.com>,
Richard Earnshaw <richard.earnshaw@arm.com>
Subject: Re: [PATCH 2/2] Aarch64: Add branch diluter pass
Date: Wed, 22 Jul 2020 15:53:34 +0200 [thread overview]
Message-ID: <gkrpn8ny7tt.fsf@arm.com> (raw)
In-Reply-To: <CA+=Sn1nOLsVSuGUTBPPq9hWLnaD7uwQHsZ1EUhYJ284NL6y4fA@mail.gmail.com> (Andrew Pinski's message of "Wed, 22 Jul 2020 03:39:33 -0700")
Hi Andrew,
thanks for reviewing I'll work on your comments. Just replying to the
high level questions.
Andrew Pinski <pinskia@gmail.com> writes:
> On Wed, Jul 22, 2020 at 3:10 AM Andrea Corallo <andrea.corallo@arm.com> wrote:
>>
>> Hi all,
>>
>> this second patch implements the AArch64 specific back-end pass
>> 'branch-dilution' controllable by the followings command line options:
>>
>> -mbranch-dilution
>>
>> --param=aarch64-branch-dilution-granularity={num}
>>
>> --param=aarch64-branch-dilution-max-branches={num}
>>
>> Some cores known to be able to benefit from this pass have been given
>> default tuning values for their granularity and max-branches. Each
>> affected core has a very specific granule size and associated max-branch
>> limit. This is a microarchitecture specific optimization. Typical
>> usage should be -mbranch-dilution with a specified -mcpu. Cores with a
>> granularity tuned to 0 will be ignored. Options are provided for
>> experimentation.
>
> Can you give a simple example of what this patch does?
Sure, this pass simply moves a sliding window over the insns trying to
make sure that we never have more then 'max_branch' branches for every
'granule_size' insns.
If too many branches are detected nops are added where considered less
armful to correct that.
There are obviously many scenarios where the compiler can generate a
branch dense pieces of code but say we have the equivalent of:
====
.L389:
bl foo
b .L43
.L388:
bl foo
b .L42
.L387:
bl foo
b .L41
.L386:
bl foo
b .L40
====
Assuming granule size 4 and max branches 2 this will be transformed in
the equivalent of:
====
.L389:
bl foo
b .L43
nop
nop
.L388:
bl foo
b .L42
nop
nop
.L387:
bl foo
b .L41
nop
nop
.L386:
bl foo
b .L40
nop
nop
====
> Also your testcases seem too sensitive to other optimizations which
> could happen. E.g. the call to "branch (i)" could be pulled out of
> the switch statement. Or even the "*i += N;" could be moved to one
> Basic block and the switch becomes just one if statement.
>
>> Observed performance improvements on Neoverse N1 SPEC CPU 2006 where
>> up to ~+3% (xalancbmk) and ~+1.5% (sjeng). Average code size increase
>> for all the testsuite proved to be ~0.4%.
>
> Also does this improve any non-SPEC benchmarks or has it only been
> benchmarked with SPEC?
So far I tried it only on SPEC 2006. The transformation is not
benchmark specific tho, other code may benefit from it.
Thanks
Andrea
next prev parent reply other threads:[~2020-07-22 13:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 10:02 [PATCH 1/2] Add new RTX instruction class FILLER_INSN Andrea Corallo
2020-07-22 10:09 ` [PATCH 2/2] Aarch64: Add branch diluter pass Andrea Corallo
2020-07-22 10:39 ` Andrew Pinski
2020-07-22 13:53 ` Andrea Corallo [this message]
2020-07-22 16:43 ` Segher Boessenkool
2020-07-22 19:45 ` Andrea Corallo
2020-07-23 22:47 ` Segher Boessenkool
2020-07-24 7:01 ` Andrea Corallo
2020-07-24 11:53 ` Segher Boessenkool
2020-07-24 13:21 ` Andrea Corallo
2020-07-24 22:09 ` Segher Boessenkool
2020-07-28 18:55 ` Andrea Corallo
2020-07-28 22:07 ` Segher Boessenkool
2020-07-22 12:24 ` [PATCH 1/2] Add new RTX instruction class FILLER_INSN Richard Biener
2020-07-22 13:16 ` Richard Earnshaw (lists)
2020-07-22 14:51 ` Andrea Corallo
2020-07-22 18:41 ` Joseph Myers
2020-07-24 21:18 ` Segher Boessenkool
2020-07-26 18:19 ` Eric Botcazou
2020-07-28 19:29 ` Andrea Corallo
2020-08-19 9:13 ` Andrea Corallo
2020-08-19 10:52 ` Richard Sandiford
2020-08-19 17:28 ` Segher Boessenkool
2020-08-19 16:51 ` Segher Boessenkool
2020-08-19 17:47 ` Andrea Corallo
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=gkrpn8ny7tt.fsf@arm.com \
--to=andrea.corallo@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nd@arm.com \
--cc=pinskia@gmail.com \
--cc=richard.earnshaw@arm.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).