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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 2 10:34:21 PST 2023


fhahn updated this revision to Diff 485873.
fhahn added a comment.

Rebased and adjusted code back to be for runtime-unrolling only for now.

In D115261#3807958 <https://reviews.llvm.org/D115261#3807958>, @xbolva00 wrote:

> Are you gonna land this patch? Or any blockers?

Not any longer with 9758242046b3 <https://reviews.llvm.org/rG9758242046b3cdce6fb713acb6d3f5bfaa933a47> landed.

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

> Does this disable all unrolling, or only runtime unrolling?

This went through a couple of iterations. Updated the code to limit to runtime unrolling only as the description/title says.

> I strongly suspect that the full unrolling should still be allowed.
> Consider e.g. `D136806` from the https://godbolt.org/z/fsdMhETh3 from D136806 <https://reviews.llvm.org/D136806>,
> there we still need to full-unroll, after vectorization, to get the SROA to trigger.

Full unrolling is back to being allowed for this patch.

> I'm also a bit vary to the fact that LV unrolling
> is functionally different to the normal unrolling/

It is different, but LV's cost-modeling should be more realistic then the one for runtime unrolling. Runtime unrolling can actively be harmful (https://github.com/llvm/llvm-project/issues/40306) after LV and it adds substantial compile-time for little/no gain in the benchmark runs I did. If there are cases where it actively helps, I am happy to analyze those.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115261

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/ARM/pointer_iv.ll
  llvm/test/Transforms/LoopVectorize/ARM/tail-folding-loop-hint.ll
  llvm/test/Transforms/LoopVectorize/X86/already-vectorized.ll
  llvm/test/Transforms/LoopVectorize/X86/float-induction-x86.ll
  llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll
  llvm/test/Transforms/LoopVectorize/X86/invariant-load-gather.ll
  llvm/test/Transforms/LoopVectorize/X86/invariant-store-vectorization.ll
  llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll
  llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll
  llvm/test/Transforms/LoopVectorize/X86/tail_loop_folding.ll
  llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
  llvm/test/Transforms/LoopVectorize/followup.ll
  llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
  llvm/test/Transforms/LoopVectorize/induction.ll
  llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
  llvm/test/Transforms/LoopVectorize/invariant-store-vectorization-2.ll
  llvm/test/Transforms/LoopVectorize/invariant-store-vectorization.ll
  llvm/test/Transforms/LoopVectorize/memdep-fold-tail.ll
  llvm/test/Transforms/LoopVectorize/optsize.ll
  llvm/test/Transforms/LoopVectorize/pointer-select-runtime-checks.ll
  llvm/test/Transforms/LoopVectorize/reduction-with-invariant-store.ll
  llvm/test/Transforms/LoopVectorize/runtime-check.ll
  llvm/test/Transforms/LoopVectorize/vectorize-once.ll
  llvm/test/Transforms/PhaseOrdering/X86/excessive-unrolling.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115261.485873.patch
Type: text/x-patch
Size: 170105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230102/45763c31/attachment.bin>


More information about the llvm-commits mailing list