Skip to content

Conversation

zhxchen17
Copy link
Contributor

@zhxchen17 zhxchen17 commented May 1, 2025

Stack from ghstack (oldest at bottom):

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.

Test Cases:

  1. torch.compile() without functorch layers present. Guard should fail with any layer being pushed.
  2. torch.compile() nested in vmap.
  3. torch.compile() nested in grad.
  4. torch.compile() nested in jvp + vmap
  5. torch.compile() nested functionalize
  6. torch.compile() nested in vmap + grad

Differential Revision: D74008787

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @jerryzh168 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 1, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152616

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 9 Pending

As of commit 3b19083 with merge base 3849fd1 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74008787

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74008787

Copy link
Contributor

@jansel jansel left a comment

Choose a reason for hiding this comment

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

Add tests?

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
zhxchen17 added a commit that referenced this pull request May 1, 2025
Pull Request resolved: #152616

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.
ghstack-source-id: 281471598

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74008787

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
@pytorch-bot pytorch-bot bot added the module: cpu CPU specific problem (e.g., perf, algorithm) label May 2, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74008787

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)

cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 jerryzh168 voznesenskym penguinwu EikanWang Guobing-Chen zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
zhxchen17 added a commit that referenced this pull request May 2, 2025
Pull Request resolved: #152616

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.
ghstack-source-id: 281574176

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74008787

@zhxchen17 zhxchen17 requested review from zou3519 and jansel May 2, 2025 01:41
@zhxchen17
Copy link
Contributor Author

Added more tests.

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.

## Test Cases:

0. torch.compile() without functorch layers present. Guard should fail with any layer being pushed.
1. torch.compile() nested in vmap.
2. torch.compile() nested in grad.
3. torch.compile() nested in jvp + vmap
4. torch.compile() nested functionalize
5. torch.compile() nested in vmap + grad

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)

cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 jerryzh168 voznesenskym penguinwu EikanWang Guobing-Chen zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
zhxchen17 added a commit that referenced this pull request May 2, 2025
Pull Request resolved: #152616

Make Functorch interpreters serializable most of the time, so that we can save the guards on functorch states.
ghstack-source-id: 281656876

Differential Revision: [D74008787](https://our.internmc.facebook.com/intern/diff/D74008787/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74008787

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 5, 2025
@pytorchmergebot
Copy link
Collaborator

Starting merge as part of PR stack under #152723

pytorchmergebot pushed a commit that referenced this pull request May 5, 2025
Seems this guard is not very active. Adding a test to detect error handling at least.

Differential Revision: [D74074837](https://our.internmc.facebook.com/intern/diff/D74074837/)

Pull Request resolved: #152687
Approved by: https://github.com/jansel
ghstack dependencies: #152615, #152616
pytorchmergebot pushed a commit that referenced this pull request May 5, 2025
Punt on WEAREF_ALIVE as weakref won't live across the process and users might need to drop them upfront.

Differential Revision: [D74088735](https://our.internmc.facebook.com/intern/diff/D74088735/)

Pull Request resolved: #152716
Approved by: https://github.com/jansel
ghstack dependencies: #152615, #152616, #152687
pytorchmergebot pushed a commit that referenced this pull request May 5, 2025
MappingProxyType

Differential Revision: [D74091363](https://our.internmc.facebook.com/intern/diff/D74091363/)

Pull Request resolved: #152721
Approved by: https://github.com/jansel
ghstack dependencies: #152615, #152616, #152687, #152716
pytorchmergebot pushed a commit that referenced this pull request May 5, 2025
DICT_KEYS_MATCH

Differential Revision: [D74091886](https://our.internmc.facebook.com/intern/diff/D74091886/)

Pull Request resolved: #152723
Approved by: https://github.com/jansel
ghstack dependencies: #152615, #152616, #152687, #152716, #152721
@github-actions github-actions bot deleted the gh/zhxchen17/13/head branch June 15, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged module: cpu CPU specific problem (e.g., perf, algorithm) module: dynamo topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants