This is an archive of the discontinued LLVM Phabricator instance.

[mlir][memref] Fix collapsed shape ops memref.cast folding with changed type
ClosedPublic

Authored by cathyzhyi on Jul 23 2021, 8:06 AM.

Details

Summary

memref.collapse_shape has verification logic to make sure
result dim must be static if all the collapsing src dims are static.
Cast folding might add more static information for the src operand
of memref.collapse_shape which might change a valid collapsing
operation to be invalid. Add CollapseShapeOpMemRefCastFolder pattern
to fix this.

Minor changes to convertReassociationIndicesToExprs to use context
instead of builder to avoid extra steps to construct temporary
builders.

Diff Detail

Event Timeline

cathyzhyi created this revision.Jul 23 2021, 8:06 AM
cathyzhyi requested review of this revision.Jul 23 2021, 8:06 AM
cathyzhyi edited the summary of this revision. (Show Details)Jul 23 2021, 8:10 AM
cathyzhyi updated this revision to Diff 361222.Jul 23 2021, 8:15 AM

update description

This revision is now accepted and ready to land.Jul 23 2021, 12:25 PM

@mravishankar Thanks a lot for reviewing! I don't have commit permission. Could you please also help me to land the change?

cathyzhyi retitled this revision from Limit cast folding for memref.collapse_shape to [MLIR][MEMREF] Limit cast folding for memref.collapse_shape.Jul 23 2021, 3:49 PM
cathyzhyi retitled this revision from [MLIR][MEMREF] Limit cast folding for memref.collapse_shape to [WIP][MLIR][MEMREF] Limit cast folding for memref.collapse_shape.Jul 25 2021, 7:50 PM

I think a better way to fix this is to use a canonicalizing pattern. Will modify the patch to do that.

cathyzhyi updated this revision to Diff 361704.Jul 26 2021, 9:47 AM

fix with canonicalizer pattern instead of folder

cathyzhyi edited the summary of this revision. (Show Details)Jul 26 2021, 9:49 AM
cathyzhyi retitled this revision from [WIP][MLIR][MEMREF] Limit cast folding for memref.collapse_shape to [mlir][memref] Fix collapsed shape ops memref.cast folding with changed type.

minor changes to commit title

nicolasvasilache accepted this revision.Jul 28 2021, 3:17 AM