-
Notifications
You must be signed in to change notification settings - Fork 24.4k
[dynamic shapes] guard individual terms in sym_and; user-code-friendly sym_and/sym_or #154737
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: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/154737
Note: Links to docs will display an error until the docs builds have been completed. ❌ 30 New Failures, 6 Cancelled Jobs, 7 Unrelated FailuresAs of commit 3d5cb4f with merge base e895e96 ( NEW FAILURES - The following jobs have failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
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. |
return SymNodeVariable.create( | ||
tx, | ||
torch.fx.experimental.symbolic_shapes.sym_or(*(x.as_proxy() for x in terms)), | ||
sym_num=None, |
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.
not sure if there's a better way to do thiis
test/export/test_export.py
Outdated
@@ -7397,7 +7397,7 @@ def forward(self, xs): | ||
): | ||
ep.module()(torch.tensor([3, 6, 5])) | ||
with self.assertRaisesRegex( | ||
RuntimeError, r".* expression Eq\(u2, 5\) & \(4 <= u1\) & \(u1 <= 8\) .*" | ||
RuntimeError, r".* expression u[\d]+ <= 5 .*" |
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.
because of how the runtime asserts pass inserts range checks for unbacked symbols:
pytorch/torch/fx/passes/runtime_assert.py
Line 615 in 1083bc7
f"Runtime assertion failed for expression {i0 <= max_val} on node '{le}'", |
sym_and
assert.
This seems like a good thing; the ShapeEnv is now processing these bound checks. Could be a nice-to-have in the pass to recognize and deduplicate these.
if len(others) == 0: | ||
return x | ||
for y in others: | ||
assert isinstance(y, (bool, SymBool)) |
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.
because of dynamo, is a Proxy
@@ -6786,12 +6782,18 @@ def _find(self, a: sympy.Symbol) -> sympy.Expr: | ||
return self.replacements[a] | ||
|
||
@lru_cache(256) | ||
def _maybe_guard_rel(self, expr: sympy.Rel) -> None: | ||
def _maybe_guard_rel(self, expr: sympy.Expr) -> None: | ||
""" | ||
The relational guard is guarded to be true. Use this information to |
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 expression?
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
c55871a
to
3d5cb4f
Compare
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Previously when processing
sym_and(a, b, c)
, symbolic shapes wouldn't individually process a, b, and c and store their implications. This would lead us to data-dependent error on individual checks, e.g. we storedu0 >= 0 & u0 <= 10
, but then couldn't figure outu0 <= 10
.This handles that, and also makes
sym_and/or
user-code friendly, for testing.cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv @voznesenskym @penguinwu @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @jiayisunx @chenyang78 @kadeng @chauhang @amjames