public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Philipp Tomsich <ptomsich@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/vrull/heads/slp-improvements)] Fix (perf regression): revert to previous ordering
Date: Tue, 23 Jan 2024 20:59:14 +0000 (GMT)	[thread overview]
Message-ID: <20240123205914.AF4A438582B9@sourceware.org> (raw)

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

commit d8a63369bf3cb2a8f6450162683b51a388021312
Author: Manolis Tsamis <manolis.tsamis@vrull.eu>
Date:   Tue Jan 23 17:58:05 2024 +0100

    Fix (perf regression): revert to previous ordering
    
    The 'more natural' ABCD ordering (as opposed to the ACBD order) of all
    nodes from the refactored implementation resulted in a x264
    regression, where the number of tbl instructions has increased from 26
    to 286 in total.
    
    This changes the order back to ACBD, reducing the number of
    tbl-instructions back to 26 and resolves the observed performance
    regression from the fix for #356.
    
    Ref #356
    
    Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>

Diff:
---
 gcc/tree-vect-slp.cc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index f7970bafd45..6b5edf1cebc 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1920,14 +1920,14 @@ try_rearrange_oprnd_info (vec<slp_oprnd_info> &oprnds_info, unsigned group_size)
       {
 	/* Given oprnd[0] -> A1, A1, B1, B1, A2, A2, B2, B2, ...
 	   Given oprnd[1] -> C1, C1, D1, D1, C2, C2, D2, D2, ...
-	   Create a single node -> A1, B1, C1, D1, A2, B2, C2, D2, ...  */
+	   Create a single node -> A1, C1, B1, D1, A2, C2, B2, D2, ...  */
 
 	/* The ordering here is at least to some extent arbitrary.
 	   A generilized version needs to use some explicit ordering.  */
-	oprnds_info[0]->def_stmts[j+1] = oprnds_info[0]->def_stmts[j+2];
-	oprnds_info[0]->ops[j+1] = oprnds_info[0]->ops[j+2];
-	oprnds_info[0]->def_stmts[j+2] = oprnds_info[1]->def_stmts[j];
-	oprnds_info[0]->ops[j+2] = oprnds_info[1]->ops[j];
+	oprnds_info[0]->def_stmts[j+1] = oprnds_info[1]->def_stmts[j];
+	oprnds_info[0]->ops[j+1] = oprnds_info[1]->ops[j];
+	oprnds_info[0]->def_stmts[j+2] = oprnds_info[0]->def_stmts[j+2];
+	oprnds_info[0]->ops[j+2] = oprnds_info[0]->ops[j+2];
 	oprnds_info[0]->def_stmts[j+3] = oprnds_info[1]->def_stmts[j+2];
 	oprnds_info[0]->ops[j+3] = oprnds_info[1]->ops[j+2];
       }
@@ -2817,7 +2817,7 @@ fail:
 	}
       else if (rearrange_pattern == SLP_OPRND_PATTERN_AABB)
 	{
-	   /* Given a single node -> A1, B1, C1, D1, A2, B2, C2, D2, ...
+	   /* Given a single node -> A1, C1, B1, D1, A2, C2, B2, D2, ...
 	      Create node "one" -> A1, A1, B1, B1, A2, A2, B2, B2, ...
 	      Create node "two" -> C1, C1, D1, D1, C2, C2, D2, D2, ...  */
 
@@ -2825,11 +2825,11 @@ fail:
 	    {
 	      SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 0));
 	      SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 0));
-	      SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 1));
-	      SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 1));
+	      SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 2));
+	      SLP_TREE_LANE_PERMUTATION(one).safe_push (std::make_pair (0, j + 2));
 
-	      SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, j + 2));
-	      SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, j + 2));
+	      SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, j + 1));
+	      SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, j + 1));
 	      SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, j + 3));
 	      SLP_TREE_LANE_PERMUTATION(two).safe_push (std::make_pair (0, j + 3));
 	    }

                 reply	other threads:[~2024-01-23 20:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240123205914.AF4A438582B9@sourceware.org \
    --to=ptomsich@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).