2016-06-16 18:51 GMT+03:00 Jeff Law <l...@redhat.com>:
> On 06/16/2016 09:41 AM, Ilya Enkovich wrote:
>>
>> 2016-06-15 14:44 GMT+03:00 Richard Biener <richard.guent...@gmail.com>:
>>>
>>> On Thu, May 19, 2016 at 9:44 PM, Ilya Enkovich <enkovich....@gmail.com>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> This patch introduces support for loop epilogue combining.  This
>>>> includes
>>>> support in cost estimation and all required changes required to mask
>>>> vectorized loop.
>>>
>>>
>>> I wonder why you compute a minimum number of iterations to make masking
>>> of the vectorized body profitable rather than a maximum number of
>>> iterations.
>>>
>>> I'd say masking the vectorized loop is profitable if niter/vf *
>>> masking-overhead < epilogue-cost.
>>> Masking the epilogue is profitable if vectorizing the epilogue with
>>> masking is profitable.
>>>
>>> Am I missing something?
>>
>>
>> We don't have two versions of vectorized loop.  The choice is between
>> vector
>> and scalar loop and in this case minimum number of iterations is what we
>> need.
>> Generating two vectorized loop versions would be something new to
>> vectorizer.
>
> What I think Richi is saying is that we have to multiply the cost of the
> masking overhead by the number of iterations of vectorized loop to determine
> the cost of masking -- the more loop iterations we have, the greater the
> cost of masking in the loop becomes and those costs may be higher than the
> normal epilogue sequence.

Right.  But we compute that dynamically.  And what do we do when we see overall
masking cost becomes greater than a scalar epilogue cost?  The only case when
this check is useful is when we have vectorized non-combined version of a loop.
The original idea of combining (patches sent by Yuri last year) was to use it
only in cases when masking cost is small enough (and we expect cheap masking
computations are 'hidden' under heavier instructions by scheduler, so we don't
loose performance even for high iterations count).

Dynamically choosing between combined and non-combined versions is
another story.

Thanks,
Ilya

>
> Jeff
>
>
>

Reply via email to