-
Notifications
You must be signed in to change notification settings - Fork 26.4k
Optimizer: optimize transposes in variety of circumstances #3509
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
Conversation
|
now removes nop transposes, consecutive transposes that cancel out, and transposes-into-Gemm (which can just be a parameter to Gemm) |
torch/csrc/jit/passes/peephole.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Thanks, this looks great! I wrote one minor comment about generalizing transpose/permutation fusion, but everything looks fine. Before we merge, we're going to need a test. Do you know how to operate the accept test machinery? |
|
@pytorchbot test this please |
|
generalized logic, cleaned up code and comments, and corrected several bugs related to mutating shared references and to resource deallocation. |
f591005 to
b4a776b
Compare
houseroad
left a comment
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, this is great!
BTW, what happens to our CI?
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Looks great! As for the tests - it seems that the ordering of ops in backward pass is not deterministic (https://travis-ci.org/pytorch/pytorch/jobs/299841429). It's not related to this diff, but @zdevito and @ezyang might be interested in figuring out a better way to unittest graphs. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
6435199 to
b60bb9e
Compare
|
Are we going to land it (I guess the only missing part is tests) or do you plan to put it in the separate transforms library? |
|
I would say no reason not to land it - and also some tests are here ezyang/onnx-pytorch#40 |
- No-op transposes - Consecutive transposes (fuse them) - Transposes into Gemm (fuse them into transA/transB parameter)
|
@pytorchbot test this please |
* Optimizer: optimize transposes in variety of circumstances (#3509) * Optimizer: Optimize transposes in variety of circumstances - No-op transposes - Consecutive transposes (fuse them) - Transposes into Gemm (fuse them into transA/transB parameter) * touch up out of date comment * Backporting optimizer changes
* Optimizer: optimize transposes in variety of circumstances (#3509) * Optimizer: Optimize transposes in variety of circumstances - No-op transposes - Consecutive transposes (fuse them) - Transposes into Gemm (fuse them into transA/transB parameter) * touch up out of date comment * Backporting optimizer changes
* Optimizer: optimize transposes in variety of circumstances (pytorch#3509) * Optimizer: Optimize transposes in variety of circumstances - No-op transposes - Consecutive transposes (fuse them) - Transposes into Gemm (fuse them into transA/transB parameter) * touch up out of date comment * Backporting optimizer changes
* Optimizer: optimize transposes in variety of circumstances (pytorch#3509) * Optimizer: Optimize transposes in variety of circumstances - No-op transposes - Consecutive transposes (fuse them) - Transposes into Gemm (fuse them into transA/transB parameter) * touch up out of date comment * Backporting optimizer changes
This is a first pass to get feedback