This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tensor] Fold `tensor.cast` into `tensor.collapse_shape` op
ClosedPublic

Authored by Shukla-Gaurav on Jul 27 2022, 10:27 AM.

Details

Summary

This commit folds a tensor.cast op into a tensor.collapse_shape op
when following two conditions meet:

  1. the tensor.collapse_shape op consumes result of the tensor.cast op.
  2. tensor.cast op casts to a more dynamic version of the source tensor.

This is added as a canonicalization pattern in tensor.collapse_shape op.

Signed-Off-By: Gaurav Shukla <gaurav@nod-labs.com>

Diff Detail

Event Timeline

Shukla-Gaurav created this revision.Jul 27 2022, 10:27 AM
Shukla-Gaurav requested review of this revision.Jul 27 2022, 10:27 AM
Shukla-Gaurav edited the summary of this revision. (Show Details)Jul 27 2022, 10:35 AM
Shukla-Gaurav edited the summary of this revision. (Show Details)
mravishankar accepted this revision.Jul 27 2022, 4:10 PM
mravishankar added a subscriber: mravishankar.

Looks good! Thanks!

This revision is now accepted and ready to land.Jul 27 2022, 4:10 PM