RFC: Enable vectorization of call instructions in the loop vectorizer

Michael Zolotukhin mzolotukhin at apple.com
Thu Feb 26 12:01:45 PST 2015


Hi,

Some time ago James posted a patch for vectorization of calls [1]. Though it seems to be a missing feature in the vectorizer, it wasn’t committed, so I decided to revive the discussion.

To begin with, I rebased the patch and split it to several semantically separated parts. The approach used here is pretty natural: TargetLibraryInfo has a mapping for a set of scalar functions to their vector counterparts, TargetTransformInfo consults with it when cost of call instruction is calculated, if the vector-version is cheaper, vectorizer emits vector-function.

There are several question on this patch:
1. Is this approach still viable in general and worth pursuing?
2. The cost model is changed. In theory it should become more accurate, but I haven’t measured performance impact of this change yet. Does these changes look good in general? If yes, do we need to tune some target-cost-model parameters, or those are the values that no one has been actually using yet?
3. What is the best way to populate the scalar to vector functions map? For now, I populate it when the target-triple contains ‘Accelerate’. If we have a lot of other cases, we might think of something different here.

Any feedback or ideas are appreciated!

Thanks,
Michael

[1]: http://thread.gmane.org/gmane.comp.compilers.llvm.cvs/169736 <http://thread.gmane.org/gmane.comp.compilers.llvm.cvs/169736>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Make-ToVectorTy-static.patch
Type: application/octet-stream
Size: 2174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Fix-a-copy-paste-bug.patch
Type: application/octet-stream
Size: 913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-TLI-Use-lambda.-NFC.patch
Type: application/octet-stream
Size: 2139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0002.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-LoopVectorizer-Add-TargetTransformInfo.patch
Type: application/octet-stream
Size: 2883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0003.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0004.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-TLI-Factor-out-sanitizeFunctionName.-NFC.patch
Type: application/octet-stream
Size: 1869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0004.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0005.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-TLI-Add-interface-for-querying-whether-a-function-is.patch
Type: application/octet-stream
Size: 7629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0005.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0006.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-TTI-Add-getCallInstrCost.patch
Type: application/octet-stream
Size: 5572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0006.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0007.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-LoopVectorize-teach-loop-vectorizer-to-vectorize-cal.patch
Type: application/octet-stream
Size: 7448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0007.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0008.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-TTI-Honour-cost-model-for-estimating-cost-of-vector-.patch
Type: application/octet-stream
Size: 8215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0008.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0009.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-TLI-Add-several-entries-to-VectorizableFunctions-tab.patch
Type: application/octet-stream
Size: 1376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0009.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/738757df/attachment-0010.html>


More information about the llvm-commits mailing list