This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Teach constant -> generic op fusion to handle scalar constants.
ClosedPublic

Authored by mravishankar on Sep 17 2021, 10:22 AM.

Details

Summary

The current folder of constant -> generic op only handles splat
constants. The same logic holds for scalar constants. Teach the
pattern to handle such cases.

Diff Detail

Event Timeline

mravishankar created this revision.Sep 17 2021, 10:22 AM
mravishankar requested review of this revision.Sep 17 2021, 10:22 AM
aartbik added inline comments.Sep 17 2021, 10:48 AM
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
1165–1167

Perhaps rename the rewriter (and class comment)?
Not a super big deal, but it is a FoldConstants rewriter now!

Rebase and address comments

aartbik accepted this revision.Sep 20 2021, 11:01 AM
This revision is now accepted and ready to land.Sep 20 2021, 11:01 AM

Restring splat constant inlining to only handle int or float types.

mravishankar marked an inline comment as done.Sep 22 2021, 11:15 AM
aartbik accepted this revision.Sep 22 2021, 11:24 AM

Still LGTM