public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Yuri Rumyantsev <ysrumyan@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	Igor Zamyatin <izamyatin@gmail.com>
Subject: Re: [PATCH] Yet another simple fix to enhance outer-loop vectorization.
Date: Tue, 09 Jun 2015 13:28:00 -0000	[thread overview]
Message-ID: <CAFiYyc2366dfJBRZQgvehnpdA98Hv43n8AP4VLAjcAhDma=joA@mail.gmail.com> (raw)
In-Reply-To: <CAEoMCqTUReRxgtr2991pSAMvvUmmiSRuTKxJAuNq-vwMd6PyKg@mail.gmail.com>

On Mon, Jun 8, 2015 at 12:27 PM, Yuri Rumyantsev <ysrumyan@gmail.com> wrote:
> Hi All,
>
> Here is a simple fix which allows duplication of outer loops to
> perform peeling for number of iterations if outer loop is marked with
> pragma omp simd.
>
> Bootstrap and regression testing did not show any new failures.
> Is it OK for trunk?

Hmm, I don't remember needing to adjust rename_variables_in_bb
when teaching loop distibution to call slpeel_tree_duplicate_to_edge_cfg
on non-innermost loops...  (I just copied, I never called
slpeel_can_duplicate_loop_p though).

So - you should just remove the loop->inner condition from
slpeel_can_duplicate_loop_p as it is used by non-vectorizer
code as well (yeah, I never merged the nested loop support
for loop distribution...).

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (revision 224100)
+++ tree-vect-loop.c    (working copy)
@@ -1879,6 +1879,10 @@
       return false;
     }

+  /* Peeling for alignment is not supported for outer-loop vectorization.  */
+  if (LOOP_VINFO_LOOP (loop_vinfo)->inner)
+    LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) = 0;

I think you can't simply do this - if vect_enhance_data_refs_alignment
decided to peel for alignment then it has adjusted the DRs alignment
info already.  So instead of the above simply disallow peeling for
alignment in vect_enhance_data_refs_alignment?  Thus add
|| ->inner to

  /* Check if we can possibly peel the loop.  */
  if (!vect_can_advance_ivs_p (loop_vinfo)
      || !slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
    do_peeling = false;

?

I also can't see why the improvement has to be gated on force_vect,
it surely looks profitable to enable more outer loop vectorization in
general, no?

How do the cost model calculations end up with peeling the outer loop
for niter?

On targets which don't support unaligned accesses we're left with
versioning for alignment.  Isn't peeling for alignment better there?
Thus only disallow peeling for alignment if there is no unhandled
alignment?

Thanks,
Richard.

> ChangeLog:
>
> 2015-06-08  Yuri Rumyantsev  <ysrumyan@gmail.com>
>
> * tree-vect-loop-manip.c (rename_variables_in_bb): Add argument
> to allow renaming of PHI arguments on edges incoming from outer
> loop header, add corresponding check before start PHI iterator.
> (slpeel_tree_duplicate_loop_to_edge_cfg): Introduce new bool
> variable DUPLICATE_OUTER_LOOP and set it to true for outer loops
> with true force_vectorize.  Set-up dominator for outer loop too.
> Pass DUPLICATE_OUTER_LOOP as argument to rename_variables_in_bb.
> (slpeel_can_duplicate_loop_p): Allow duplicate of outer loop if it
> was marked with force_vectorize and has restricted cfg.
> * tre-vect-loop.c (vect_analyze_loop_2): Prohibit alignment peeling
> for outer loops.
>
> gcc/testsuite/ChangeLog:
> * gcc.dg/vect/vect-outer-simd-2.c: New test.

  reply	other threads:[~2015-06-09 13:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08 10:43 Yuri Rumyantsev
2015-06-09 13:28 ` Richard Biener [this message]
2015-06-16 14:39   ` Yuri Rumyantsev
2015-06-17 12:28     ` Richard Biener
2015-06-17 17:13       ` Yuri Rumyantsev
2015-06-29 16:53         ` Yuri Rumyantsev
2015-07-14 11:00           ` Richard Biener
2015-07-14 11:00         ` Richard Biener

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='CAFiYyc2366dfJBRZQgvehnpdA98Hv43n8AP4VLAjcAhDma=joA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=izamyatin@gmail.com \
    --cc=ysrumyan@gmail.com \
    /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).