public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102467] New: Missed SLP discovery for gathers
@ 2021-09-23 11:17 rguenth at gcc dot gnu.org
  2021-09-23 11:18 ` [Bug tree-optimization/102467] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-23 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102467
           Summary: Missed SLP discovery for gathers
           Product: gcc
           Version: 12.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: ---

void foo (double * __restrict a, long * __restrict b, double * c)
{
  for (int i = 0; i < 1024; ++i)
    {
      a[2*i] = c[b[2*i]];
      a[2*i + 1] = c[b[2*i + 1]];
    }
}

is not SLP vectorized.

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
@ 2021-09-23 11:18 ` rguenth at gcc dot gnu.org
  2021-09-23 11:34 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-23 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
"easiest" to do with the IFN scheme since then SLP discovery already sees
IFN_GATHERs as discovered by pattern recog.

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
  2021-09-23 11:18 ` [Bug tree-optimization/102467] " rguenth at gcc dot gnu.org
@ 2021-09-23 11:34 ` rguenth at gcc dot gnu.org
  2021-09-29  0:11 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-23 11:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 51504
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51504&action=edit
half-way patch

A start, lacks adjustment of the code generation part which doesn't expect SLP
at the moment.

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
  2021-09-23 11:18 ` [Bug tree-optimization/102467] " rguenth at gcc dot gnu.org
  2021-09-23 11:34 ` rguenth at gcc dot gnu.org
@ 2021-09-29  0:11 ` pinskia at gcc dot gnu.org
  2021-09-29  0:11 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-29  0:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |53947
           Severity|normal                      |enhancement


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-09-29  0:11 ` pinskia at gcc dot gnu.org
@ 2021-09-29  0:11 ` pinskia at gcc dot gnu.org
  2021-11-30  9:54 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-29  0:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-09-29

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-09-29  0:11 ` pinskia at gcc dot gnu.org
@ 2021-11-30  9:54 ` cvs-commit at gcc dot gnu.org
  2021-11-30 12:00 ` rsandifo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-30  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:10833849b55401a52f2334eb032a70beb688e9fc

commit r12-5612-g10833849b55401a52f2334eb032a70beb688e9fc
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Tue Nov 30 09:52:29 2021 +0000

    vect: Support gather loads with SLP

    This patch adds SLP support for IFN_GATHER_LOAD.  Like the SLP
    support for IFN_MASK_LOAD, it works by treating only some of the
    arguments as child nodes.  Unlike IFN_MASK_LOAD, it requires the
    other arguments (base, scale, and extension type) to be the same
    for all calls in the group.  It does not require/expect the loads
    to be in a group (which probably wouldn't make sense for gathers).

    I was worried about the possible alias effect of moving gathers
    around to be part of the same SLP group.  The patch therefore
    makes vect_analyze_data_ref_dependence treat gathers and scatters
    as a top-level concern, punting if the accesses aren't completely
    independent and if the user hasn't told us that a particular
    VF is safe.  I think in practice we already punted in the same
    circumstances; the idea is just to make it more explicit.

    gcc/
            PR tree-optimization/102467
            * doc/sourcebuild.texi (vect_gather_load_ifn): Document.
            * tree-vect-data-refs.c (vect_analyze_data_ref_dependence):
            Commonize safelen handling.  Punt for anything involving
            gathers and scatters unless safelen says otherwise.
            * tree-vect-slp.c (arg1_map): New variable.
            (vect_get_operand_map): Handle IFN_GATHER_LOAD.
            (vect_build_slp_tree_1): Likewise.
            (vect_build_slp_tree_2): Likewise.
            (compatible_calls_p): If vect_get_operand_map returns nonnull,
            check that any skipped arguments are equal.
            (vect_slp_analyze_node_operations_1): Tighten reduction check.
            * tree-vect-stmts.c (check_load_store_for_partial_vectors): Take
            an ncopies argument.
            (vect_get_gather_scatter_ops): Take slp_node and ncopies arguments.
            Handle SLP nodes.
            (vectorizable_store, vectorizable_load): Adjust accordingly.

    gcc/testsuite/
            * lib/target-supports.exp
            (check_effective_target_vect_gather_load_ifn): New target test.
            * gcc.dg/vect/vect-gather-1.c: New test.
            * gcc.dg/vect/vect-gather-2.c: Likewise.
            * gcc.target/aarch64/sve/gather_load_11.c: Likewise.

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-11-30  9:54 ` cvs-commit at gcc dot gnu.org
@ 2021-11-30 12:00 ` rsandifo at gcc dot gnu.org
  2021-11-30 12:06 ` rguenther at suse dot de
  2021-12-02 17:21 ` rsandifo at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-11-30 12:00 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed for IFNs.  Not sure whether we want to keep this open for
the built-in route too.

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-11-30 12:00 ` rsandifo at gcc dot gnu.org
@ 2021-11-30 12:06 ` rguenther at suse dot de
  2021-12-02 17:21 ` rsandifo at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenther at suse dot de @ 2021-11-30 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 30 Nov 2021, rsandifo at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102467
> 
> rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |rsandifo at gcc dot gnu.org
> 
> --- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
> Fixed for IFNs.  Not sure whether we want to keep this open for
> the built-in route too.

I don't think so.  The fix for the built-in route is to get rid of it.
Of course I miserably failed at that - meh :/

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

* [Bug tree-optimization/102467] Missed SLP discovery for gathers
  2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-11-30 12:06 ` rguenther at suse dot de
@ 2021-12-02 17:21 ` rsandifo at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-12-02 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

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

--- Comment #7 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
OK, closing as fixed then :-)

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

end of thread, other threads:[~2021-12-02 17:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 11:17 [Bug tree-optimization/102467] New: Missed SLP discovery for gathers rguenth at gcc dot gnu.org
2021-09-23 11:18 ` [Bug tree-optimization/102467] " rguenth at gcc dot gnu.org
2021-09-23 11:34 ` rguenth at gcc dot gnu.org
2021-09-29  0:11 ` pinskia at gcc dot gnu.org
2021-09-29  0:11 ` pinskia at gcc dot gnu.org
2021-11-30  9:54 ` cvs-commit at gcc dot gnu.org
2021-11-30 12:00 ` rsandifo at gcc dot gnu.org
2021-11-30 12:06 ` rguenther at suse dot de
2021-12-02 17:21 ` rsandifo 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).