[PATCH] D115261: [LV] Disable runtime unrolling for vectorized loops.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 07:41:03 PST 2021


nikic added a comment.

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

> Even if both of the unrollers are right as per their model
> (LU duplicates whole loop body; while LU duplicates each instruction,
> increasing live ranges, i believe), i'm mainly just worried
> that two unroll strategies disagree in the end.
>
> Which one is actually right? LV?
> Is there some analysis that can be extracted from LV that LU could use
> to deduce better unroll factor? (which would be 1x (no further unroll) after LV)
>
> All that being said, i don't have any concrete examples that regress with this.

Runtime loop unrolling doesn't really have anything that deserves the name of "cost model", at least if there is no profile data. It basically just unrolls the loop as many times as fits into a threshold. I don't know what kind of cost modelling LV does in this area, but I can only assume it's better than that ;)

I believe many targets already disable runtime unrolling for loops that contain vector instructions. For example AArch64 does that, though X86 currently does not. This is the principal alternative I would see, to move that logic up into the generic unroll preferences. It would be the difference between not unrolling loops that LLVM vectorized and not unrolling vector loops in general -- I assume the preference would be the former, as this patch does?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115261



More information about the llvm-commits mailing list