Skip to content

Conversation

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 3, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/144173

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit de2fa35 with merge base 0a94bb4 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
@anijain2305 anijain2305 changed the title [dynamo][user-defined] Remove __getattribute__ checks [dynamo][user-defined] Remove __getattribute__ checks and add getsetdescriptor Jan 4, 2025
Copy link
Contributor

@jansel jansel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a test here?

Comment on lines 976 to 977
elif object_has_getattribute(self.value) and subobj is NO_SUCH_SUBOBJ:
raise AttributeError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how this works? Where is this being handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment in the latest commit. Dynamo has already tried tracing Getattribute by this point, and has encountered an AttributeError, so its right to return the AttributeError.

I tried really hard to write a test case with overridden __getattribute__ with side-effects. But I was unable to write one that fails on main branch, and passes with this PR. Everything I tried passes on main branch because either (1) there is a graph break on LOAD_ATTR (and therefore whole frame falls to eager), or (2) even though mutations are applied twice on main branch (one while invoking the getattribute method in _getattr_static and other with Dynamo residual bytecode) and is technically wrong, the residual bytecode writes the correct value at the end, so the tests still pass.

I did add a test for GetSetDescriptor in the latest commit.

…add getsetdescriptor"

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
@anijain2305
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants