[PATCH] D121677: [RISCV] Return Invalid cost in getGatherScatterOpCost instead of crashing for scalable vectors

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 01:05:37 PDT 2022


frasercrmck added a comment.

In D121677#3418361 <https://reviews.llvm.org/D121677#3418361>, @liaolucy wrote:

> Can adding a cost model for llvm.cttz.nxv1i8 solve this problem?  I would like to try.

In my experience, the minimum we need to handle is:

1. //any// scalable-vector intrinsics in `getTypeBasedIntrinsicInstrCost` which crashes in the base version. This would fix `cttz`.
2. scalable-vector `fshl`,`fshr`,`experimental_stepvector`,`experimental_vector_insert` and `experimental_vector_extract` in `getIntrinsicInstrCost`

In #2, these intrinsics all call `BaseT::getIntrinsicInstrCost` on scalable-vectors, so we need to catch them ahead of time. The other intrinsics either return some kind of cost or fall through to `getTypeBasedIntrinsicInstrCost` which we'll handle in #1.

This is what I mean about it looking like a lot of work. I've done the bare minimum in our downstream to fix crashes but the costs I used are wildly inaccurate: I just don't expect us to crash on IR containing intrinsics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121677



More information about the llvm-commits mailing list