Skip to content

Conversation

@csullivan
Copy link
Contributor

This PR adds support to SimplifyTranspose to simplify consecutive transpose<->layout_transform operations when the layout transform involves a rank expansion or contraction. The added unit test fails on main because the current SimplifyTranspose only doesn't consider the case when the layout transform and transpose may act on tensors of different rank. As an example,

NCHW4c -> LayoutTransform -> NCHW -> Transpose -> NHWC

now simplifies to

NCHW4c -> LayoutTransform -> NHWC.

The reverse, rank expansion, is also supported.

@csullivan
Copy link
Contributor Author

cc @comaniac @ANSHUMAN87 @mbrookhart

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Overall LGTM. Please add more comments to help future maintaners catch up the logic easily.

Copy link
Contributor

@ANSHUMAN87 ANSHUMAN87 left a comment

Choose a reason for hiding this comment

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

Thanks @csullivan for the PR!
Please find some comments.
Overall LGTM!

@csullivan
Copy link
Contributor Author

Thanks @comaniac @ANSHUMAN87! I've extended the support for various rank changing layout transform + transpose patterns. Please see the additional tests for an overview and let me know other change requests you may have.

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

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

LGTM. One bonus suggestion is it would be great to have one comment on the top of each new added test cases to brief explain what's testing.

@mbrookhart
Copy link
Contributor

@csullivan Thanks for the contribution. What's the status on this? I looks like it has a lint error.

Copy link
Contributor

@ANSHUMAN87 ANSHUMAN87 left a comment

Choose a reason for hiding this comment

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

Looks great now! 👍

@comaniac comaniac merged commit 396a09e into apache:main May 4, 2021
@comaniac
Copy link
Contributor

comaniac commented May 4, 2021

Thanks @csullivan @ANSHUMAN87

umangyadav pushed a commit to umangyadav/tvm that referenced this pull request May 5, 2021
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
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.

4 participants