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
186–188

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
186–188

+1

267

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

289

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

295

same nit re "look more like loops"

308

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
267

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

OperationBuilder(...) {

}
295

This too looks like a loop to me...

conditionBuilder() {
  ...
}
308

There is no loop here :)