-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[torch][fx] Add new replacement_callback to materialize a replacement just in time #135553
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/135553
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 958e9df with merge base 3bf6be4 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D62412628 |
|
lgtm, could you mind adding a unittest? |
|
@SherlockNoMad where should I add a unit test for this function? Is |
|
This pull request was exported from Phabricator. Differential Revision: D62412628 |
46061d1 to
e1ccf3d
Compare
|
This pull request was exported from Phabricator. Differential Revision: D62412628 |
e1ccf3d to
be2966c
Compare
|
This pull request was exported from Phabricator. Differential Revision: D62412628 |
be2966c to
519ab8e
Compare
… just in time (pytorch#135553) Summary: Pull Request resolved: pytorch#135553 Sometimes we only want to generate a replacement for a matched pattern once we know some information about the nodes in the pattern. So far, we have found this the most useful to do matches based on specific shapes of tensors flowing into functions. Use a callback function similar to `match_filters`. By default this isn't used. Had to make `replacement` a None-able parameter because Callable was already used to detect a case where a graph needed to be traced. Test Plan: Added a new unit test in test_subgraph_rewriter.py Reviewed By: SherlockNoMad Differential Revision: D62412628
|
This pull request was exported from Phabricator. Differential Revision: D62412628 |
519ab8e to
958e9df
Compare
|
@pytorchbot merge -f 'Landed internally' (Initiating merge automatically since Phabricator Diff has merged, using force because this PR might not pass merge_rules.json but landed internally) |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
… just in time (pytorch#135553) Summary: Sometimes we only want to generate a replacement for a matched pattern once we know some information about the nodes in the pattern. So far, we have found this the most useful to do matches based on specific shapes of tensors flowing into functions. Use a callback function similar to `match_filters`. By default this isn't used. Had to make `replacement` a None-able parameter because Callable was already used to detect a case where a graph needed to be traced. Differential Revision: D62412628 Pull Request resolved: pytorch#135553 Approved by: https://github.com/SherlockNoMad
Summary:
Sometimes we only want to generate a replacement for a matched pattern
once we know some information about the nodes in the pattern.
So far, we have found this the most useful to do matches based on specific
shapes of tensors flowing into functions.
Use a callback function similar to
match_filters. By default this isn't used.Had to make
replacementa None-able parameter because Callable wasalready used to detect a case where a graph needed to be traced.
Differential Revision: D62412628