This is the mail archive of the gcc@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]

[RFC]: Vectorization cost benefit changes.


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.

         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

Attachment: vect.diff
Description: vect.diff


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