* Re: Why vectorization didn't turn on by -O2
[not found] ` <20210804211812.GK1583@gate.crashing.org>
@ 2021-08-06 5:01 ` Hongtao Liu
0 siblings, 0 replies; only message in thread
From: Hongtao Liu @ 2021-08-06 5:01 UTC (permalink / raw)
To: GCC Patches, GCC Development
Cc: Richard Biener, Jan Hubicka, bin.cheng, 172060045,
Richard Sandiford, Segher Boessenkool
On Thu, Aug 5, 2021 at 5:20 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Wed, Aug 04, 2021 at 11:22:53AM +0100, Richard Sandiford wrote:
> > Segher Boessenkool <segher@kernel.crashing.org> writes:
> > > On Wed, Aug 04, 2021 at 10:10:36AM +0100, Richard Sandiford wrote:
> > >> Richard Biener <rguenther@suse.de> writes:
> > >> > Alternatively only enable loop vectorization at -O2 (the above checks
> > >> > flag_tree_slp_vectorize as well). At least the cost model kind
> > >> > does not have any influence on BB vectorization, that is, we get the
> > >> > same pros and cons as we do for -O3.
> > >>
> > >> Yeah, but a lot of the loop vector cost model choice is about controlling
> > >> code size growth and avoiding excessive runtime versioning tests.
> > >
> > > Both of those depend a lot on the target, and target-specific conditions
> > > as well (which CPU model is selected for example). Can we factor that
> > > in somehow? Maybe we need some target hook that returns the expected
> > > percentage code growth for vectorising a given loop, for example, and
> > > -O2 vs. -O3 then selects what percentage is acceptable.
> > >
> > >> BB SLP
> > >> should be a win on both code size and performance (barring significant
> > >> target costing issues).
> > >
> > > Yeah -- but this could use a similar hook as well (just a straightline
> > > piece of code instead of a loop).
> >
> > I think anything like that should be driven by motivating use cases.
> > It's not something that we can easily decide in the abstract.
> >
> > The results so far with using very-cheap at -O2 have been promising,
> > so I don't think new hooks should block that becoming the default.
>
> Right, but it wouldn't hurt to think a sec if we are on the right path
> forward. It's is crystal clear that to make good decisions about what
> and how to vectorise you need to take *some* target characteristics into
> account, and that will have to happen sooner rather than later.
>
> This was all in reply to
>
> > >> Yeah, but a lot of the loop vector cost model choice is about controlling
> > >> code size growth and avoiding excessive runtime versioning tests.
>
> It was not meant to hold up these patches :-)
>
> > >> PR100089 was an exception because we ended up keeping unvectorised
> > >> scalar code that would never have existed otherwise. BB SLP proper
> > >> shouldn't have that problem.
> > >
> > > It also is a tiny piece of code. There will always be tiny examples
> > > that are much worse (or much better) than average.
> >
> > Yeah, what makes PR100089 important isn't IMO the test itself, but the
> > underlying problem that the PR exposed. Enabling this “BB SLP in loop
> > vectorisation” code can lead to the generation of scalar COND_EXPRs even
> > though we know that ifcvt doesn't have a proper cost model for deciding
> > whether scalar COND_EXPRs are a win.
> >
> > Introducing scalar COND_EXPRs at -O3 is arguably an acceptable risk
> > (although still dubious), but I think it's something we need to avoid
> > for -O2, even if that means losing the optimisation.
>
> Yeah -- -O2 should almost always do the right thing, while -O3 can do
> bad things more often, it just has to be better "on average".
>
>
> Segher
Move thread to gcc-patches and gcc
--
BR,
Hongtao
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-06 4:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <nycvar.YFH.7.76.2105101018060.9200@zhemvz.fhfr.qr>
[not found] ` <20210510092440.GY10366@gate.crashing.org>
[not found] ` <20210517160309.GA27888@kam.mff.cuni.cz>
[not found] ` <mpt7djxw5n6.fsf@arm.com>
[not found] ` <CAMZc-bx-ieOvN7phQrWpjZbZEemNEe08LNaM-7As9C4wny9n3A@mail.gmail.com>
[not found] ` <mptbl6daab0.fsf@arm.com>
[not found] ` <nycvar.YFH.7.76.2108041028300.11781@zhemvz.fhfr.qr>
[not found] ` <mptbl6d8tir.fsf@arm.com>
[not found] ` <20210804095643.GC1583@gate.crashing.org>
[not found] ` <mpttuk57blu.fsf@arm.com>
[not found] ` <20210804211812.GK1583@gate.crashing.org>
2021-08-06 5:01 ` Why vectorization didn't turn on by -O2 Hongtao Liu
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).