[PATCH] D132185: [TTI][AArch64] Update vector extract cost for Neoverse-N1.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 21 11:14:33 PDT 2022


dmgreen added a comment.

In D132185#3736062 <https://reviews.llvm.org/D132185#3736062>, @davidxl wrote:

> @dmgreen  The extract cost's default value and how the cost is used are two orthogonal things. I suspect that the regression you saw with cost == 2 might be the cause of a hidden bug somewhere else -- in other words, setting it to 3 simply papers over the real issue.

I think, if I'm understanding what you are saying, that somewhat I agree with you. The mid-end is made up of a lot of imperfect heuristics, with a cost-model that is not exact, and some of the decision made are not always optimal. Setting the cost of extracts to 1 or 2 makes the compiler favour SIMD more than scalar, through the costs via methods like getScalarizationOverhead and getVectorInstrCost. That can be beneficial in places but it can also hurt performance. And in practice, on average over many benchmarks, it seems to hurt performance more than it has helps.

> I think this patch is probably the right way to go.  An alternative is to introduce an internal option to control the default value.

There was an `-aarch64-insert-extract-base-cost` option added in D124835 <https://reviews.llvm.org/D124835>. Does that serve your purpose?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132185



More information about the llvm-commits mailing list