This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Tensor] Canonicalize expand/collapse_shape of splat to splat
ClosedPublic

Authored by Miss_Grape on Dec 22 2022, 6:48 AM.

Details

Summary

Collapsing / expanding a splatted value can be replaced with a single tensor.splat operation. Replace
these cases with a simple tensor.splat operation.

Diff Detail

Event Timeline

Miss_Grape created this revision.Dec 22 2022, 6:48 AM
Miss_Grape requested review of this revision.Dec 22 2022, 6:48 AM

Please use exact wording in the commit description. It helps with a lot of things, including drawing attention of relevant reviewers (some get a hundred of review emails per day). Specifically, this patch canonicalizes expand/collapse_shape + splat, *not* reshape + splat as its title misleadingly suggests. ReshapeOp is merely a name of the template argument in the implementation and has nothing to do in the commit title, but it misleads the reader into thinking the patch is related to tensor.reshape (https://mlir.llvm.org/docs/Dialects/TensorOps/#tensorreshape-mlirtensorreshapeop).

Miss_Grape retitled this revision from [MLIR][Tensor] Fold ReshapeOp splat to splat with ReshapeOp type. to [MLIR][Tensor] Canonicalize expand/collapse_shape splat to splat with expand/collapse_shape type.Jan 3 2023, 3:01 AM
rsuderman accepted this revision.Jan 4 2023, 1:03 PM
rsuderman retitled this revision from [MLIR][Tensor] Canonicalize expand/collapse_shape splat to splat with expand/collapse_shape type to [MLIR][Tensor] Canonicalize expand/collapse_shape of splat to splat.
rsuderman edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Jan 4 2023, 1:03 PM