KEMBAR78
[dynamo][NFC] Rename `mutable_local` and add documentation by StrongerXi · Pull Request #139339 · pytorch/pytorch · GitHub
Skip to content

Conversation

@StrongerXi
Copy link
Contributor

@StrongerXi StrongerXi commented Oct 30, 2024

Stack from ghstack (oldest at bottom):

This patch addresses the renaming part of #133027, specifically, it
renames the following and adds documentation for relevant classes.

  1. VariableTracker.mutable_local to mutation_type
  2. MatableLocal to ValueMutationNew
  3. MutableSideEffects to ValueMutationExisting
  4. MutableLocalSource to SourceType
  5. MutableLocalSource.Local to New

Note that (2), (3) and (5) are mainly to bring consistency between them
and AttributeMutationNew, AttributeMutationExisting.

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

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 30, 2024

🔗 Helpful Links

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

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

✅ No Failures

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

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



class MutableSideEffects(MutableLocalBase):
class ValueMutationExisting(MutationType):
Copy link
Contributor

Choose a reason for hiding this comment

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

Move these to base.py? Thinking if all these are better to have in one file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's in the next patch, wanted to make review easier:) #139340

Copy link
Contributor

@anijain2305 anijain2305 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. This will greatly help others to onboard on side effects

@StrongerXi StrongerXi added the topic: not user facing topic category label Nov 4, 2024
[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Nov 5, 2024
pytorchmergebot pushed a commit that referenced this pull request Nov 5, 2024
…Tracker` (#139341)

This patch adds 2 simple methods `VariableTracker.is_mutable()` and
`VariableTracker.is_immutable()`, which helps clarify intention. For
instance, rather than writing
```python
if var.mutation_type:
    ...
```
After this patch one can write
```python
if var.is_mutable():
    ...
```

This patch also simplifies `mutation_type` propagation in some
`ListVariable` methods.

Pull Request resolved: #139341
Approved by: https://github.com/mlazos, https://github.com/anijain2305
ghstack dependencies: #139339, #139340
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
…39339)

This patch addresses the renaming part of pytorch#133027, specifically, it
renames the following and adds documentation for relevant classes.
1. `VariableTracker.mutable_local` to `mutation_type`
2. `MatableLocal `to `ValueMutationNew`
3. `MutableSideEffects `to `ValueMutationExisting`
4. `MutableLocalSource` to `SourceType`
5. `MutableLocalSource.Local` to `New`

Note that (2), (3) and (5) are mainly to bring consistency between them
and `AttributeMutationNew`, `AttributeMutationExisting`.

Pull Request resolved: pytorch#139339
Approved by: https://github.com/jansel, https://github.com/mlazos, https://github.com/anijain2305
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
…Tracker` (pytorch#139341)

This patch adds 2 simple methods `VariableTracker.is_mutable()` and
`VariableTracker.is_immutable()`, which helps clarify intention. For
instance, rather than writing
```python
if var.mutation_type:
    ...
```
After this patch one can write
```python
if var.is_mutable():
    ...
```

This patch also simplifies `mutation_type` propagation in some
`ListVariable` methods.

Pull Request resolved: pytorch#139341
Approved by: https://github.com/mlazos, https://github.com/anijain2305
ghstack dependencies: pytorch#139339, pytorch#139340
@github-actions github-actions bot deleted the gh/StrongerXi/13/head branch December 6, 2024 02:13
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.

5 participants