-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[WIP] suggest whitelist for dynamic shape recompilations #153442
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/153442
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 6 New FailuresAs of commit a11c15e with merge base 3aa8477 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/_dynamo/guards.py
Outdated
"Replicate": Replicate, | ||
"Partial": Partial, | ||
"DeviceMesh": DeviceMesh, | ||
}) |
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.
eval was failing due to local imports here:
pytorch/torch/_dynamo/guards.py
Lines 1675 to 1688 in 81719eb
if torch.distributed.is_available(): | |
from torch.distributed.device_mesh import DeviceMesh | |
from torch.distributed.tensor.placement_types import ( | |
Partial, | |
Replicate, | |
Shard, | |
) | |
ok_types = ok_types + ( | |
Shard, | |
Replicate, | |
Partial, | |
DeviceMesh, | |
) |
torch/_dynamo/guards.py
Outdated
code_part = f"{ref}.__tensor_flatten__()[1] == {original_metadata}" | ||
self.get_guard_manager(guard).add_lambda_guard( | ||
metadata_checker, get_verbose_code_parts(code_part, guard) | ||
) |
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.
__check_metadata wasn't registered as callable in closure_vars, so wasn't eval-able
…k/verbose_tensor_guards_v3
More processing of recompilation reasons, to detect tensor sources we've recompiled dynamically, and suggest the dynamic whitelist to reduce recompilations.
Refactors GuardDebugInfo to hold both
verbose_code_parts
andfailure_reasons
fields, the former containing eval-able code, the latter reasons in plain english; previously they were combined in the same field and detecting what to eval/pattern-match was difficult.For this toy example:
logs with
TORCH_LOGS="recompiles"
:(first recompile)
(second recompile)
logs with
TORCH_LOGS="recompiles_verbose"
:(first recompile)
(second recompile)
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames