public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com>
Cc: Jeff Law <law@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>,
		"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	Vinod Kathail <vinodk@xilinx.com>,
		Shail Aditya Gupta <shailadi@xilinx.com>,
	Vidhumouli Hunsigida <vidhum@xilinx.com>,
		Nagaraju Mekala <nmekala@xilinx.com>
Subject: Re: [RFC]: Vectorization cost benefit changes.
Date: Fri, 21 Aug 2015 08:35:00 -0000	[thread overview]
Message-ID: <CAFiYyc1eNZbUG=ZRxt9Ua9LOh_EJLvFrnUzbkuVwFA_wrw7FTg@mail.gmail.com> (raw)
In-Reply-To: <37378DC5BCD0EE48BA4B082E0B55DFAA4295E5C2@XAP-PVEXMBX02.xlnx.xilinx.com>

On Fri, Aug 21, 2015 at 7:18 AM, Ajit Kumar Agarwal
<ajit.kumar.agarwal@xilinx.com> wrote:
> All:
>
> I have done the vectorization cost changes as given below. I have considered only the cost associated with the inner instead of outside.
> The consideration of inside scalar and vector cost is done as the inner cost are the most cost effective than the outside cost.

I think you are confused about what the variables cost are associated
to.  You are changing a place that computes also the cost
for non-outer-loop-vectorization so your patch is clearly not applicable.

vec_outside_cost is the cost of setting up invariants for example.
All costs apply to the "outer" loop - if there is a nested loop
inside that loop its costs are folded into the "outer" loop cost
already at this stage.

So I think your analysis is simply wrong and thus your patch.

You need to find another place to fix inner loop cost.

Richard.

>          min_profitable_iters = ((scalar_single_iter_cost
>                                     - vec_inside_cost) *vf);
>
> The Scalar_single_iter_cost consider the hardcoded value 50 which is used for most of the targets and the scalar cost is multiplied
> With 50. This scalar cost is subtracted with vector cost and as the scalar cost is increased the chances of vectorization is more with same
> Vectorization factor  and more loops will be vectorized.
>
> I have not changed the iteration count which is hardcoded with 50 and I will do the changes to replace the 50 with the static
> Estimates of iteration count if you agree upon the below changes.
>
> I have ran the SPEC cpu 2000 benchmarks with the below changes for i386 targets and the significant gains are achieved with respect
> To INT and FP benchmarks.
>
> Here is the data.
>
> Ratio of vectorization cost changes(FP benchmarks) vs Ratio of without vectorization cost changes( FP benchmarks)  = 4640.102 vs 4583.379.
> Ratio of vectorization cost changes (INT benchmarks ) vs Ratio of without vectorization cost changes( INT benchmarks0 = 3812.883 vs 3778.558
>
> Please give your feedback on the below changes for vectorization cost benefit.
>
> diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
> index 422b883..35d538f 100644
> --- a/gcc/tree-vect-loop.c
> +++ b/gcc/tree-vect-loop.c
> @@ -2987,11 +2987,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
>          min_profitable_iters = 1;
>        else
>          {
> -          min_profitable_iters = ((vec_outside_cost - scalar_outside_cost) * vf
> -                                 - vec_inside_cost * peel_iters_prologue
> -                                  - vec_inside_cost * peel_iters_epilogue)
> -                                 / ((scalar_single_iter_cost * vf)
> -                                    - vec_inside_cost);
> +          min_profitable_iters = ((scalar_single_iter_cost
> +                                    - vec_inside_cost) *vf);
>
>            if ((scalar_single_iter_cost * vf * min_profitable_iters)
>                <= (((int) vec_inside_cost * min_profitable_iters)
>
> Thanks & Regards
> Ajit

  reply	other threads:[~2015-08-21  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21  5:29 Ajit Kumar Agarwal
2015-08-21  8:35 ` Richard Biener [this message]
2015-08-21  9:23   ` Ajit Kumar Agarwal

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='CAFiYyc1eNZbUG=ZRxt9Ua9LOh_EJLvFrnUzbkuVwFA_wrw7FTg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=ajit.kumar.agarwal@xilinx.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=nmekala@xilinx.com \
    --cc=shailadi@xilinx.com \
    --cc=vidhum@xilinx.com \
    --cc=vinodk@xilinx.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).