This is the mail archive of the
mailing list for the GCC project.
Re: [RFC]: Vectorization cost benefit changes.
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Ajit Kumar Agarwal <ajit dot kumar dot agarwal at xilinx dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Vinod Kathail <vinodk at xilinx dot com>, Shail Aditya Gupta <shailadi at xilinx dot com>, Vidhumouli Hunsigida <vidhum at xilinx dot com>, Nagaraju Mekala <nmekala at xilinx dot com>
- Date: Fri, 21 Aug 2015 10:32:41 +0200
- Subject: Re: [RFC]: Vectorization cost benefit changes.
- Authentication-results: sourceware.org; auth=none
- References: <37378DC5BCD0EE48BA4B082E0B55DFAA4295E5C2 at XAP-PVEXMBX02 dot xlnx dot xilinx dot com>
On Fri, Aug 21, 2015 at 7:18 AM, Ajit Kumar Agarwal
> 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.
> 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;
> - 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