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 target/104912] [12 Regression] 416.gamess regression after r12-7612-g69619acd8d9b58
Date: Mon, 14 Mar 2022 11:55:25 +0000	[thread overview]
Message-ID: <bug-104912-4-nivIEcsD5L@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104912-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
+mccas.fppized.f:3160:21: optimized: loop vectorized using 16 byte vectors
+mccas.fppized.f:3160:21: optimized:  loop versioned for vectorization because
of possible aliasing
+mccas.fppized.f:3195:21: optimized: loop vectorized using 16 byte vectors
+mccas.fppized.f:3195:21: optimized:  loop versioned for vectorization because
of possible aliasing
+mccas.fppized.f:3259:21: optimized: loop vectorized using 16 byte vectors
+mccas.fppized.f:3259:21: optimized:  loop versioned for vectorization because
of possible aliasing
+mccas.fppized.f:3304:21: optimized: loop vectorized using 16 byte vectors
+mccas.fppized.f:3304:21: optimized:  loop versioned for vectorization because
of possible aliasing
 mccas.fppized.f:2576:18: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:2524:17: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:3055:22: optimized: loop vectorized using 16 byte vectors
@@ -147,9 +155,11 @@
 mccas.fppized.f:1890:25: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:1859:20: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:1843:19: optimized: loop vectorized using 16 byte vectors
+mccas.fppized.f:1843:19: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:1737:17: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:1727:20: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:1714:19: optimized: loop vectorized using 16 byte vectors
+mccas.fppized.f:1714:19: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:884:24: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:904:33: optimized: basic block part vectorized using 16 byte
vectors
 mccas.fppized.f:653:17: optimized: loop vectorized using 16 byte vectors
@@ -159,8 +169,11 @@
 mccas.fppized.f:1188:14: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:1188:14: optimized:  loop versioned for vectorization because
of possible aliasing
 mccas.fppized.f:522:72: optimized: basic block part vectorized using 16 byte
vectors
+mccas.fppized.f:522:72: optimized: basic block part vectorized using 16 byte
vectors
 mccas.fppized.f:2399:14: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:2399:14: optimized:  loop versioned for vectorization because
of possible aliasing
 mccas.fppized.f:2130:14: optimized: loop vectorized using 16 byte vectors
 mccas.fppized.f:2261:72: optimized: basic block part vectorized using 16 byte
vectors
+mccas.fppized.f:2261:72: optimized: basic block part vectorized using 16 byte
vectors
+mccas.fppized.f:2261:72: optimized: basic block part vectorized using 16 byte
vectors


are the vectorization differences, the performance difference happens entirely
in TWOTFF (lines 3209 and following).

+mccas.fppized.f:3304:21: optimized: loop vectorized using 16 byte vectors
+mccas.fppized.f:3304:21: optimized:  loop versioned for vectorization because
of possible aliasing

are the inner loops of

            DO 30 MK=1,NOC
            DO 30 ML=1,MK
               MKL = MKL+1
               XPQKL(MPQ,MKL) = XPQKL(MPQ,MKL) +
     *               VAL1*(CO(MS,MK)*CO(MR,ML)+CO(MS,ML)*CO(MR,MK))
               XPQKL(MRS,MKL) = XPQKL(MRS,MKL) +
     *               VAL3*(CO(MQ,MK)*CO(MP,ML)+CO(MQ,ML)*CO(MP,MK))
   30       CONTINUE

and the other similar copy.

We are doing all strided loads and stores here but the vectorized code never
executes, instead we just pay the overhead of the runtime alias test for
each inner iteration (we'd ideally formulate it in a way including the
outer iteration so we could version the outer loop instead).  The
runtime alias check is XPOKL(MPQ,MKL) vs. XPOKL(MRS,MKL) - an index check
on MPQ should be invariant but I guess the situation is more complicated
than that.

The cost model differences for this are

mccas.fppized.f:3304:21: note:  Cost model analysis:
  Vector inside of loop cost: 552
  Vector prologue cost: 48
  Vector epilogue cost: 280
  Scalar iteration cost: 264
  Scalar outside cost: 8
  Vector outside cost: 328
  prologue iterations: 0
  epilogue iterations: 1
mccas.fppized.f:3304:21: missed:  cost model: the vector iteration cost = 552
divided by the scalar iteration cost = 264 is greater or equal to the
vectorization factor = 2.
mccas.fppized.f:3304:21: missed:  not vectorized: vectorization not profitable.
mccas.fppized.f:3304:21: missed:  not vectorized: vector version will never be
profitable.
mccas.fppized.f:3304:21: missed:  Loop costings may not be worthwhile.

vs.

mccas.fppized.f:3304:21: note:  Cost model analysis:
  Vector inside of loop cost: 480
  Vector prologue cost: 48
  Vector epilogue cost: 280
  Scalar iteration cost: 264
  Scalar outside cost: 8
  Vector outside cost: 328
  prologue iterations: 0
  epilogue iterations: 1
  Calculated minimum iters for profitability: 4

where the V2DF vec_construct costs are reduced from 24 to 12 which I think
is reasonable since we're replacing two scalar loads with one scalar load
and one movhpd from memory.

  parent reply	other threads:[~2022-03-14 11:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 11:06 [Bug target/104912] New: [12 Regression] 416.gamess regression after r12-7612 rguenth at gcc dot gnu.org
2022-03-14 11:06 ` [Bug target/104912] " rguenth at gcc dot gnu.org
2022-03-14 11:55 ` rguenth at gcc dot gnu.org [this message]
2022-03-14 11:58 ` [Bug target/104912] [12 Regression] 416.gamess regression after r12-7612-g69619acd8d9b58 rguenth at gcc dot gnu.org
2022-03-14 12:17 ` rguenth at gcc dot gnu.org
2022-03-14 13:49 ` rguenth at gcc dot gnu.org
2022-03-14 14:25 ` rguenth at gcc dot gnu.org
2022-03-17 12:31 ` rguenth at gcc dot gnu.org
2022-03-21 13:08 ` rguenth at gcc dot gnu.org
2022-04-13  7:54 ` cvs-commit at gcc dot gnu.org
2022-04-13  8:02 ` rguenth at gcc dot gnu.org
2022-04-20 11:28 ` cvs-commit at gcc dot gnu.org
2022-05-06  8:33 ` [Bug target/104912] [12/13 " jakub at gcc dot gnu.org
2022-07-26 12:42 ` rguenth at gcc dot gnu.org
2023-01-31 11:22 ` jamborm at gcc dot gnu.org
2023-01-31 12:02 ` rguenth at gcc dot gnu.org
2023-05-08 12:24 ` [Bug target/104912] [12/13/14 " 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-104912-4-nivIEcsD5L@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).