This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Move `memref.dim` canonicalization using `InferShapedTypeOpInterface` to a separate pass.
ClosedPublic

Authored by mravishankar on Jun 15 2021, 2:09 PM.

Details

Summary

Based on dicussion in
this
thread the pattern to resolve the memref.dim of a value that is a
result of an operation that implements the
InferShapedTypeOpInterface is moved to a separate pass instead of
running it as a canonicalization pass. This allows shape resolution to
happen when explicitly required, instead of automatically through a
canonicalization.

Diff Detail

Event Timeline

mravishankar created this revision.Jun 15 2021, 2:09 PM
mravishankar requested review of this revision.Jun 15 2021, 2:09 PM
stellaraccident accepted this revision.Jun 15 2021, 6:30 PM

Thanks for cleaning this up. I'm marking approve because I could be convinced about the naming but don't love it how it is spelled in this patch. Open to other opinions.

mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
26

Given its narrow focus, I don't love this pass sitting on such a broad name. It seems likely that this will be confused with something broader that may come along later.

Maybe resolve-shaped-type-result-dims?

This revision is now accepted and ready to land.Jun 15 2021, 6:30 PM
jpienaar added inline comments.
mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
26

memref-resolve-dim-of-result-values ? (The summary works quite nice too :-))

jpienaar added inline comments.Jun 15 2021, 6:36 PM
mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
20

Not due to this: but seems affine dialect is an outlier.

Rebase and address comments.

stellaraccident accepted this revision.Jun 16 2021, 11:52 AM

Thanks. Rename lgtm

Fix test error.

mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
26

I'll go with resolve-shaped-type-result-dims. The only reason this pass is in memref dialect is because memref.dim is in memref dialect. Nothing specific to memref in this really. Can be confusing.

This revision was landed with ongoing or failed builds.Jun 16 2021, 10:13 PM
This revision was automatically updated to reflect the committed changes.