This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [RFC]: Vectorization cost benefit changes.



-----Original Message-----
From: Richard Biener [mailto:richard.guenther@gmail.com] 
Sent: Friday, August 21, 2015 2:03 PM
To: Ajit Kumar Agarwal
Cc: Jeff Law; GCC Patches; gcc@gcc.gnu.org; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Re: [RFC]: Vectorization cost benefit changes.

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.

Thanks for your valuable suggestions and feedback. I will certainly look into it.

Thanks & Regards
Ajit
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]