This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC: AArch64] Parametrically set defaults for function and jump alignment
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Fri, 14 Nov 2014 10:50:49 +0000
- Subject: Re: [RFC: AArch64] Parametrically set defaults for function and jump alignment
- Authentication-results: sourceware.org; auth=none
- References: <1415961336-1986-1-git-send-email-james dot greenhalgh at arm dot com> <CA+=Sn1meBqrbAmHsVP8-d4ZDtzsrr0NwenAV+V-tJzDF3m7JDg at mail dot gmail dot com>
On Fri, Nov 14, 2014 at 10:42:27AM +0000, Andrew Pinski wrote:
> On Fri, Nov 14, 2014 at 2:35 AM, James Greenhalgh
> <james.greenhalgh@arm.com> wrote:
> >
> > Hi,
> >
> > We currently do not set any interesting default values for jump and function
> > alignment in AArch64. I've made the formula for these values derive from
> > the issue rate of the processor as so:
> >
> > jumps: 4 * processor issue-rate (rounded down to nearest power of two)
> > functions: 4 * processor issue-rate (rounded up to nearest power of two)
> >
> > This is sensible for the ARMv8-a implementations I tested on. An
> > alternative patch would make these values new fields in the tuning
> > tables.
>
> I had submitted an alternative patch a few hours ago which allows the
> tuning structure say what alignment is wanted for all three:
> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01615.html
D'oh! I should have flicked through gcc-patches before hitting send!
I imagine I'm encoding similar logic to that you used when writing
this patch.
I'm happy with either approach, so I'll leave it to the maintainers to
decide which they prefer.
> >
> > This happens to work well for some benchmarks and doesn't harm others.
> > The benefit swings depending on the existing alignment and the knock-on
> > effects.
> >
> > Bootstrapped on aarch64-none-linux-gnu with no issues.
> >
> > Does anyone have any thoughts or preferences as to how we set these
> > values in future? If not, OK For trunk?
>
> Also I notice you don't align loops, was that an oversight or just you
> did not think it was needed?
I didn't think it was needed, and saw some performance issues when
benchmarking with it on. I found these parameters to be very fickle
in the way they change performance. It is easy to end up with a
bunch of cold loops needlessly padding out the binary and therefore
the cache.
It might be that hard-coding loop alignment to 8 for all cores is
sensible, but I don't have data either way.
Cheers,
James
> > ---
> > 2014-11-14 James Greenhalgh <james.greenhalgh@arm.com>
> >
> > * config/aarch64/aarch64.c (aarch64_override_options): Set default
> > alignments for functions and jumps.
>