Revert "Fix refine_ranges corner case (#164075)"

This reverts commit 27234792add2ee9bedd84ca02dbf34f8f244bc5c.

Reverted https://github.com/pytorch/pytorch/pull/164075 on behalf of https://github.com/izaitsevfb due to fails executorch builds, see [D83938444](https://www.internalfb.com/diff/D83938444) ([comment](https://github.com/pytorch/pytorch/pull/164075#issuecomment-3374430964))
This commit is contained in:
PyTorch MergeBot
2025-10-06 22:09:39 +00:00
parent cfc5cc17dc
commit 3912ba3e94
5 changed files with 11 additions and 19 deletions

View File

@ -1 +1 @@
deb42f2a8e48f5032b4a98ee781a15fa87a157cf
e0dda9059d082537cee36be6c5e4fe3b18c880c0

View File

@ -6827,10 +6827,13 @@ utils_device.CURRENT_DEVICE == None""".split("\n"):
self.assertTrue(guard_failure is not None)
first_guard_failure = guard_failure[0].partition("\n")[0]
self.assertIn(
"""tensor 'x' size mismatch at index 0. expected 2, actual 5""",
first_guard_failure,
)
if torch._dynamo.config.assume_static_by_default:
self.assertIn(
"""tensor 'x' size mismatch at index 0. expected 2, actual 5""",
first_guard_failure,
)
else:
self.assertIn("""x.size()[0] < 3""", first_guard_failure)
def test_guard_failure_fn2(self):
def fn(x, y):

View File

@ -4040,17 +4040,6 @@ def forward(self, arg0_1: "i64[2][1]cpu", arg1_1: "Sym(u2)", arg2_1: "Sym(u3)",
self.assertEqual(compiled_func2(x, zero), func2(x, zero))
self.assertEqual(cnt.frame_count, 2)
@torch._dynamo.config.patch("capture_scalar_outputs", True)
def test_unbacked_select_2(self):
class M(torch.nn.Module):
def forward(self, x):
nz = x.nonzero()
return nz[-1]
mod = M()
x = torch.randn(4)
self.assertEqual(torch.compile(mod)(x), mod(x))
@torch._dynamo.config.patch("capture_scalar_outputs", True)
def test_unbacked_select_index_with_check(self):
def func3(x, y):

View File

@ -1858,7 +1858,7 @@ L['a'].size()[1] > L['a'].size()[0]
show_guards(tensor),
"""\
L['a'].size()[1] < L['a'].size()[0]
3 <= L['a'].size()[0] and L['a'].size()[0] <= 19
L['a'].size()[0] <= 19
L['a'].size()[1] <= 18""")
def test_sym_storage_offset(self):

View File

@ -7835,13 +7835,13 @@ class ShapeEnv:
# sympy.Eq may update both lower and upper bounds.
# sympy.G{t,e} may update the lower bound, only.
# sympy.L{t,e} may update the upper bound, only.
if lower <= rhs_vr.lower and isinstance(
if lower < rhs_vr.lower and isinstance(
r_expr, (sympy.Eq, sympy.Ge, sympy.Gt)
):
# Strictly greater relations allow us to refine a bit more, since
# x < y implies that the lower bound for x is: y + 1.
lower = rhs_vr.lower + int(isinstance(r_expr, sympy.Gt))
if upper >= rhs_vr.upper and isinstance(
if upper > rhs_vr.upper and isinstance(
r_expr, (sympy.Eq, sympy.Le, sympy.Lt)
):
upper = rhs_vr.upper - int(isinstance(r_expr, sympy.Lt))