This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Refactor linalg tiling
ClosedPublic

Authored by nicolasvasilache on May 19 2020, 8:04 PM.

Details

Summary

This revision refactors the Linalg tiling pass to be written as pattern applications and retires the use of the folder in Linalg tiling.
In the early days, tiling was written as a pass that would create (partially) folded and canonicalized operations on the fly for better composability.
As this evolves towards composition of patterns, the pass-specific folder is counter-productive and is retired.
The tiling options struct evolves to take a tile size creation function which allows materializing tile sizes on the fly (in particular constant tile sizes). This plays better with folding and DCE.

With the folder going away in Tiling, the check on whether subviews are the same in linalg fusion needs to be more robust. This revision also implements such a check.

In the current form, there are still some canonicalizations missing due to AffineMin/Max ops fed by scf::ForOp. These will be improved at a later time.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2020, 8:04 PM
pifon2a accepted this revision.May 19 2020, 11:47 PM
pifon2a added inline comments.
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
18

super-nit: empty line before struct... .

This revision is now accepted and ready to land.May 19 2020, 11:47 PM

Address review.

nicolasvasilache marked an inline comment as done.May 20 2020, 6:11 AM
This revision was automatically updated to reflect the committed changes.
rriddle added inline comments.May 27 2020, 1:33 PM
mlir/lib/Dialect/Linalg/EDSC/Builders.cpp
81

Static functions should be in the top-level namespace, not in nested namespaces.

mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
41

m_Zero?

mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
108

nit:

[&](int64_t s) -> Value {
  return b.create<...>(...);
}));