[dynamo] Make global state guards and torch function stack guards droppable.#167674
[dynamo] Make global state guards and torch function stack guards droppable.#167674
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/167674
Note: Links to docs will display an error until the docs builds have been completed. ⏳ 1 Pending, 4 Unrelated FailuresAs of commit ec46563 with merge base 4de24bc ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ee7e48e to
b023bb6
Compare
…ppable. Summary: Prior to this PR we will always build global and torch funciton guards in all cases. In this PR we did 2 changes to dynamo guards: 1. Created a new guard called "GLOBAL_STATE" which corresponds to the global state guard and can be filtered out using guard_filter_fn 2. Repurpose the existing "TORCH_FUNCTION_STATE" guard for checking torch function mode stack. Also added a new helper `torch.compiler.skip_all_guards_unsafe` which can be useful for use cases like vllm Test Plan: CI
b023bb6 to
ec46563
Compare
| return [not entry.is_global for entry in guard_entries] | ||
|
|
||
|
|
||
| def skip_all_guards_unsafe(guard_entries): |
There was a problem hiding this comment.
This is good.
Is it also possible to add a config option somewhere to skip building the guards itself? If user does not want guards, we can just short-circuit sooner.
There was a problem hiding this comment.
Yeah, sounds a good item to do. Not sure about the amount of changed code yet if we skip builder entirely. Can take a look further.
|
@pytorchbot merge |
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 |
…ppable. (pytorch#167674) Summary: Prior to this PR we will always build global and torch funciton guards in all cases. In this PR we did 2 changes to dynamo guards: 1. Created a new guard called "GLOBAL_STATE" which corresponds to the global state guard and can be filtered out using guard_filter_fn 2. Repurpose the existing "TORCH_FUNCTION_STATE" guard for checking torch function mode stack. Also added a new helper `torch.compiler.skip_all_guards_unsafe` which can be useful for use cases like vllm Test Plan: CI Fixes #ISSUE_NUMBER Pull Request resolved: pytorch#167674 Approved by: https://github.com/anijain2305
…ppable. (pytorch#167674) Summary: Prior to this PR we will always build global and torch funciton guards in all cases. In this PR we did 2 changes to dynamo guards: 1. Created a new guard called "GLOBAL_STATE" which corresponds to the global state guard and can be filtered out using guard_filter_fn 2. Repurpose the existing "TORCH_FUNCTION_STATE" guard for checking torch function mode stack. Also added a new helper `torch.compiler.skip_all_guards_unsafe` which can be useful for use cases like vllm Test Plan: CI Fixes #ISSUE_NUMBER Pull Request resolved: pytorch#167674 Approved by: https://github.com/anijain2305
Summary:
Prior to this PR we will always build global and torch funciton guards in all cases.
In this PR we did 2 changes to dynamo guards:
Also added a new helper
torch.compiler.skip_all_guards_unsafewhich can be useful for use cases like vllmTest Plan:
CI
Fixes #ISSUE_NUMBER
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames @Lucaskabela @mlazos