Skip to content

Conversation

StrongerXi
Copy link
Contributor

@StrongerXi StrongerXi commented May 20, 2025

Stack from ghstack (oldest at bottom):

Fixes #133762. This involves

  1. support tuple subclass constructed inside compile region.
  2. handle the "fake" global scope associated with NamedTuple-generated
    __new__.
  3. handle namedtuple._tuplegetter more faithfully.

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

Differential Revision: D75488091

Fixes #133762. We just need to
1. handle the "fake" global scope associated with NamedTuple generated
   `__new__`.
2. handle `namedtuple._tuplegetter` more faithfully.

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 20, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (3 Unrelated Failures)

As of commit 4c25a19 with merge base 7ae204c (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

StrongerXi added a commit that referenced this pull request May 20, 2025
Fixes #133762. We just need to
1. handle the "fake" global scope associated with NamedTuple generated
   `__new__`.
2. handle `namedtuple._tuplegetter` more faithfully.

ghstack-source-id: 118f9d0
Pull Request resolved: #153982
Fixes #133762. We just need to
1. handle the "fake" global scope associated with NamedTuple generated
   `__new__`.
2. handle `namedtuple._tuplegetter` more faithfully.

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

[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request May 21, 2025
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

ghstack-source-id: c61116a
Pull Request resolved: #153982
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

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

[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request May 23, 2025
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.
5. fixing `is` and `is not` handling when `GetAttrVariable` is involved.
   This was exposed by a numpy test case under dynamo:
   test_broadcast_single_arg, see comments in the patch for more.

ghstack-source-id: 8bbe65b
Pull Request resolved: #153982
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

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

[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request May 23, 2025
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.
5. fixing `is` and `is not` handling when `GetAttrVariable` is involved.
   This was exposed by a numpy test case under dynamo:
   test_broadcast_single_arg, see comments in the patch for more.

ghstack-source-id: 594b14c
Pull Request resolved: #153982
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.
5. fixing `is` and `is not` handling when `GetAttrVariable` is involved.
   This was exposed by a numpy test case under dynamo:
   test_broadcast_single_arg, see comments in the patch for more.

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

[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request May 24, 2025
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

ghstack-source-id: 4a18e55
Pull Request resolved: #153982
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

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

[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request May 27, 2025
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

ghstack-source-id: e886a52
Pull Request resolved: #153982
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

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

[ghstack-poisoned]
StrongerXi added a commit that referenced this pull request May 27, 2025
Fixes #133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.
4. use `object.__getattribute__(obj, "__dict__")[key] = value` to replay
   side effects onto pre-existing user-defined objects, because
   `object.__setattr__` can still trigger user code on via descriptors
   setter.

ghstack-source-id: 5bd1192
Pull Request resolved: #153982
@StrongerXi
Copy link
Contributor Author

@StrongerXi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 27, 2025
@StrongerXi StrongerXi requested review from jansel and anijain2305 and removed request for jansel May 28, 2025 04:53
@StrongerXi
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

qingyi-yan pushed a commit to qingyi-yan/pytorch that referenced this pull request Jun 3, 2025
Fixes pytorch#133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.

Differential Revision: [D75488091](https://our.internmc.facebook.com/intern/diff/D75488091)
Pull Request resolved: pytorch#153982
Approved by: https://github.com/jansel
ghstack dependencies: pytorch#154176
iupaikov-amd pushed a commit to ROCm/pytorch that referenced this pull request Jun 4, 2025
Fixes pytorch#133762. This involves
1. support tuple subclass constructed inside compile region.
2. handle the "fake" global scope associated with NamedTuple-generated
   `__new__`.
3. handle `namedtuple._tuplegetter` more faithfully.

Differential Revision: [D75488091](https://our.internmc.facebook.com/intern/diff/D75488091)
Pull Request resolved: pytorch#153982
Approved by: https://github.com/jansel
ghstack dependencies: pytorch#154176
@github-actions github-actions bot deleted the gh/StrongerXi/116/head branch July 2, 2025 02:19
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.

Cannot override __add__ in NamedTuple with __new__ + torch.compile
3 participants