[PATCH] D93043: [CostModel] Add costs for llvm.experimental.vector.{extract,insert} intrinsics
Bradley Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 11 04:37:36 PST 2020
bsmith added a comment.
In D93043#2448152 <https://reviews.llvm.org/D93043#2448152>, @joechrisellis wrote:
> Hi @bsmith, thank you for the patch! 😄
>
> I noticed `b3e77c6d55853eea5f5c32ec8a3510c0b0e438e1` earlier:
>
> commit b3e77c6d55853eea5f5c32ec8a3510c0b0e438e1
> Author: Christopher Tetreault <ctetreau at quicinc.com>
> Date: Tue Jun 16 14:05:21 2020 -0700
>
> [SVE] Remove invalid calls to VectorType::getNumElements from BasicTTIImpl
>
> <snip>
> If a developer makes some change in the future that causes
> one of these asserts to fire, they should either change their code or
> make the function they are trying to call handle scalable vectors.
> <snip>
>
> This patch changes the interface of both `get{Extract,Insert}SubvectorOverhead` (among others) to accepting `FixedVectorType`s instead of `VectorType`s, so this patch is partially reverting some of the changes there. Not sure if this is pertinent here, but perhaps it's useful for context.
Agreed, I see this patch as doing as the highlighted part of the commit message indicates, hence not really a reversion as such.
================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:118
+ unsigned getExtractSubvectorOverhead(VectorType *VTy, int Index,
FixedVectorType *SubVTy) {
assert(VTy && SubVTy &&
----------------
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.
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