Skip to content
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

Extend catching empty autocast regions to catch other empty contexts #1412

Open
IvanYashchuk opened this issue Nov 8, 2024 · 0 comments
Open
Labels
thunderfx for things that could be applicable to the dynamo+thunder frontend

Comments

@IvanYashchuk
Copy link
Collaborator

IvanYashchuk commented Nov 8, 2024

Originally posted by @kshitij12345 in #1400 (comment)

Besides {_enter/_exit}_autocast, from trace_rules.py, I could find
{_enter/_exit}_dual_level for forward mode auto-diff, {_enter/_exit}_inference_mode for inference mode.

Besides these, looking at ctx_manager.py, there could also be Stream, Grad, Device related context managers which are mapped to something like the following

old_stream = torch.cuda.get_current_stream()
new_stream = torch.cuda.Stream()
set_stream(new_stream)
# Some operations
set_stream(old_stream)

Refs:
https://github.com/pytorch/pytorch/blob/781c68c86549aa2fd155f92afb0406b7577ab31c/torch/_dynamo/trace_rules.py#L550-L552
https://github.com/pytorch/pytorch/blob/781c68c86549aa2fd155f92afb0406b7577ab31c/torch/_dynamo/trace_rules.py#L2393-L2394

@IvanYashchuk IvanYashchuk added the thunderfx for things that could be applicable to the dynamo+thunder frontend label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
thunderfx for things that could be applicable to the dynamo+thunder frontend
Projects
None yet
Development

No branches or pull requests

1 participant