[PATCH] D93043: [CostModel] Add costs for llvm.experimental.vector.{extract,insert} intrinsics

Joe Ellis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 06:38:33 PST 2020


joechrisellis accepted this revision.
joechrisellis added a reviewer: ctetreau.
joechrisellis added a subscriber: ctetreau.
joechrisellis added a comment.
This revision is now accepted and ready to land.

LGTM, but I am curious if @ctetreau has an opinion on this change, since I think he has done some work in this area.



================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:118
+  unsigned getExtractSubvectorOverhead(VectorType *VTy, int Index,
                                        FixedVectorType *SubVTy) {
     assert(VTy && SubVTy &&
----------------
bsmith wrote:
> joechrisellis wrote:
> > `llvm.experimental.vector.extract` can also extract a scalable from a scalable -- should we also change this `FixedVectorType` to `VectorType` too?
> > 
> > I suppose this cost model breaks down a bit when we're extracting/inserting a scalable into a scalable, since we don't know how many elements we have to 'work on'. But I think that it might be possible for this code to crash in the same way as before if we don't address this case.
> I think currently we don't generate these intrinsics as extracting or inserting scalable vectors into another scalable vector, and considering adding costs for that is much more complex it should be a different patch, if we do end up adding it.
> 
> That said, I agree that this case shouldn't crash, which it does currently. I will make those cases fall back to `BaseT::getIntrinsicInstrCost(ICA, CostKind)` as the other scalable vector cases do, as well as adding tests.
SGTM! 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93043



More information about the llvm-commits mailing list