-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Add support for tracing vmap in pre-dispatch export #154650
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/154650
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 8459179 with merge base 5ee464d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
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.
Our conclusion from the meeting on Tuesday was:
- Yes, we're going to put all the API calls into the graph
- We should only interpose on these API calls when non-strict export is on. These shouldn't go through regular torch_function, because they are private APIs.
- It might be easier to do this by creating a python function wrapper around e.g. add_batch_dim, and then putting the torch_function handler and export checks into said function. This may require you to add these new functions to Dynamo skiplists to not break the Dynamo side of things
7472d71 to
bd6401b
Compare
Summary: ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Differential Revision: D75623875
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
1 similar comment
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
Summary: Pull Request resolved: pytorch#154650 ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Differential Revision: D75623875
bd6401b to
c0a8978
Compare
71f718a to
11f079b
Compare
Summary: ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Differential Revision: D75623875
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
Summary: ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Differential Revision: D75623875
11f079b to
b327868
Compare
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
Summary: ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Differential Revision: D75623875
b327868 to
6592b95
Compare
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
Summary: ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Differential Revision: D75623875
6592b95 to
d4b6021
Compare
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
Summary: ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Differential Revision: D75623875
d4b6021 to
65fb23a
Compare
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
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.
give me some docs about what is going on in proxy_tensor.py
Summary: ONNX team ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. Test Plan: CI Reviewed By: zou3519 Differential Revision: D75623875
65fb23a to
8459179
Compare
|
This pull request was exported from Phabricator. Differential Revision: D75623875 |
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: ONNX team and recent transformer upgrade ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops. The implementation strategy is: 1. We add python wrappers around vmap APIs so that we attach custom torch function handler that is only on during non-strict export. The reason is we don't want to add this to default torch_function handler because it will break BC. 2. Some dynamo changes to make sure it picks up new python wrapper APIs. The reason is when we do strict export, we need to re-materialize these APIs in pre-dispatch IR from torch IR. We can avoid this by special casing in dynamo for export to proxy different API calls but i feel that is too much chaos because you need to be able to proxy 2 different variants of same vmap API. Test Plan: CI Differential Revision: D75623875 Pull Request resolved: pytorch#154650 Approved by: https://github.com/ezyang, https://github.com/zou3519
Summary: ONNX team and recent transformer upgrade ran into this error and we also ran into during our export benchmarking. This diff makes it possible to trace through vmap implementation in pre-dispatch IR. Note that we don't support serializing functorch ops in pre-dispatch IR and in the future, we should desugar them to post-grad ops.
The implementation strategy is:
Test Plan: CI
Differential Revision: D75623875
cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv @voznesenskym @penguinwu @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @jiayisunx @chenyang78 @kadeng @chauhang @amjames @Lucaskabela