This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Split `populateElementwiseOpsFusionPatterns`.
ClosedPublic

Authored by mravishankar on Apr 6 2022, 10:24 AM.

Details

Summary

The method to add elementwise ops fusion patterns pulls in many other
patterns by default. The patterns to pull in along with the
elementwise op fusion should be upto the caller. Split the method to
pull in just the elementwise ops fusion pattern. Other cleanup changes
include

  • Move the pattern for constant folding of generic ops (currently only constant folds transpose) into a separate file, cause it is not related to fusion
  • Drop the uber LinalgElementwiseFusionOptions. With the populateElementwiseOpsFusionPatterns being split, this has no utility now.
  • Drop defaults for the control function.
  • Fusion of splat constants with generic ops doesnt need a control function. It is always good to do.

Diff Detail

Event Timeline

mravishankar created this revision.Apr 6 2022, 10:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2022, 10:24 AM
mravishankar requested review of this revision.Apr 6 2022, 10:24 AM
gysit accepted this revision.Apr 6 2022, 11:35 PM

LGTM!

mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
2032

nit:depends

This revision is now accepted and ready to land.Apr 6 2022, 11:35 PM
okkwon accepted this revision.Apr 7 2022, 4:45 PM

Adding minor comments. LGTM.

mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp
38

nit: typo

67

nit: given that? or since?

147

This seems to be a nice utility we can reuse. Can you make this function in AffineMap.h|cpp?

There is already getDimPosition(idx), so it would be a nice addition to that.

Fix comment typos

This revision was landed with ongoing or failed builds.Apr 11 2022, 4:37 PM
This revision was automatically updated to reflect the committed changes.