[PATCH] D106166: [LV][ARM] Tighten up MLA reduction costing

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 10:37:13 PDT 2021


dmgreen created this revision.
dmgreen added reviewers: SjoerdMeijer, samtebbs, spatel, RKSimon.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
dmgreen requested review of this revision.
Herald added a project: LLVM.

This makes a couple of changes to the costing of MLA reduction patterns, to more accurately cost various patterns that can come up from vectorization.

- The Arm implementation of getExtendedAddReductionCost is altered to only provide costs for legal or smaller types. Larger than legal types need to be split, which currently does not work very well, especially for predicated reductions where the predicate may be legal but needs to be split. Currently we limit it to legal or smaller input types.
- The getReductionPatternCost has learnt that reduce(ext(mul(ext, ext)) is a pattern that can come up, and can be treated the same as reduce(mul(ext, ext)) providing the extension types match.
- If has also been adjusted to not count the ext in reduce(mul(ext, ext)) as part of a reduce(mul) pattern.
- And some of the existing checks have been replaced by PatternMatchers to try and prettify the implementation.

Together these changes help to more accurately cost the mla reductions in cases such as where the extend types don't match or the extend opcodes are different, picking better vector factors that don't result in expanded reductions.


https://reviews.llvm.org/D106166

Files:
  llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/ARM/mve-reductions.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106166.359315.patch
Type: text/x-patch
Size: 19928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/c8caa982/attachment.bin>


More information about the llvm-commits mailing list