[PATCH] D53865: [LoopVectorizer] Improve computation of scalarization overhead.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 12 13:39:17 PST 2018


Ayal added a comment.

In D53865#1328663 <https://reviews.llvm.org/D53865#1328663>, @efriedma wrote:

> > Are you proposing some kind of search over instruction sequences with some limited lookahead?
>
> Yes, something like this.


Agreed. Again, `computePredInstDiscount()` and `sinkScalarOperands()` already perform such a search. See also "Throttled SLP" by Vasileios in LLVM Dev 2015, PACT 2015.

>> I suspect that an algorithm that makes these decisions would benefit from knowing which instructions the target *must* scalarize
> 
> I think you would just start with instructions where the cost model says that VectorOperationCost > ScalarOperationCost*VF.  It doesn't really matter why it's expensive.  (I guess at some point, we might want to model which execution units are used by a vector instruction, but I think you'd want a different interface for that.)

The interface is already there: `expectedCost()` notes if the best cost for a given VF is obtained by using vector or scalar instructions. But this is only used to report if any vector instructions will actually be generated, to comply with user "vectorize" directive.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53865/new/

https://reviews.llvm.org/D53865





More information about the llvm-commits mailing list