This is the mail archive of the 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: vectorization cost macro TARGET_VECTORIZE_ADD_STMT_COST

-----Original Message-----
From: Richard Biener [] 
Sent: Monday, August 03, 2015 2:59 PM
To: Ajit Kumar Agarwal
Cc: Jeff Law;; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Re: vectorization cost macro TARGET_VECTORIZE_ADD_STMT_COST

On Sun, Aug 2, 2015 at 4:13 PM, Ajit Kumar Agarwal <> wrote:
> All:
> The definition of the following macro that determine the statement cost that adds to vectorization cost.
> In the implementation of the above macro the following is done for many vectorization supported architectures like i386, ARM.
> if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info))
>         count *= 50;  /* FIXME.  */
> I have the  following questions.
> 1. Why the multiplication factor of 50 is choosen?

>>It's a wild guess.  See tree-vect-loop.c:vect_get_single_scalar_iteration_cost.

> 2. The comment mentions that the inner loop relative to the loop being 
> vectorized is added more weight. If more weight is added to the inner 
> loop for the loop being vectorized, the chances of vectorizing the inner loop decreases. Why the inner loop cost is increased with relative to the loop being vectorized?

>>In fact adding more weight to the inner loop increases the chance of vectorizing it (if vectorizing the inner loop is profitable).
>>Both scalar and vector cost get biased by a factor of 50 (we assume 50 iterations of the inner loop for one iteration of the outer loop), so a non-profitable >>vectorization in the outer loop can be offsetted by profitable inner loop vectorization.

>>Yes, '50' can be improved if we actually know the iteration count of the inner loop or if we have profile-feedback.

Thanks for the valuable information and suggestions.

Thanks & Regards


> Thanks & Regards
> Ajit

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