Page MenuHomePhabricator

[mlir][linalg] Run CSE after every CodegenStrategy transformation.
ClosedPublic

Authored by gysit on Thu, Nov 25, 5:12 AM.

Details

Summary

Add CSE after every transformation. Transformations such as tiling introduce redundant computation, for example, one AffineMinOp for every operand dimension pair. Follow up transformations such as Padding and Hoisting benefit from CSE since comparing slice sizes simplifies to comparing SSA values instead of analyzing affine expressions.

Diff Detail

Event Timeline

gysit created this revision.Thu, Nov 25, 5:12 AM
gysit requested review of this revision.Thu, Nov 25, 5:12 AM
mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp
49 ↗(On Diff #389741)

Can this be folded inside the createLinalgStrategyEnablePass ?
This is the "one size fits all" for all enabling stuff (hoisting etc).
This way you'd also have more control if you need to run some enabling stuff multiple times.

gysit added inline comments.Fri, Nov 26, 1:47 AM
mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp
49 ↗(On Diff #389741)

I think this would require another dynamic pass manager nested inside the LinalgStrategyEnablePass? My understanding is that we should minimize the use of dynamic pass managers?

@mehdi_amini do you have a recommendation on how to address this problem? Our goal is to "call one thing" that runs the LinalgStrategyEnablePass and performs CSE. The LinalgStrategyEnablePass applies canonicalization patterns while CSE is a pass.

gysit updated this revision to Diff 390619.Tue, Nov 30, 1:34 AM

Run CSE from within the enabeling pass using a dynamic pass pipeline.

nicolasvasilache accepted this revision.Tue, Nov 30, 6:36 AM
This revision is now accepted and ready to land.Tue, Nov 30, 6:36 AM