This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Use reify for padded op shape derivation.
ClosedPublic

Authored by nicolasvasilache on Sep 10 2021, 12:17 AM.

Details

Summary

Previously, we would insert a DimOp and rely on later canonicalizations.
Unfortunately, reifyShape kind of rewrites are not canonicalizations anymore.
This introduces undesirable pass dependencies.

Instead, immediately reify the result shape and avoid the DimOp altogether.
This is akin to a local folding, which avoids introducing more reliance on -resolve-shaped-type-result-dims (similar to compositions of affine.apply by construction to avoid chains of size > 1).

It does not completely get rid of the reliance on the pass as the process is merely local: calling the pass may still be necessary for global effects. Indeed, one of the tests still requires the pass.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Sep 10 2021, 12:17 AM
springerm accepted this revision.Sep 12 2021, 11:48 PM
springerm added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
192–193

can this be an assertion?

203–204

can be deleted?

This revision is now accepted and ready to land.Sep 12 2021, 11:48 PM