Content-Length: 436189 | pFad | http://github.com/pytorch/pytorch/pull/154774

BC unify symbolic_shapes and sizevars dynamic shapes APIs naming 1 by laithsakka · Pull Request #154774 · pytorch/pytorch · GitHub
Skip to content

unify symbolic_shapes and sizevars dynamic shapes APIs naming 1 #154774

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

Open
wants to merge 4 commits into
base: gh/laithsakka/200/base
Choose a base branch
from

Conversation

laithsakka
Copy link
Contributor

@laithsakka laithsakka commented May 30, 2025

Stack from ghstack (oldest at bottom):

Inductor have a set of APIs that allows performing symbolic evaluations similar to that of symbolic shapes
but it operates on sympy expressions instead of symnodes. Namings are not consistent making them consistent
in this stack.

Step 1 : unify statically_know_true naming! for consistent experience.

cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv @voznesenskym @penguinwu @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov

@laithsakka laithsakka requested a review from bobrenjc93 as a code owner May 30, 2025 23:30
Copy link

pytorch-bot bot commented May 30, 2025

🔗 Helpful Links

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

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

❌ 4 New Failures, 2 Unrelated Failures

As of commit 3323630 with merge base 0f3db20 (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

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

laithsakka added a commit that referenced this pull request May 30, 2025
ghstack-source-id: 387dd7f
Pull Request resolved: #154774
@laithsakka laithsakka changed the title unify symbplicshapes and sizevars APIs namings 1 unify symbplic_shapes and sizevars APIs dynamic shapes APIs namings 1 May 30, 2025
…s namings 1"

cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv voznesenskym penguinwu Guobing-Chen XiaobingSuper zhuhaozhe blzheng jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request May 30, 2025
ghstack-source-id: ab7c967
Pull Request resolved: #154774
…s namings 1"

cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv voznesenskym penguinwu Guobing-Chen XiaobingSuper zhuhaozhe blzheng jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request May 30, 2025
ghstack-source-id: 23588d3
Pull Request resolved: #154774
@laithsakka laithsakka changed the title unify symbplic_shapes and sizevars APIs dynamic shapes APIs namings 1 unify symbplic_shapes and sizevars dynamic shapes APIs naming 1 May 30, 2025
@laithsakka laithsakka changed the title unify symbplic_shapes and sizevars dynamic shapes APIs naming 1 unify symbolic_shapes and sizevars dynamic shapes APIs naming 1 May 30, 2025
# asked questions can be answered without guarding otherwise they return False.
# Those are similar to statically_known_true in symbolic_shapes but operate on sympy expressions
# instead of symnodes.
def statically_known_true(self, expr: Union[sympy.Basic, bool]) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

could you also add this in a doc block to this function, also can you keep the Note

Copy link
Contributor Author

@laithsakka laithsakka May 30, 2025

Choose a reason for hiding this comment

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

the old note? why would someone be interested in how things were long ago? i found it redundent specially that we still have APIs that guard in the current system like calling evaluate_expr in shapeenv or gaurd_or_false, guard_or_true ..etc

# Those are similar to statically_known_true in symbolic_shapes but operate on sympy expressions
# instead of symnodes.
def statically_known_true(self, expr: Union[sympy.Basic, bool]) -> bool:
return _statically_known_true(self.shape_env, expr)

def statically_known_equals(
self, left: Union[Expr, int], right: Union[Expr, int]
) -> bool:
"""
Returns a bool indicating if it is sound to optimize as if left and right are equal.
Copy link
Contributor

@drisspg drisspg May 30, 2025

Choose a reason for hiding this comment

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

I kinda wish all of these said something in a doc block , like `This function does not add guards, if it can determine that the expr left equals right at compile time it will return True, otherwise it will return False. An example when you should use is: a performance optimization that won't hinder correctness, etc...'

Copy link
Contributor

@drisspg drisspg left a comment

Choose a reason for hiding this comment

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

Left some comments

…ing 1"


Inductor have a set of APIs that allows performing symbolic evaluations similar to that of symbolic shapes 
but it operates on sympy expressions instead of symnodes. Namings are not consistent making them consistent 
in this stack.

Step 1 : unify statically_know_true naming! for consistent experience. 

cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv voznesenskym penguinwu Guobing-Chen XiaobingSuper zhuhaozhe blzheng jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request May 31, 2025
ghstack-source-id: f74f2ea
Pull Request resolved: #154774
Copy link
Contributor

@bobrenjc93 bobrenjc93 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 doing this

Copy link
Contributor

@eellison eellison left a comment

Choose a reason for hiding this comment

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

nice !

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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/pytorch/pytorch/pull/154774

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy