-
Notifications
You must be signed in to change notification settings - Fork 25.6k
dynamo: wrap graph break inst in try except block - with context manager setup/teardown #94758
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
dynamo: wrap graph break inst in try except block - with context manager setup/teardown #94758
Conversation
…etup-with-prefix-after-FailedInlining
…on/dynamo-setup-with-prefix-after-FailedInlining
…on/dynamo-setup-with-prefix-after-FailedInlining
…on/dynamo-setup-with-prefix-after-FailedInlining
Gently ping @jon-chuang, can you address these inline comments? We hit another bug #94758, which potentially can be fixed by this. It's good we can merge this ASAP. |
Hello @yanboliang , should be ready now. |
We need to add a |
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.
LGTM, cc @williamwen42 to check if this breaks any Python 3.11 change.
I guess full 3.11 testing is not currently in CI? Else if it is, it seems safe to merge. |
@pytorchmergebot merge |
Anw, if it turns out there is a problem, we can fix it, for now I'll assume CI is the source of truth here. |
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 |
…ger setup/teardown (#94758) Replacement to pytorch/pytorch#94672. Follow up to pytorch/pytorch#94137. We simply replace the set grad mode try except blocks with one for a more generic contextmanager (using `__enter__` and `__exit__`), storing the context manager into a `symbolic_local` for the duration of the try block. (see pytorch/torchdynamo#207 for the original motivation) This allows us to handle calling inner functions with graph breaks for any arbitrarily deep nesting of live context managers subclassing `AbstractContextManager`. (see tests) Pull Request resolved: pytorch/pytorch#94758 Approved by: https://github.com/yanboliang
…ger setup/teardown (#94758) Replacement to pytorch/pytorch#94672. Follow up to pytorch/pytorch#94137. We simply replace the set grad mode try except blocks with one for a more generic contextmanager (using `__enter__` and `__exit__`), storing the context manager into a `symbolic_local` for the duration of the try block. (see pytorch/torchdynamo#207 for the original motivation) This allows us to handle calling inner functions with graph breaks for any arbitrarily deep nesting of live context managers subclassing `AbstractContextManager`. (see tests) Pull Request resolved: pytorch/pytorch#94758 Approved by: https://github.com/yanboliang
…ger setup/teardown (pytorch#94758) Replacement to pytorch#94672. Follow up to pytorch#94137. We simply replace the set grad mode try except blocks with one for a more generic contextmanager (using `__enter__` and `__exit__`), storing the context manager into a `symbolic_local` for the duration of the try block. (see pytorch/torchdynamo#207 for the original motivation) This allows us to handle calling inner functions with graph breaks for any arbitrarily deep nesting of live context managers subclassing `AbstractContextManager`. (see tests) Pull Request resolved: pytorch#94758 Approved by: https://github.com/yanboliang
Replacement to #94672.
Follow up to #94137.
We simply replace the set grad mode try except blocks with one for a more generic contextmanager (using
__enter__
and__exit__
), storing the context manager into asymbolic_local
for the duration of the try block.(see pytorch/torchdynamo#207 for the original motivation)
This allows us to handle calling inner functions with graph breaks for any arbitrarily deep nesting of live context managers subclassing
AbstractContextManager
. (see tests)cc @soumith @voznesenskym @yanboliang @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @desertfire @jansel @ngimel @Chillee