public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114057] [14 Regression] 435.gromacs fails verification with -Ofast -march={znver2,znver4} and PGO after r14-7272-g57f611604e8bab
Date: Wed, 27 Mar 2024 10:36:58 +0000	[thread overview]
Message-ID: <bug-114057-4-yyPcrVbKM7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114057-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so I think the change is that we get to "correctly" notice

-vec.h:380:9: note: node (external) 0x6a2e9d8 (max_nunits=2, refcnt=1)
vector(2) float
-vec.h:380:9: note:     stmt 0 _164 = MEM[(const real *)_27 + 8B];
-vec.h:380:9: note:     stmt 1 _158 = MEM[(const real *)_27];
+vec.h:380:9: note: node (external) 0x5a823a8 (max_nunits=2, refcnt=1)
vector(2) float
+vec.h:380:9: note:     [l] stmt 0 _164 = MEM[(const real *)_27 + 8B];
+vec.h:380:9: note:     [l] stmt 1 _158 = MEM[(const real *)_27];

for the loads we do not handle because of gaps and promoted external.  That
leads to extra costs.

But also

+vec.h:380:9: note: node 0x5a81770 (max_nunits=2, refcnt=2) vector(2) float
 vec.h:380:9: note: op template: x_160 = _158 - _159;
 vec.h:380:9: note:     stmt 0 x_160 = _158 - _159;
-vec.h:380:9: note:     [l] stmt 1 y_163 = _161 - _162;
+vec.h:380:9: note:     stmt 1 y_163 = _161 - _162;

so y_163 isn't considered live for some reason.  We find

_123 = _117 * y_163;

is vectorized as part of a reduction.  On the costing side we then see

-_161 - _162 1 times scalar_stmt costs 12 in body
-MEM[(const real *)_27 + 4B] 1 times scalar_load costs 12 in body
-MEM[(const real *)_24 + 4B] 1 times scalar_load costs 12 in body

which is the live (and dependent) stmts no longer costed on the scalar
side but also

+MEM[(const real *)_27 + 8B] 1 times vec_to_scalar costs 4 in epilogue
+MEM[(const real *)_24 + 8B] 1 times vec_to_scalar costs 4 in epilogue

costed in the vector epilog.  This is because we're conservative as we
don't really know whether we'll be able to code-generate the live
operation.  The costing side here is also not in sync as can be seen
from the _161 - _162 op removed.

I should also note that the setting of PURE_SLP is done a bit too early,
before we analyze operations and eventually throw away instances or
prune it by promoting ops external.

For reductions we also falsely claim all root stmts are vectorized - we
do have remain ops.  Fixing this restores the LIVE on them and in some
way restores vectorization.

I'm going to test this as fix for now.

  parent reply	other threads:[~2024-03-27 10:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 16:19 [Bug target/114057] New: [14 Regression] 435.gromacs fails verification on with -Ofast -march=znver4 and PGO pheeck at gcc dot gnu.org
2024-02-22 17:50 ` [Bug target/114057] " pheeck at gcc dot gnu.org
2024-02-22 18:08 ` pheeck at gcc dot gnu.org
2024-02-23  6:54 ` rguenth at gcc dot gnu.org
2024-02-23  9:44 ` pheeck at gcc dot gnu.org
2024-02-23 10:26 ` [Bug tree-optimization/114057] [14 Regression] 435.gromacs fails verification with -Ofast -march=znver4 and PGO after r14-7272-g57f611604e8bab pheeck at gcc dot gnu.org
2024-02-25 11:11 ` [Bug tree-optimization/114057] [14 Regression] 435.gromacs fails verification with -Ofast -march={znver2,znver4} " pheeck at gcc dot gnu.org
2024-03-07 20:38 ` law at gcc dot gnu.org
2024-03-26 10:59 ` rguenth at gcc dot gnu.org
2024-03-26 11:27 ` rguenth at gcc dot gnu.org
2024-03-26 12:02 ` rguenth at gcc dot gnu.org
2024-03-26 15:32 ` rguenth at gcc dot gnu.org
2024-03-26 15:34 ` rguenth at gcc dot gnu.org
2024-03-26 15:35 ` rguenth at gcc dot gnu.org
2024-03-27 10:36 ` rguenth at gcc dot gnu.org [this message]
2024-03-27 11:50 ` cvs-commit at gcc dot gnu.org
2024-03-27 11:51 ` rguenth at gcc dot gnu.org
2024-03-28  7:04 ` rguenth at gcc dot gnu.org

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=bug-114057-4-yyPcrVbKM7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).