public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together
@ 2020-07-03  9:11 rguenth at gcc dot gnu.org
  2020-07-03 14:33 ` [Bug tree-optimization/96043] " marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-03  9:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

            Bug ID: 96043
           Summary: BB vectorizer costing lumps everything together
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Currently the basic-block vectorizer sums up independent opportunities and
does an overall decision so that "good" vectorizations help "bad"
vectorizations to be considered and "bad" vectorizations could make "good"
vectorizations not to happen.

Instead the basic-block vectorizer should cost independent opportunities
(disjunct portions of the SLP graph) independently.

I'm struggling to find a testcase the basic-block vectorizer rejects
based on costing at the moment though...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
@ 2020-07-03 14:33 ` marxin at gcc dot gnu.org
  2020-09-08  9:06 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-03 14:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-07-03

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
  2020-07-03 14:33 ` [Bug tree-optimization/96043] " marxin at gcc dot gnu.org
@ 2020-09-08  9:06 ` rguenth at gcc dot gnu.org
  2020-09-08 12:45 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-08  9:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|marxin at gcc dot gnu.org          |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
So with BB vectorization of non-stores

double a[4];
double x, y;
void bar (double, double);
void foo(double a0, double a1, double a2, double a3)
{
  double tem1 = a0 + a2 + 1.;
  double tem2 = a1 + a3 + 2.;
  x = tem1;
  y = tem2;
}

becomes profitable by inserting an unrelated opportunity:

double a[4];
double x, y;
void bar (double, double);
void foo(double a0, double a1, double a2, double a3)
{
  double tem1 = a0 + a2 + 1.;
  double tem2 = a1 + a3 + 2.;
  x = tem1;
  y = tem2;
  a[0] += a[2];
  a[1] += a[3];
}

there's the "complication" that the independent SLP graph components are
not solely formed by the SLP graph nodes and edges but instead we have to
consider scalar stmts as connection between SLP graphs because of the
way scalar costing works.  Also "shared" external nodes shouldn't
be considered tieing two SLP graph components together.

Mine.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
  2020-07-03 14:33 ` [Bug tree-optimization/96043] " marxin at gcc dot gnu.org
  2020-09-08  9:06 ` rguenth at gcc dot gnu.org
@ 2020-09-08 12:45 ` rguenth at gcc dot gnu.org
  2020-09-08 14:11 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-08 12:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I have a patch.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-09-08 12:45 ` rguenth at gcc dot gnu.org
@ 2020-09-08 14:11 ` rguenth at gcc dot gnu.org
  2020-09-10  9:20 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-08 14:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Turns out gcc.dg/vect/costmodel/x86_64/costmodel-pr69297.c can be massaged to
such case.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-09-08 14:11 ` rguenth at gcc dot gnu.org
@ 2020-09-10  9:20 ` cvs-commit at gcc dot gnu.org
  2020-09-10  9:21 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-10  9:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:47ddf4c7b1d4471cb9534f27844ab5e4279c2168

commit r11-3095-g47ddf4c7b1d4471cb9534f27844ab5e4279c2168
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Sep 8 14:49:59 2020 +0200

    tree-optimization/96043 - BB vectorization costing improvement

    This makes the BB vectorizer cost independent SLP subgraphs
    separately.  While on pristine trunk and for x86_64 I failed to
    distill a testcase where the vectorizer would think _any_
    basic-block vectorization opportunity is not profitable I do
    have pending work that would make the cost savings of a
    profitable opportunity make another independently not
    profitable opportunity vectorized.

    2020-09-08  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96043
            * tree-vectorizer.h (_slp_instance::cost_vec): New.
            (_slp_instance::subgraph_entries): Likewise.
            (BB_VINFO_TARGET_COST_DATA): Remove.
            * tree-vect-slp.c (vect_free_slp_instance): Free
            cost_vec and subgraph_entries.
            (vect_analyze_slp_instance): Initialize them.
            (vect_slp_analyze_operations): Defer passing costs to
            the target, instead record them in the SLP graph entry.
            (get_ultimate_leader): New helper for graph partitioning.
            (vect_bb_partition_graph_r): Likewise.
            (vect_bb_partition_graph): New function to partition the
            SLP graph into independently costable parts.
            (vect_bb_vectorization_profitable_p): Adjust to work on
            a subgraph.
            (vect_bb_vectorization_profitable_p): New wrapper,
            discarding non-profitable vectorization of subgraphs.
            (vect_slp_analyze_bb_1): Call vect_bb_partition_graph before
            costing.

            * gcc.dg/vect/costmodel/x86_64/costmodel-pr69297.c: Adjust.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-09-10  9:20 ` cvs-commit at gcc dot gnu.org
@ 2020-09-10  9:21 ` rguenth at gcc dot gnu.org
  2020-09-11  9:41 ` tnfchris at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-10  9:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-09-10  9:21 ` rguenth at gcc dot gnu.org
@ 2020-09-11  9:41 ` tnfchris at gcc dot gnu.org
  2020-09-11  9:53 ` rguenth at gcc dot gnu.org
  2020-09-11 10:01 ` tnfchris at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2020-09-11  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tnfchris at gcc dot gnu.org

--- Comment #6 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Hi Richi,

This change seems to have caused a few of our vectorization benchmarks to slow
down including x264 which slowed down about 7%.

I can see similar slowdowns on x86 
https://lnt.opensuse.org/db_default/v4/SPEC/12977
https://lnt.opensuse.org/db_default/v4/SPEC/12978

was this expected and we should fiddle with the cost model to recover these?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-09-11  9:41 ` tnfchris at gcc dot gnu.org
@ 2020-09-11  9:53 ` rguenth at gcc dot gnu.org
  2020-09-11 10:01 ` tnfchris at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-11  9:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Tamar Christina from comment #6)
> Hi Richi,
> 
> This change seems to have caused a few of our vectorization benchmarks to
> slow down including x264 which slowed down about 7%.
> 
> I can see similar slowdowns on x86 
> https://lnt.opensuse.org/db_default/v4/SPEC/12977
> https://lnt.opensuse.org/db_default/v4/SPEC/12978
> 
> was this expected and we should fiddle with the cost model to recover these?

That wasn't expected - can you open a new bugreport please?  Ideally we'd have
a testcase to look at of course.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug tree-optimization/96043] BB vectorizer costing lumps everything together
  2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-09-11  9:53 ` rguenth at gcc dot gnu.org
@ 2020-09-11 10:01 ` tnfchris at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2020-09-11 10:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96043

--- Comment #8 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #7)
> (In reply to Tamar Christina from comment #6)
> > Hi Richi,
> > 
> > This change seems to have caused a few of our vectorization benchmarks to
> > slow down including x264 which slowed down about 7%.
> > 
> > I can see similar slowdowns on x86 
> > https://lnt.opensuse.org/db_default/v4/SPEC/12977
> > https://lnt.opensuse.org/db_default/v4/SPEC/12978
> > 
> > was this expected and we should fiddle with the cost model to recover these?
> 
> That wasn't expected - can you open a new bugreport please?  Ideally we'd
> have
> a testcase to look at of course.

Sure, will do, I'll try to isolate the function that changed to make a
testcase.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-11 10:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03  9:11 [Bug tree-optimization/96043] New: BB vectorizer costing lumps everything together rguenth at gcc dot gnu.org
2020-07-03 14:33 ` [Bug tree-optimization/96043] " marxin at gcc dot gnu.org
2020-09-08  9:06 ` rguenth at gcc dot gnu.org
2020-09-08 12:45 ` rguenth at gcc dot gnu.org
2020-09-08 14:11 ` rguenth at gcc dot gnu.org
2020-09-10  9:20 ` cvs-commit at gcc dot gnu.org
2020-09-10  9:21 ` rguenth at gcc dot gnu.org
2020-09-11  9:41 ` tnfchris at gcc dot gnu.org
2020-09-11  9:53 ` rguenth at gcc dot gnu.org
2020-09-11 10:01 ` tnfchris at gcc dot gnu.org

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).