Skip to content

[MLIR][Tensor] Add Destination style RewritePattern for DimOp. #65780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2023

Conversation

kaitingwang
Copy link
Contributor

This enables canonicalization to fold away unnecessary tensor.dim ops which in turn enables folding away of other operations, as can be seen in conv_tensors_dynamic where affine.min operations were folded away.

@@ -579,11 +579,30 @@ struct DimOfCastOp : public OpRewritePattern<DimOp> {
return success();
}
};

struct DimOfDestStyleOp : public OpRewritePattern<DimOp> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you document the pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the approval! I added a brief comment: "Fold dim of a destination passing style op into the dim of the corresponding init." The updated PR should be running CI now.

@kaitingwang kaitingwang force-pushed the dimop-dst-passing-canonicalize branch 2 times, most recently from d9ddbab to 0623d1c Compare September 8, 2023 22:02
Fold dim of a destination passing op with dim of the corresponding init.
This enables canonicalization to fold away unnecessary tensor.dim ops
which in turn enables folding away of other operations, as can be
seen in conv_tensors_dynamic where affine.min operations were
folded away.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants