[PATCH] D147750: [LAA/LV] Simplify stride speculation logic [nfc-ish]

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 7 05:09:21 PDT 2023


fhahn added a comment.

In D147750#4250830 <https://reviews.llvm.org/D147750#4250830>, @peixin wrote:

> Why do you remove the `StrideSet`? It can be used to check the const stride in cost model very fast. Now, you check if it is constant one in PSE. The question is if all the const one in PSE are the strides?

In a way it is slightly more powerful to use PSE directly, as it has info about all predicates (not just about the strides). It should be possible to separate changing the type of the map and replacing stride set. Not sure if there's a big benefit from changing the type of the map; IIUC we will only add SCEVUnknown for the strides anyways.

> Also, it seems that removing the `StrideSet` will cause the const stride of non-one (such as 4) in D147539 <https://reviews.llvm.org/D147539> hard to check in cost model.
>
> In addition, I don't figure out how this patch help replace the symbolic stride with constants in vectory body. To perform the replacement, we have the following options:
>
> 1. Emit the constants when generating the vector body. In this way, we need to check every `mul` operation, which seems to be expansive.
> 2. Get all the predicates from PSE and check them, which is done in D147378 <https://reviews.llvm.org/D147378>.
> 3. Use the `StrideSet` in LAA and get the predicate using PSE.
>
> Maybe you have better idea and this patch can help?

this is an interesting issue and I experimented with a different approach to solving this. I might be missing something, but it seems like we should be able to directly use the stride map + PSE to add Value->VPValue mappings to the VPlans to get the simplifications on construction: D147783 <https://reviews.llvm.org/D147783>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147750



More information about the llvm-commits mailing list