public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/101944] suboptimal SLP for reduced case from namd_r
Date: Tue, 17 Aug 2021 09:47:43 +0000	[thread overview]
Message-ID: <bug-101944-4-yNmjHylRTQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101944-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
Back to the optimized IR, I thought the problem is that the vectorized
version has longer critical path for the reduc_plus result (latency in total).
For vectorized version,

  _51 = diffa_41(D) *
1.666666666666666574148081281236954964697360992431640625e-1;
  _59 = {_51, 2.5e-1};
  vect__20.13_60 = vect_vdw_d_37.12_56 * _59;
  _61 = .REDUC_PLUS (vect__20.13_60);

The critical path is: scalar mult -> vect CTOR -> vector mult -> reduc_plus

While for the scalar version:

  _51 = diffa_41(D) *
1.666666666666666574148081281236954964697360992431640625e-1;
  _21 = vdw_c_38 * 2.5e-1;
  _22 = .FMA (vdw_d_37, _51, _21);

Two scalar mult can run in parallel and it further ends up with one FMA.

On Power9, we don't have one unique REDUC_PLUS insn for double, it takes three
insns: vector shift + vector addition + vector extraction.  I'm not sure if
this is a problem on the platforms which support efficient REDUC_PLUS, but it
seems a bad idea to SLP that case where the root is reduc op, its feeders are
not isomorphic and whose types are V2* and can be math optimized.

  parent reply	other threads:[~2021-08-17  9:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17  9:26 [Bug tree-optimization/101944] New: " linkw at gcc dot gnu.org
2021-08-17  9:29 ` [Bug tree-optimization/101944] " linkw at gcc dot gnu.org
2021-08-17  9:47 ` linkw at gcc dot gnu.org [this message]
2021-08-17 10:10 ` rguenth at gcc dot gnu.org
2021-08-17 10:12 ` rguenth at gcc dot gnu.org
2021-08-17 11:24 ` linkw at gcc dot gnu.org
2022-03-08  8:00 ` pinskia 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-101944-4-yNmjHylRTQ@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).