Skip to content

Re-land: symbolic shapes guarding_hint_or_throw and optimization_hint (#175497) (#177570) - #177570

Closed
laithsakka wants to merge 1 commit into
pytorch:mainfrom
laithsakka:export-D96046862
Closed

laithsakka wants to merge 1 commit into
pytorch:mainfrom
laithsakka:export-D96046862

Conversation

@laithsakka

@laithsakka laithsakka commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

X-link: pytorch/benchmark#2672

similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @Lucaskabela

@pytorch-bot

pytorch-bot Bot commented Mar 16, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit 7b236a4 with merge base 4b76c95 (image):

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

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

@meta-codesync

meta-codesync Bot commented Mar 16, 2026

Copy link
Copy Markdown

@laithsakka has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96046862.

@meta-codesync meta-codesync Bot changed the title Re-land: symbolic shapes guarding_hint_or_throw and optimization_hint (#175497) Re-land: symbolic shapes guarding_hint_or_throw and optimization_hint (#175497) (#177570) Mar 16, 2026
laithsakka added a commit to laithsakka/pytorch that referenced this pull request Mar 16, 2026
…pytorch#175497) (pytorch#177570)

Summary:

X-link: pytorch/benchmark#2672


similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862
laithsakka added a commit to laithsakka/pytorch that referenced this pull request Mar 16, 2026
…pytorch#175497) (pytorch#177570)

Summary:

X-link: pytorch/benchmark#2672


similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862
laithsakka added a commit to laithsakka/pytorch that referenced this pull request Mar 16, 2026
…pytorch#175497) (pytorch#177570)

Summary:
Pull Request resolved: pytorch#177570

X-link: pytorch/benchmark#2672

similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862
@laithsakka laithsakka added the suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) label Mar 17, 2026
laithsakka added a commit to laithsakka/pytorch that referenced this pull request Mar 17, 2026
…pytorch#175497) (pytorch#177570)

Summary:

X-link: pytorch/benchmark#2672


similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862
laithsakka added a commit to laithsakka/pytorch that referenced this pull request Mar 17, 2026
…pytorch#175497) (pytorch#177570)

Summary:

X-link: pytorch/benchmark#2672


similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862
…pytorch#175497) (pytorch#177570)

Summary:
Pull Request resolved: pytorch#177570

X-link: pytorch/benchmark#2672

similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862
@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Mar 17, 2026
@laithsakka

Copy link
Copy Markdown
Contributor Author

@pytorchbot commit

@pytorch-bot

pytorch-bot Bot commented Mar 17, 2026

Copy link
Copy Markdown

❌ 🤖 pytorchbot command failed:

@pytorchbot: error: argument command: invalid choice: 'commit' (choose from 'merge', 'revert', 'rebase', 'label', 'drci', 'lint', 'fix-lint', 'apply-lint', 'cherry-pick')

usage: @pytorchbot [-h]
                   
                   {merge,revert,rebase,label,drci,lint,fix-lint,apply-lint,cherry-pick}
                   ...

Try @pytorchbot --help for more info.

@laithsakka

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: This PR has internal changes and must be landed via Phabricator! Please try reimporting/rexporting the PR!

Details for Dev Infra team Raised by workflow job

meta-codesync Bot pushed a commit to pytorch/benchmark that referenced this pull request Mar 17, 2026
… (#175497) (#2672)

Summary:
X-link: pytorch/pytorch#177570

Pull Request resolved: #2672

similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Reviewed By: huydhn

Differential Revision: D96046862

fbshipit-source-id: db85ae13d29b7ace03154f1829b2bcbc465a266b
@laithsakka

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
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

EmanueleCoradin pushed a commit to EmanueleCoradin/pytorch that referenced this pull request Mar 30, 2026
…pytorch#175497) (pytorch#177570) (pytorch#177570)

Summary:

X-link: pytorch/benchmark#2672

similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862

Pull Request resolved: pytorch#177570
Approved by: https://github.com/bobrenjc93, https://github.com/huydhn
AaronWang04 pushed a commit to AaronWang04/pytorch that referenced this pull request Mar 31, 2026
…pytorch#175497) (pytorch#177570) (pytorch#177570)

Summary:

X-link: pytorch/benchmark#2672

similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862

Pull Request resolved: pytorch#177570
Approved by: https://github.com/bobrenjc93, https://github.com/huydhn
drizzlezyk pushed a commit to Ascend/pytorch that referenced this pull request May 9, 2026
Co-authored-by: chansinging<[email protected]>
Co-authored-by: Chansinging<[email protected]>



# message auto-generated for no-merge-commit merge:
!35103 merge main_sync_0509 into master

TORCH MAIN SYNC: switch to release candidate of torch 2.12 update

Created-by: chansinging
Commit-by: Chansinging;chansinging
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
同步社区演进,例行更新
lintrunner规避,见[issue](https://gitcode.com/Ascend/pytorch/issues/1865)
# 【修改方案】
出包参考社区改动,pytorch/pytorch#177570

# 【资料变更】
不涉及
# 【接口变更】
不涉及

# 【功能验证】
本地A3服务器和ci流水线已跑通测试
![image.png](https://raw.gitcode.com/user-images/assets/7404318/a7797f8a-f0ad-4dc4-860a-3c1ff2d11f53/image.png 'image.png')

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!35103
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…pytorch#175497) (pytorch#177570) (pytorch#177570)

Summary:

X-link: pytorch/benchmark#2672

similar to sizevars changed, migrating to guarding_hint_or_throw or optimization_hint.

Test Plan: existing tests

Reviewed By: huydhn

Differential Revision: D96046862

Pull Request resolved: pytorch#177570
Approved by: https://github.com/bobrenjc93, https://github.com/huydhn
laithsakka added a commit that referenced this pull request Nov 9, 2026
…_throw

Fixes #201817

ShapeEnv.evaluate_expr on a float-valued expression without an explicit
hint returned the value truncated to int and installed an unsound guard,
e.g. for FloatTrueDiv(1.0, sqrt(ToFloat(s0))) with s0=64 it returned 0 and
guarded Eq(..., 0), which fails on the very inputs it was created from.

Since #177570, compute_concrete_val uses guarding_hint_or_throw, which goes
through _maybe_realize_expr and does int(expr), truncating sympy.Float.

_guarding_hint_or_throw_base now returns a Python float for sympy.Float.
_maybe_realize_expr (shared with the int-only optimization_hint paths) is
unchanged.

Typing:
- Add overloads to the module-level guarding_hint_or_throw so SymBool/bool
  -> bool, SymInt/int -> int, SymNode -> int | bool | float.
- ShapeEnv and Inductor SizeVarAllocator guarding_hint_or_throw /
  guarding_hints_or_throw now return int | float (| bool for ShapeEnv).
- Int-only Inductor call sites (expand's mark_reuse size products and the
  CUTLASS EVT size_hint_fn callback) convert explicitly with int().

Test: python test/test_dynamic_shapes.py -k test_evaluate_expr_float_without_hint
ghstack-source-id: b6bcdc8
Pull-Request: #202324
laithsakka added a commit that referenced this pull request Nov 9, 2026
…_throw

Fixes #201817

ShapeEnv.evaluate_expr on a float-valued expression without an explicit
hint returned the value truncated to int and installed an unsound guard,
e.g. for FloatTrueDiv(1.0, sqrt(ToFloat(s0))) with s0=64 it returned 0 and
guarded Eq(..., 0), which fails on the very inputs it was created from.

Since #177570, compute_concrete_val uses guarding_hint_or_throw, which goes
through _maybe_realize_expr and does int(expr), truncating sympy.Float.

_guarding_hint_or_throw_base now returns a Python float for sympy.Float.
_maybe_realize_expr (shared with the int-only optimization_hint paths) is
unchanged.

Typing:
- Add overloads to the module-level guarding_hint_or_throw so SymBool/bool
  -> bool, SymInt/int -> int, SymNode -> int | bool | float.
- ShapeEnv and Inductor SizeVarAllocator guarding_hint_or_throw /
  guarding_hints_or_throw now return int | float (| bool for ShapeEnv).
- Int-only Inductor call sites (expand's mark_reuse size products and the
  CUTLASS EVT size_hint_fn callback) convert explicitly with int().

Test: python test/test_dynamic_shapes.py -k test_evaluate_expr_float_without_hint
ghstack-source-id: f5cf443
Pull-Request: #202324
pytorchmergebot pushed a commit that referenced this pull request Nov 10, 2026
…_throw (#202324)

Fixes #201817

ShapeEnv.evaluate_expr on a float-valued expression without an explicit
hint returned the value truncated to int and installed an unsound guard,
e.g. for FloatTrueDiv(1.0, sqrt(ToFloat(s0))) with s0=64 it returned 0 and
guarded Eq(..., 0), which fails on the very inputs it was created from.

Since #177570, compute_concrete_val uses guarding_hint_or_throw, which goes
through _maybe_realize_expr and does int(expr), truncating sympy.Float.

_guarding_hint_or_throw_base now returns a Python float for sympy.Float.
_maybe_realize_expr (shared with the int-only optimization_hint paths) is
unchanged.

Pull Request resolved: #202324
Approved by: https://github.com/aorenste
laithsakka added a commit that referenced this pull request Nov 12, 2026
…_throw

Fixes #201817

ShapeEnv.evaluate_expr on a float-valued expression without an explicit
hint returned the value truncated to int and installed an unsound guard,
e.g. for FloatTrueDiv(1.0, sqrt(ToFloat(s0))) with s0=64 it returned 0 and
guarded Eq(..., 0), which fails on the very inputs it was created from.

Since #177570, compute_concrete_val uses guarding_hint_or_throw, which goes
through _maybe_realize_expr and does int(expr), truncating sympy.Float.

_guarding_hint_or_throw_base now returns a Python float for sympy.Float.
_maybe_realize_expr (shared with the int-only optimization_hint paths) is
unchanged.

Typing:
- Add overloads to the module-level guarding_hint_or_throw so SymBool/bool
  -> bool, SymInt/int -> int, SymNode -> int | bool | float.
- ShapeEnv and Inductor SizeVarAllocator guarding_hint_or_throw /
  guarding_hints_or_throw now return int | float (| bool for ShapeEnv).
- Int-only Inductor call sites (expand's mark_reuse size products and the
  CUTLASS EVT size_hint_fn callback) convert explicitly with int().

Test: python test/test_dynamic_shapes.py -k test_evaluate_expr_float_without_hint
ghstack-source-id: f1f992a
Pull-Request: #202324
laithsakka added a commit that referenced this pull request Nov 13, 2026
…_throw

Fixes #201817

ShapeEnv.evaluate_expr on a float-valued expression without an explicit
hint returned the value truncated to int and installed an unsound guard,
e.g. for FloatTrueDiv(1.0, sqrt(ToFloat(s0))) with s0=64 it returned 0 and
guarded Eq(..., 0), which fails on the very inputs it was created from.

Since #177570, compute_concrete_val uses guarding_hint_or_throw, which goes
through _maybe_realize_expr and does int(expr), truncating sympy.Float.

_guarding_hint_or_throw_base now returns a Python float for sympy.Float.
_maybe_realize_expr (shared with the int-only optimization_hint paths) is
unchanged.

Typing:
- Add overloads to the module-level guarding_hint_or_throw so SymBool/bool
  -> bool, SymInt/int -> int, SymNode -> int | bool | float.
- ShapeEnv and Inductor SizeVarAllocator guarding_hint_or_throw /
  guarding_hints_or_throw now return int | float (| bool for ShapeEnv).
- Int-only Inductor call sites (expand's mark_reuse size products and the
  CUTLASS EVT size_hint_fn callback) convert explicitly with int().

Test: python test/test_dynamic_shapes.py -k test_evaluate_expr_float_without_hint
ghstack-source-id: 16a2d62
Pull-Request: #202324
pytorchmergebot pushed a commit that referenced this pull request Nov 13, 2026
…_throw (#202324)

Fixes #201817

ShapeEnv.evaluate_expr on a float-valued expression without an explicit
hint returned the value truncated to int and installed an unsound guard,
e.g. for FloatTrueDiv(1.0, sqrt(ToFloat(s0))) with s0=64 it returned 0 and
guarded Eq(..., 0), which fails on the very inputs it was created from.

Since #177570, compute_concrete_val uses guarding_hint_or_throw, which goes
through _maybe_realize_expr and does int(expr), truncating sympy.Float.

_guarding_hint_or_throw_base now returns a Python float for sympy.Float.
_maybe_realize_expr (shared with the int-only optimization_hint paths) is
unchanged.

Pull Request resolved: #202324
Approved by: https://github.com/aorenste
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged meta-exported module: dynamo module: inductor release notes: fx release notes category suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants