[llvm] [TTI][Vectorize] Migrate masked/gather-scatter/strided/expand-compress costing (NFCI) (PR #165532)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 6 08:11:55 PST 2025


arcbbb wrote:

> OK, sounds good. I'm not against this, I was just thinking of things like what the stride was in a StridedMemoryOp (constants / small values could be cheaper on some hypothetical architecture). GatherScatters could do with better cost modelling, including possible whether the addresses are base + vector offset or vector-base + constant offset, etc. This combined interface might make passing that information harder.

I agree that a constant stride helps the cost model. 
In that cases I’d extend getMemIntrinsicInstrCost to take a MemAttr bag which has a constructor specific for target intrinsic.
Callers would look like:
  - getMemIntrinsicInstrCost(Intrinsic::masked_load, MemAttr(...), K)
  - getMemIntrinsicInstrCost(Intrinsic::vp_strided_load, MemAttr(..., Stride, ...), K)

This way just resembles getIntrinsicInstrCost. And how to fold MemAttr(...) into IntrinsicCostAttributes is a open question as noted in the reply above to @lukel97.

https://github.com/llvm/llvm-project/pull/165532


More information about the llvm-commits mailing list