[PATCH] D95291: [CostModel] Remove VF from IntrinsicCostAttributes

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 23 12:11:17 PST 2021


dmgreen created this revision.
dmgreen added reviewers: samparker, RKSimon, spatel, tlively, arsenm, efriedma.
Herald added subscribers: kerbowa, pengfei, sunfish, hiraditya, kristof.beyls, jgravelle-google, sbc100, tpr, nhaehnle, jvesely, dschuff.
dmgreen requested review of this revision.
Herald added subscribers: aheejin, wdng.
Herald added a project: LLVM.

getIntrinsicInstrCost takes a IntrinsicCostAttributes holding various parameters of the intrinsic being costed. It can either be called with a scalar intrinsic (RetTy==Scalar, VF==1), with a vector instruction (RetTy==Vector, VF==1) or from the vectorizer with a scalar type and vector width (RetTy==Scalar, VF>1). A RetTy==Vector, VF>1 is considered an error. Both of the vector modes are expected to be treated the same, but because this is confusing many backends end up getting it wrong.

Instead of trying work with those two values separately this removes the VF parameter, widening the RetTy/ArgTys by VF used called from the vectorizer. This keeps things simpler, but does require some other modifications to keep things consistent.

Most backends look like this will be an improvement (or were not using getIntrinsicInstrCost). AMDGPU needed the most changes to keep the code from c230965ccf36af5c88c <https://reviews.llvm.org/rGc230965ccf36af5c88c28d065488f76712333683> working. ARM removed the fix in dfac521da1b90db683 <https://reviews.llvm.org/rGdfac521da1b90db6832a0d357f67cb819ea8687f>, webassembly happens to get a fixup for an SLP cost issue and both X86 and AArch64 seem to now be using better costs from the vectorizer.


https://reviews.llvm.org/D95291

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
  llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/intrinsiccost.ll
  llvm/test/Transforms/LoopVectorize/X86/intrinsiccost.ll
  llvm/test/Transforms/SLPVectorizer/WebAssembly/no-vectorize-rotate.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95291.318778.patch
Type: text/x-patch
Size: 34480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210123/a1d15aa2/attachment.bin>


More information about the llvm-commits mailing list