Skip to content

Change mutation type of MutableMappingVariable to AttributeMutationNew#159366

Closed
guilhermeleobas wants to merge 11 commits intogh/guilhermeleobas/215/basefrom
gh/guilhermeleobas/215/head
Closed

Change mutation type of MutableMappingVariable to AttributeMutationNew#159366
guilhermeleobas wants to merge 11 commits intogh/guilhermeleobas/215/basefrom
gh/guilhermeleobas/215/head

Conversation

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Jul 29, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 0e1acc4 with merge base e299926 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@guilhermeleobas guilhermeleobas marked this pull request as ready for review August 1, 2025 14:29
[ghstack-poisoned]
[ghstack-poisoned]
super().__init__(value, **kwargs)
self.generic_dict_vt = variables.ConstDictVariable({})
self.mutation_type = AttributeMutationExisting()
self.mutation_type = AttributeMutationNew()
Copy link
Contributor

@zou3519 zou3519 Aug 13, 2025

Choose a reason for hiding this comment

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

I don't understand this one, is there an explanation on why it should be AttributeMutationNew vs AttributeMutationExisting ?

Copy link
Collaborator Author

@guilhermeleobas guilhermeleobas Aug 14, 2025

Choose a reason for hiding this comment

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

From the source code:

class AttributeMutationExisting(AttributeMutation):
    """
    This case of VariableTracker.mutation_type marker indicates
    1. ...
    2. The value exists before Dynamo tracing started.
    """
    ...

class AttributeMutationNew(AttributeMutation):
    """
    This case of VariableTracker.mutation_type marker indicates
    1. ...
    2. The value is created by the bytecode Dynamo is tracing through.
    """
    ...

The value has no source and cannot be AttributeMutationExisting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right. So, the mutation type depends on whether MutableMapping has a source or not.

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Starting merge as part of PR stack under #159483

@pytorchmergebot
Copy link
Collaborator

Starting merge as part of PR stack under #159368

[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Starting merge as part of PR stack under #159483

pytorchmergebot pushed a commit that referenced this pull request Aug 15, 2025
Pull Request resolved: #159368
Approved by: https://github.com/mlazos
ghstack dependencies: #159365, #159366
pytorchmergebot pushed a commit that referenced this pull request Aug 15, 2025
Pull Request resolved: #159483
Approved by: https://github.com/mlazos
ghstack dependencies: #159365, #159366, #159368
pytorchmergebot pushed a commit that referenced this pull request Aug 16, 2025
pytorchmergebot pushed a commit that referenced this pull request Aug 16, 2025
pytorchmergebot pushed a commit that referenced this pull request Aug 16, 2025
…ts (#159865)

Changes:
(1) Replace UserDefinedSetVariable by UserDefinedObjectVariable in all binop calls

Test plan:
(1) The three tests from CPython `test_collections.py` ensures that Dynamo can trace through a dunder method (e.g. __add__, __ixor__, etc) defined in a user defined class

Pull Request resolved: #159865
Approved by: https://github.com/mlazos
ghstack dependencies: #159365, #159366, #159368, #159483, #159902, #159864
pytorchmergebot pushed a commit that referenced this pull request Aug 18, 2025
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
…nNew` (pytorch#159366)

Also add MutableMappingVariable to `call_or_` / `call_ior`

Pull Request resolved: pytorch#159366
Approved by: https://github.com/zou3519
ghstack dependencies: pytorch#159365
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
…ts (pytorch#159865)

Changes:
(1) Replace UserDefinedSetVariable by UserDefinedObjectVariable in all binop calls

Test plan:
(1) The three tests from CPython `test_collections.py` ensures that Dynamo can trace through a dunder method (e.g. __add__, __ixor__, etc) defined in a user defined class

Pull Request resolved: pytorch#159865
Approved by: https://github.com/mlazos
ghstack dependencies: pytorch#159365, pytorch#159366, pytorch#159368, pytorch#159483, pytorch#159902, pytorch#159864
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
@github-actions github-actions bot deleted the gh/guilhermeleobas/215/head branch September 15, 2025 02:15
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
…nNew` (pytorch#159366)

Also add MutableMappingVariable to `call_or_` / `call_ior`

Pull Request resolved: pytorch#159366
Approved by: https://github.com/zou3519
ghstack dependencies: pytorch#159365
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
…ts (pytorch#159865)

Changes:
(1) Replace UserDefinedSetVariable by UserDefinedObjectVariable in all binop calls

Test plan:
(1) The three tests from CPython `test_collections.py` ensures that Dynamo can trace through a dunder method (e.g. __add__, __ixor__, etc) defined in a user defined class

Pull Request resolved: pytorch#159865
Approved by: https://github.com/mlazos
ghstack dependencies: pytorch#159365, pytorch#159366, pytorch#159368, pytorch#159483, pytorch#159902, pytorch#159864
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants