-
Notifications
You must be signed in to change notification settings - Fork 25.1k
[Dynamo] Add DictKeySetVariable to capture dict_keys passed outside of compiled region #143374
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/143374
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f0ce4aa with merge base b23f11c ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
self.get_source().make_guard(GuardBuilder.SEQUENCE_LENGTH), | ||
self.get_source().make_guard(GuardBuilder.EQUALS_MATCH), | ||
) | ||
return DictKeySetVariable(items, source=self.source) |
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.
I understand that there is another DictKeys variable for tracking dict_keys, but it only derives from the dictionary itself. Within the compiled region, when users call dict.keys(), it essentially wraps the entire dictionary object. However, if dict_keys is passed from outside the compiled region, we can only access the mappingproxy via dict.keys().mapping.
I don’t think it’s necessary to add another DICT_KEYS guards for the mappingproxy again because:
1. If dict_keys is used together with the dictionary object, guards are already applied to the dictionary itself.
2. If dict_keys is used independently, its behavior is more like a set, we just need set similar guards.
This is why I introduced a new Dynamo variable rather than reuse the original DictKeys variable.
@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 |
Merge failedReason: Command
Details for Dev Infra teamRaised by workflow job |
@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 |
…ble (#143547) Pull Request resolved: #143547 Approved by: https://github.com/williamwen42 ghstack dependencies: #143374
Pull Request resolved: #143557 Approved by: https://github.com/williamwen42 ghstack dependencies: #143374, #143547
Stack from ghstack (oldest at bottom):
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames