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: [patch] Vectorizer cost model implementation


Hello,

>> >I can test the patch on powerpc-linux. Will try to do it early this
>> week.
>>
>> As you suggested in an offline mail to me, it may be a good idea to
hold
>> off on the tests until I fix the patch for the issues you have
brought
>> up below.
>>
>
>ok

I have attached the cost model patch. The test cases have been reduced
to a smaller subset which I think should give us a fairly good coverage
to start with. Currently I have only added the tests on x86 and x86-64. 

>you mean to do the following, right?:
>
>      if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
>          || LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor
!= 0
>)
>        vec_outside_cost += 2*TARG_COND_BRANCH_COST;
>
>> Also I think it's better to use 2*
>> TARG_COND_BRANCH_COST because 2 guards would be generated.
>>
>
>agreed.

With this patch, the branch and peel costs are calculated conservatively
if the alignment is unknown or if the loop iterations are unknown.


>> >But the thing that bothers me much more than this, is that I can't
make
>> >sense of the computation in vect_estimate_min_profitable_iters.
AFAIU,
>> >vect_estimate_min_profitable_iters computes the min_profitable_iters
as
>> >follows:
>> >      (*) min_profitable_iters = VIC/SIC + VOC/SIC
>> >
>> >where:
>> >VIC = vector iteration cost
>> >SIC = scalar iteration cost
>> >VOC = vector outside cost
>> >
>> >which looks wrong... (how come there's no dependency on VF?)
>> >
>> >If you start from this equation:
>> >      (**) SIC*niters > VIC*niters/VF + VOC
>> >
>> >you end up with this:
>> >      (***) min_profitable_iters = VOC/(SIC - VIC/VF)
>> >
>> >(I somehow managed to convince myself that
>> >vect_estimate_min_profitable_iters made sense when I first read it,
but
>> now
>> >it just doesn't make sense to me anymore...)
>> >
>>
>> We had some offline mails about this, but indeed what you have stated
>> here is correct. The current code is an approximation, but there are
>> cases where it won't yield the right answer.
>>
>> I will use the *** equation to calculate the minimum profitable iters
>> and will also test if SIC > VIC/VF.

This has been fixed.

Thanks,
Harsha

Attachment: costmodel.0606.patch
Description: costmodel.0606.patch


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