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:29:49 +0000 [thread overview] Message-ID: <bug-101944-4-0EgRMPK911@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 #1 from Kewen Lin <linkw at gcc dot gnu.org> --- The original costing shows the vectorized version wins, by checking the costings, it missed to model the cost of lane extraction, the patch was posted in: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577422.html With the proposed adjustment above, the costings become to: reduc.c:24:34: note: Cost model analysis for part in loop 0: Vector cost: 17 Scalar cost: 17 Now we consider vectorization is still profitable when both cost are equal, so the SLP still performs. One thing can make it different is that: when we do costing, math optimization doesn't happen, there are no FMA-style operations, but finally some multiply and subtraction is optimized to FMS. If costing for scalar faces two multiply-and-sub (counted as 2) instead of two multiplies and subtractions (counted as 4), vs. vector costing 1 instead of 2. It ends up with scalar 15 vs. vector 16. But it seems not practical since we can't predict the later processing well, I tried to hack pass_optimize_widening_mul to run before slp, I saw it failed earlier.
next prev parent reply other threads:[~2021-08-17 9:29 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 ` linkw at gcc dot gnu.org [this message] 2021-08-17 9:47 ` [Bug tree-optimization/101944] " linkw at gcc dot gnu.org 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-0EgRMPK911@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: linkBe 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).