[dynamo] Add min/max bounds support to mark_unbacked#176313
[dynamo] Add min/max bounds support to mark_unbacked#176313laithsakka wants to merge 8 commits intogh/laithsakka/414/basefrom
Conversation
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/176313
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 2e74e51 with merge base 07efc60 ( 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. |
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. ghstack-source-id: 5f2f610 Pull Request resolved: #176313
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. [ghstack-poisoned]
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. [ghstack-poisoned]
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. ghstack-source-id: 5f2f610 Pull Request resolved: #176313
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. [ghstack-poisoned]
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. [ghstack-poisoned]
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. ghstack-source-id: 0fbc823 Pull Request resolved: #176313
Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). [ghstack-poisoned]
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. ghstack-source-id: e057ce9 Pull Request resolved: #176313
Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). [ghstack-poisoned]
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. ghstack-source-id: 97416af Pull Request resolved: #176313
| guard.user_stack, | ||
| ) | ||
|
|
||
| # TODO we dont have guards on _dynamo_unbacked_indices like those of _dynamo_dynamic_indices this seems wrong!! |
There was a problem hiding this comment.
Do we still need this todo now that we have guards? Or is this particularly saying these guards differ from dynamic_indices so need to change in the future?
There was a problem hiding this comment.
yeh we need those i am doing it in the PR on top of this basically
what this comment say
if we do mark_unbacked(x, [0,1]) then mark_unbacked(x, [0,1,2]), we do not recompile since we do not add any guards on _dynamo_unbacked_indices value.
Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). [ghstack-poisoned]
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. ghstack-source-id: 9eb449b Pull Request resolved: #176313
Lucaskabela
left a comment
There was a problem hiding this comment.
Thanks for the change - this looks good to me
|
@pytorchbot merge |
Merge startedYour 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 |
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). X-link: pytorch/pytorch#176313 Approved by: https://github.com/Lucaskabela, https://github.com/mlazos ghstack dependencies: #175946, #175956 Reviewed By: huydhn Differential Revision: D95914182 fbshipit-source-id: 0acdb0d80e3c4710a57deb70ebfbefe32af86f93
Summary: Adds min and max parameters to mark_unbacked() to allow specifying value range constraints for unbacked dimensions. When an unbacked symbol is created with min/max bounds, torch._check() calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)). This allows the optimizer to reason about unbacked symbols the same way it does for backed symbols, enabling constant folding and other optimizations that require knowing value ranges. Test Plan: Added test_mark_unbacked_min_max_bounds in test_dynamic_shapes.py. ghstack-source-id: 2304ec2 Pull Request resolved: pytorch/pytorch#176313
Stack from ghstack (oldest at bottom):
Adds min and max parameters to mark_unbacked() to allow specifying
value range constraints for unbacked dimensions.
When an unbacked symbol is created with min/max bounds, torch._check()
calls are emitted to establish the constraints (e.g., torch._check(u0 >= 1)).
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @Lucaskabela @jataylo