This is an archive of the discontinued LLVM Phabricator instance.

Add an option for unrolling loops up to a factor.
ClosedPublic

Authored by llitchev on Sep 3 2020, 1:26 PM.

Details

Summary

Currently, there is no option to allow for unrolling a loop up to a specific factor (specified by the user).
The code for doing that is there and there are benefits when unrolling is done to smaller loops (smaller than the factor specified).

Diff Detail

Event Timeline

llitchev created this revision.Sep 3 2020, 1:26 PM
Herald added a project: Restricted Project. · View Herald Transcript
llitchev requested review of this revision.Sep 3 2020, 1:26 PM
llitchev updated this revision to Diff 290024.Sep 4 2020, 2:01 PM

For some reason a code was removed in a diagnostic message. Added back.

bondhugula accepted this revision.Sep 8 2020, 8:54 AM
bondhugula added a subscriber: bondhugula.
bondhugula added inline comments.
mlir/include/mlir/Dialect/Affine/Passes.td
74

Format fix please.

mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
48

This isn't properly indented I think - clang-format please.

130–132

Drop trivial braces.

mlir/test/Dialect/SCF/loop-unroll.mlir
252

Nit: drop extra line.

260

Nit: Doesn't make a difference for the test, but you could use affine.store.

271

tore -> store

This revision is now accepted and ready to land.Sep 8 2020, 8:54 AM
bondhugula added inline comments.Sep 8 2020, 8:56 AM
mlir/test/Dialect/SCF/loop-unroll.mlir
266–272

Nit: Please indent these lines by one more shift.

Thanks for adding this option.

This revision was automatically updated to reflect the committed changes.