This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Allow distribution `scf.parallel` loops generated in Linalg to processors.
ClosedPublic

Authored by mravishankar on Aug 3 2020, 12:03 PM.

Details

Summary

This changes adds infrastructure to distribute the loops generated in
Linalg to processors at the time of generation. This addresses use
case where the instantiation of loop is done just to distribute
them. The option to distribute is added to TilingOptions for now and
will allow specifying the distribution as a transformation option,
just like tiling and promotion are specified as options.

Diff Detail

Event Timeline

mravishankar created this revision.Aug 3 2020, 12:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2020, 12:03 PM
mravishankar requested review of this revision.Aug 3 2020, 12:03 PM
ThomasRaoux added inline comments.Aug 6 2020, 1:06 PM
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
187–189

Does this need to be an affine expression? Nicolas has some patch in flight to allow folding the affine.min created by tiling, I'm not sure if it needs it. Hopefully Nicolas can comment.

nicolasvasilache accepted this revision.Aug 7 2020, 4:03 AM

Look great Mahesh, thanks for working on this !

mlir/lib/Dialect/Linalg/Utils/Utils.cpp
187–189

+1

268

nit: I would reformat this under a // clang-format off to make it "look more like loops".

290

Nit: while we're still under EDSC here, it should look quite nicer to use: Value slt(Value, Value) etc.
Here and below.

296

same nit re "look more like loops"

309

same nit re "look more like loops"

This revision is now accepted and ready to land.Aug 7 2020, 4:03 AM
mravishankar marked 5 inline comments as done.

Using affine maps for bounds/step update.

Removing errant tabs

mravishankar added inline comments.Aug 10 2020, 2:41 PM
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
268

Not sure I follow. Looks like a loop to me already, i.e.,

OperationBuilder(...) {

}
296

This too looks like a loop to me...

conditionBuilder() {
  ...
}
309

There is no loop here :)