public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/rguenth/heads/vect-force-slp)] Add --param vect-single-lane-slp
Date: Thu, 19 Oct 2023 13:28:46 +0000 (GMT)	[thread overview]
Message-ID: <20231019132846.8500A3858438@sourceware.org> (raw)

https://gcc.gnu.org/g:ae99d208e6e9d8dd5b9741e40e5e2f35242e5d4f

commit ae99d208e6e9d8dd5b9741e40e5e2f35242e5d4f
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Sep 29 12:54:17 2023 +0200

    Add --param vect-single-lane-slp
    
    The following adds --param vect-single-lane-slp to guard single-lane
    loop SLP discovery.  As first client we look at non-grouped stores
    with an assert that SLP discovery works to discover gaps in it.
    
            * params.opt (-param=vect-single-lane-slp=): New.
            * tree-vect-slp.cc (vect_analyze_slp): Perform single-lane
            loop SLP discovery for non-grouped stores if requested.

Diff:
---
 gcc/params.opt       |  4 ++++
 gcc/tree-vect-slp.cc | 26 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/gcc/params.opt b/gcc/params.opt
index ae2fa54fc589..8cfc9bcc60a4 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1183,6 +1183,10 @@ The maximum factor which the loop vectorizer applies to the cost of statements i
 Common Joined UInteger Var(param_vect_induction_float) Init(1) IntegerRange(0, 1) Param Optimization
 Enable loop vectorization of floating point inductions.
 
+-param=vect-single-lane-slp=
+Common Joined UInteger Var(param_vect_single_lane_slp) Init(0) IntegerRange(0, 1) Param Optimization
+Enable single lane SLP discovery.
+
 -param=vect-force-slp=
 Common Joined UInteger Var(param_vect_force_slp) Init(0) IntegerRange(0, 1) Param Optimization
 Fail vectorization when falling back to non-SLP.
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 8efff2e912d7..76d023fd38b4 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -3575,6 +3575,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
 opt_result
 vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
 {
+  loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo);
   unsigned int i;
   stmt_vec_info first_element;
   slp_instance instance;
@@ -3590,6 +3591,31 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
   FOR_EACH_VEC_ELT (vinfo->grouped_stores, i, first_element)
     vect_analyze_slp_instance (vinfo, bst_map, first_element,
 			       slp_inst_kind_store, max_tree_size, &limit);
+  if (loop_vinfo && param_vect_single_lane_slp != 0)
+    {
+      data_reference_p dr;
+      FOR_EACH_VEC_ELT (vinfo->shared->datarefs, i, dr)
+	if (DR_IS_WRITE (dr))
+	  {
+	    stmt_vec_info stmt_info = vinfo->lookup_dr (dr)->stmt;
+	    /* It works a bit to dissolve the group but that's
+	       not really what we want to do.  Instead group analysis
+	       above starts discovery for each lane and pieces them together
+	       to a single store to the whole group.  */
+	    if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
+	      continue;
+	    vec<stmt_vec_info> stmts;
+	    vec<stmt_vec_info> roots = vNULL;
+	    vec<tree> remain = vNULL;
+	    stmts.create (1);
+	    stmts.quick_push (stmt_info);
+	    bool res = vect_build_slp_instance (vinfo, slp_inst_kind_store,
+						stmts, roots, remain,
+						max_tree_size, &limit,
+						bst_map, NULL);
+	    gcc_assert (res);
+	  }
+    }
 
   if (bb_vec_info bb_vinfo = dyn_cast <bb_vec_info> (vinfo))
     {

             reply	other threads:[~2023-10-19 13:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 13:28 Richard Biener [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-13 14:26 Richard Biener
2024-02-23  7:31 Richard Biener
2023-11-09 13:03 Richard Biener
2023-11-02 13:59 Richard Biener
2023-10-16 12:49 Richard Biener
2023-10-06  7:06 Richard Biener

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=20231019132846.8500A3858438@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).