8000 [inductor] propagate shapes in CSEVariable by isuruf · Pull Request #152198 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[inductor] propagate shapes in CSEVariable #152198

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

Draft
wants to merge 6 commits into
base: gh/isuruf/141/base
Choose a base branch
from

Conversation

isuruf
Copy link
Collaborator
@isuruf isuruf commented Apr 25, 2025

[ghstack-poisoned]
Copy link
pytorch-bot bot commented Apr 25, 2025

🔗 Helpful Links

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

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 033bfb7 with merge base d119481 (image):

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

isuruf added a commit that referenced this pull request Apr 25, 2025
ghstack-source-id: 4d09a54
Pull Request resolved: #152198
@isuruf isuruf marked this pull request as draft April 25, 2025 17:11
Copy link
Contributor

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

[ghstack-poisoned]
isuruf added a commit that referenced this pull request Apr 25, 2025
ghstack-source-id: f2aa06b
Pull Request resolved: #152198
Copy link
Collaborator
@rec rec left a comment

Choose a reason for hiding this comment

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

Sorry, quick unsolicited review while waiting for something else, feel free to ignore!

🙂

@@ -74,6 +74,8 @@
# causes typing errors in subclasses (defined in other files).
OpVarT = str

ShapeType = Optional[Sequence[Union[int, str]]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's already a ShapeType in _prims_common defined as Union[torch.Size, list[int], tuple[int, ...]] and this type is already in use in _inductor.

What does it mean if a Shape has strings? Does it make sense to have str and int in the same collection?

Also, perhaps/probably the base type shouldn't be Optional? I see there are also Optional[ShapeType] type annotations below...?

@@ -1761,6 +1765,7 @@ def generate(
write: bool = True,
assignment: bool = True,
dtype: Optional[torch.dtype] = None,
shape: Optional[ShapeType] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it have to be Optional here, either? Couldn't the default be ()?

It makes the code simpler if you're not always checking for None.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

() means the variable is a scalar. None means we don't know.

[ghstack-poisoned]
isuruf added a commit that referenced this pull request May 2, 2025
ghstack-source-id: 540faf4
Pull Request resolved: #152198
[ghstack-poisoned]
isuruf added a commit that referenced this pull request May 2, 2025
ghstack-source-id: 617d336
Pull Request resolved: #152198
[ghstack-poisoned]
isuruf added a commit that referenced this pull request May 6, 2025
ghstack-source-id: e1a5739
Pull Request resolved: #152198
[ghstack-poisoned]
isuruf added a commit that referenced this pull request May 6, 2025
ghstack-source-id: 93c674e
Pull Request resolved: #152198
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.

3 participants
0