Skip to content

[Dynamo] Clear/restore torch function mode stack to prevent overriding torch.compile infrastructure#134733

Closed
mlazos wants to merge 26 commits intogh/mlazos/79/basefrom
gh/mlazos/79/head
Closed

[Dynamo] Clear/restore torch function mode stack to prevent overriding torch.compile infrastructure#134733
mlazos wants to merge 26 commits intogh/mlazos/79/basefrom
gh/mlazos/79/head

Conversation

@mlazos
Copy link
Contributor

@mlazos mlazos commented Aug 28, 2024

After discussing offline with @bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped.

Stack from ghstack (oldest at bottom):

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

…g torch.compile infrastructure

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Aug 28, 2024

🔗 Helpful Links

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

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

❌ 35 New Failures

As of commit 5c9b0df with merge base 042f2f7 (image):

NEW FAILURES - The following jobs have failed:

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

…t overriding torch.compile infrastructure"

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

[ghstack-poisoned]
@mlazos mlazos requested review from anijain2305 and bdhirsh August 28, 2024 23:31
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
mlazos added a commit that referenced this pull request Sep 5, 2024
…g torch.compile infrastructure

ghstack-source-id: a4bfc48
Pull Request resolved: #134733

fix
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
mlazos added a commit that referenced this pull request Sep 5, 2024
…g torch.compile infrastructure

ghstack-source-id: 4abb020
Pull Request resolved: #134733

fix
mlazos added a commit that referenced this pull request Sep 5, 2024
…g torch.compile infrastructure

ghstack-source-id: 4abb020
Pull Request resolved: #134733

fix
mlazos added a commit that referenced this pull request Sep 7, 2024
…g torch.compile infrastructure

ghstack-source-id: 4abb020
Pull Request resolved: #134733

fix
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
…t overriding torch.compile infrastructure"

After discussing offline with bdhirsh, we reached the conclusion that while tracing torch function modes it does not make sense to respect user overrides on functions we are running (ie the torch profiler for example) during the execution of torch.compile code, since we are symbolically respecting those modes during tracing. So, we pop all modes before tracing begins and restore them after tracing ends. Note the symbolic torch function mode stack contains all of the modes before they are popped. 




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

[ghstack-poisoned]
mlazos added a commit that referenced this pull request Sep 8, 2024
…g torch.compile infrastructure

ghstack-source-id: a5c2282
Pull Request resolved: #134733

fix
mlazos added a commit that referenced this pull request Sep 8, 2024
ghstack-source-id: 184c342
Pull Request resolved: #135422

[Dynamo] Clear/restore torch function mode stack to prevent overriding torch.compile infrastructure

ghstack-source-id: 184c342
Pull Request resolved: #134733

fix
@mlazos
Copy link
Contributor Author

mlazos commented Sep 10, 2024

Merged into #135422

@mlazos mlazos closed this Sep 10, 2024
@github-actions github-actions bot deleted the gh/mlazos/79/head branch October 12, 2024 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants