[PATCH] D38785: [LV/LAA] Avoid specializing a loop for stride=1 when this predicate implies a single-iteration loop

Dorit Nuzman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 04:50:37 PDT 2017


dorit added a comment.

Hi Silviu,

> However it seems like stride versioning might be the bigger problem.

Yes, we have a problem with our decision making on when to do stride versioning. We need to evaluate the cost of the runtime test, and to evaluate the benefit of various possible stride specializations, and then make an informed decision about which versioning we want to perform (which stride(s) to specialize for), if at all. That's a big change that needs to be designed and carefully tuned; For example:

> Maybe we should only use it if it somehow helps with the dependence analysis, otherwise using scatter/gather might always better.

If the unknown stride happens to be 1, then using gathers would have worse performance than the versioned loop with regular wide loads. So maybe we'd want more than one specialized version, or maybe some other solution, but in any case something that needs to be designed and tuned.

In short, I think we are all in agreement that:

1. This patch is a (small) improvement, * regardless of the users and their specific cost considerations *.
2. The cost-model aspect of deciding when to specialize for a certain stride needs to be improved. The users (LV especially) are currently not making informed decisions.

…Right?

thanks,
Dorit


https://reviews.llvm.org/D38785





More information about the llvm-commits mailing list