-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
base: gh/laithsakka/200/base
Are you sure you want to change the base?
Conversation
[ghstack-poisoned]
🔗 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 FailuresAs of commit 3323630 with merge base 0f3db20 ( 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. |
…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]
…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]
# 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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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...'
There was a problem hiding this 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]
There was a problem hiding this 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice !
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