[PATCH] D114779: [LV][X86] Sink `LoopVectorizationCostModel::useEmulatedMaskMemRefHack()` further into TTI, disable for X86/AVX2+

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 1 20:18:47 PST 2021


mtrofin added a comment.

In D114779#3165305 <https://reviews.llvm.org/D114779#3165305>, @lebedev.ri wrote:

> Ok, so i'm looking at those optsize.ll/tripcount.ll tests, and i'm not sure what exactly they are testing.
> They don't specify the triple/attributes, so what costs do they expect to get?
>
> I **think** what was happening is that they relied on the fact that opt doesn't default to -march=native
> and for no machine there is a support for masked gather/scatter/load/store for those types (i8) in baseline ISA,
> so `useEmulatedMaskMemRefHack()` hack would always happen and the instructions(and thus the vectorization cost)
> would be bogusly high, and that would prevent them from vectorizing?
>
> I'm not really sure what to do about them. Is my analysis wrong?
> Can perhaps someone familiar with those tests comment?
>
> tripcount.ll was added in D32451 <https://reviews.llvm.org/D32451> and modified in D42946 <https://reviews.llvm.org/D42946>;
> cc @twoh, @tejohnson, @davidxl, @mtrofin, @yamauchi

IIRC, re D42946 <https://reviews.llvm.org/D42946>, the fix in that patch was fundamentally about trip counts not being computed correctly, and then the regression tests are variations of the pre-existing cases. I think you are correct, they all rely on there being a large cost to vectorization that makes it profitable only in certain cases (and the way the trip count is computed changes that)

I think the test should intentionally specify a triple, where the cost is high, and maybe we need replace the instructions with some with a high cost?

(I'd wait for others to chime in though, it's been a while since D42946 <https://reviews.llvm.org/D42946> and that was basically my brief encounter with vectorization)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114779



More information about the llvm-commits mailing list