public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106293] [13 regression] 456.hmmer at -Ofast -march=native regressed by 19% on zen2 and zen3 in July 2022
Date: Fri, 04 Aug 2023 10:09:30 +0000	[thread overview]
Message-ID: <bug-106293-4-ZhoHbY4Duf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106293-4@http.gcc.gnu.org/bugzilla/>

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13/14 Regression]          |[13 regression] 456.hmmer
                   |456.hmmer at -Ofast         |at -Ofast -march=native
                   |-march=native regressed by  |regressed by 19% on zen2
                   |19% on zen2 and zen3 in     |and zen3 in July 2022
                   |July 2022                   |

--- Comment #26 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
We are out of regression finally, but still there are several things to fix.
 1) vectorizer produces corrupt profile
 2) loop-split is not able to work out that it splits last iteration
 3) we work way to hard optimizing loops iterating 0 times.

The loop in question really iterates zero times.  It is created by loop split
from the internal loop:

        for (k = 1; k <= M; k++) {
          mc[k] = mpp[k-1]   + tpmm[k-1];
          if ((sc = ip[k-1]  + tpim[k-1]) > mc[k])  mc[k] = sc;
          if ((sc = dpp[k-1] + tpdm[k-1]) > mc[k])  mc[k] = sc;
          if ((sc = xmb  + bp[k])         > mc[k])  mc[k] = sc;
          mc[k] += ms[k];
          if (mc[k] < -INFTY) mc[k] = -INFTY;

          dc[k] = dc[k-1] + tpdd[k-1];
          if ((sc = mc[k-1] + tpmd[k-1]) > dc[k]) dc[k] = sc;
          if (dc[k] < -INFTY) dc[k] = -INFTY;

          if (k < M) {
            ic[k] = mpp[k] + tpmi[k];
            if ((sc = ip[k] + tpii[k]) > ic[k]) ic[k] = sc;
            ic[k] += is[k];
            if (ic[k] < -INFTY) ic[k] = -INFTY;
          }

it peels off the last iteration. For ocnidtion is
 if (k <= M)
while we plit on
 if (k < M)
M is varianble and nothing seems to be able to optimize out the second loop
after splitting.

My plan is to add the pattern match so loop split gets this right and records
upper bound on iteration count, but first want to show other bugs exposed by
this scenario.

  parent reply	other threads:[~2023-08-04 10:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  9:08 [Bug tree-optimization/106293] New: " jamborm at gcc dot gnu.org
2022-07-14  9:22 ` [Bug tree-optimization/106293] [13 Regression] " rguenth at gcc dot gnu.org
2022-07-14 12:10 ` rguenth at gcc dot gnu.org
2022-07-14 12:22 ` rguenth at gcc dot gnu.org
2022-07-25  9:44 ` luoxhu at gcc dot gnu.org
2022-07-25  9:46 ` luoxhu at gcc dot gnu.org
2023-01-10 12:12 ` yann at ywg dot ch
2023-01-10 12:45 ` rguenth at gcc dot gnu.org
2023-01-10 15:53 ` cvs-commit at gcc dot gnu.org
2023-01-10 15:54 ` rguenth at gcc dot gnu.org
2023-01-11  7:04 ` cvs-commit at gcc dot gnu.org
2023-04-17 15:11 ` [Bug tree-optimization/106293] [13/14 " jakub at gcc dot gnu.org
2023-04-17 16:15 ` jamborm at gcc dot gnu.org
2023-04-26  6:56 ` rguenth at gcc dot gnu.org
2023-07-27  9:23 ` rguenth at gcc dot gnu.org
2023-07-27 18:01 ` hubicka at gcc dot gnu.org
2023-07-27 21:38 ` hubicka at gcc dot gnu.org
2023-07-28  7:22 ` rguenther at suse dot de
2023-07-28  8:01   ` Jan Hubicka
2023-07-28  7:51 ` cvs-commit at gcc dot gnu.org
2023-07-28  8:01 ` hubicka at ucw dot cz
2023-07-28 12:09 ` rguenther at suse dot de
2023-07-31  7:44 ` hubicka at gcc dot gnu.org
2023-07-31 15:39 ` jamborm at gcc dot gnu.org
2023-08-01 10:40 ` hubicka at gcc dot gnu.org
2023-08-02  8:48 ` hubicka at gcc dot gnu.org
2023-08-02  9:42 ` rguenth at gcc dot gnu.org
2023-08-04 10:09 ` hubicka at gcc dot gnu.org [this message]
2023-08-07  8:56 ` [Bug tree-optimization/106293] [13 regression] " cvs-commit at gcc dot gnu.org
2023-08-10 16:01 ` hubicka at gcc dot gnu.org
2024-05-21  9:11 ` jakub 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-106293-4-ZhoHbY4Duf@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).