This is an archive of the discontinued LLVM Phabricator instance.

[SLP] Support vectorizing functions provided by vector libs.
ClosedPublic

Authored by fhahn on Mar 9 2020, 3:03 PM.

Details

Summary

It seems like the SLPVectorizer is currently not aware of vector
versions of functions provided by libraries like Accelerate [1].
This patch updates SLPVectorizer to use the same infrastructure
the LoopVectorizer uses to detect vectorizable library functions.

For calls, it computes the cost of an intrinsic call (existing behavior)
and the cost of a vector function library call, if available. Like
LoopVectorizer, it assumes the cost of the vector function is simply the
cost of a call to a vector function.

[1] https://developer.apple.com/documentation/accelerate

Diff Detail

Event Timeline

fhahn created this revision.Mar 9 2020, 3:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2020, 3:03 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
ABataev added inline comments.Mar 9 2020, 3:30 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
3247

auto Shape

3255

Better to use ranged-based for, if possible. Otherwise, capitalize op and opc variables, Op and OpC or Opc.

llvm/test/Transforms/SLPVectorizer/AArch64/accelerate-vector-functions.ll
1

Would be good to precommit the test

fhahn updated this revision to Diff 249298.Mar 10 2020, 3:31 AM

Thanks for the review! Precommited the test, use auto & CI->args instead of index.

fhahn marked 3 inline comments as done.Mar 10 2020, 3:31 AM
This revision is now accepted and ready to land.Mar 10 2020, 5:47 AM
This revision was automatically updated to reflect the committed changes.