benchmark
0b457d4e - support min, max in maybe mark dynamic (#194091)

Commit
63 days ago
support min, max in maybe mark dynamic (#194091) Summary: internal ref for why its needed https://fb.workplace.com/groups/1075192433118967/permalink/2031263990845135/ Adds `min` / `max` kwargs to `torch._dynamo.maybe_mark_dynamic`, so a dim can be marked dynamic *and* given an initial range without enforcing that the dim stays dynamic: ```python torch._dynamo.maybe_mark_dynamic(x, 0, min=2, max=5) ``` The range is a starting point: guards may narrow it ([2, 5] + a x.shape[0] < 5 guard compiles with (2, 4)), and the dim may still specialize instead of raising, unlike mark_dynamic. A hint outside the declared range is still an error (ConstraintViolationError: 6 not in range [2, 5]) — the range is never widened to fit the input. Bugs fixed along the way - min or max alone crashed with AssertionError: not simple sympy type NoneType (ValueRanges rejects None). The missing bound now defaults to 2 / int_oo, the bounds a backed size already has. This also fixes mark_dynamic(x, 0, min=2). - A dim made dynamic by AOTAutograd's _dynamo_propagated_dynamic_indices, on a tensor carrying a range for another dim, raised IndexError: pop from empty list. - changing min/max between calls now recompiles rather than reusing the cached graph, and partial ranges no longer crash. - Marking one dim with both mark_dynamic and maybe_mark_dynamic now raises; different dims of the same tensor may still use different APIs. X-link: https://github.com/pytorch/pytorch/pull/194091 Approved by: https://github.com/bobrenjc93 Reviewed By: jeanschmidt Differential Revision: D117045746 fbshipit-source-id: 59160953c9c8d1bb6b3877f94af6216f53396bf4
Author
Committer
Parents
Loading