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
[GraphOptimizer] Optimize consecutive non-inverse transposes #2335
Conversation
* Two consecutive non-inverse transposes are fused in `sinkCode()` * Replace `dontCancelTwoTransposesIfNotMatching` unittest with `mergeNonInverseTransposes`
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Squadrick Thanks for the PR! Looks like it was very clean to implement.
I believe that this new functionality subsumes the other optimization that checks if two transposes reverse each other. Therefore you should be able to remove it along with isIdentityShuffle(mask1, mask2)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
Please use the PULL_REQUEST_TEMPLATE.md format.
Also, like @jfix71 said, you should be able to remove the isIdentityShuffle(mask1, mask2) logic because transposed that are inverses of each other should be combined by your logic to a single identity then removed.
Nice work @Squadrick ! |
…tive-transposes
* Add documentation about combining multiple consecutive tranposes * Remove redundant combining of tranposes that result in an identity * Add comments in the test case, clearly showing intermediate tensor dims
Hey, guys. I made the requested changes, and I've also updated the documentation. @jackm321 I've updated the PR to follow the specified templated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks @Squadrick.
I left one nit to resolve, and additionally it looks like our CI is breaking because the isIdentityShuffle()
that you removed a call to is no longer used.
Once you remove the unused isIdentityShuffle()
and fix the nit we can land this.
* `isIdentityShuffle()` is not longer required, and is removed. * Add period at end of comment
@jfix71 Removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks again @Squadrick!
Description
Testing
mergeNonInverseTransposes
replacesdontCancelTwoTransposesIfNotMatching
unit test inGraphOptzTest.cpp
.Documentation
docs/Optimizations.md
under graph optimization.Issues