@@ -524,13 +524,16 @@ def compute_concrete_val() -> sympy.Basic:
524524
525525 transmute_into_runtime_assert = False
526526
527+ backed_var_to_val = getattr (
528+ self , "backed_var_to_val" , getattr (self , "var_to_val" , {})
529+ )
527530 concrete_val = None
528- if not (expr .free_symbols <= self . var_to_val .keys ()):
531+ if not (expr .free_symbols <= backed_var_to_val .keys ()):
529532 # TODO: dedupe this with _maybe_evaluate_static
530533 # Attempt to eliminate the unbacked SymInt
531534 new_expr = self ._maybe_evaluate_static (expr , unbacked_only = True )
532535 assert new_expr is not None
533- if not (new_expr .free_symbols <= self . var_to_val .keys ()):
536+ if not (new_expr .free_symbols <= backed_var_to_val .keys ()):
534537 ok = False
535538
536539 # fallback_value is set when guard_or_true or guard_or_false are used.
@@ -541,17 +544,15 @@ def compute_concrete_val() -> sympy.Basic:
541544 # oblivious_var_to_val will be defined iff we have sizes
542545 # with DimDynamic.OBLIVIOUS_SIZE type.
543546 # See https://github.com/pytorch/pytorch/issues/137100#issuecomment-2495778113
544- var_to_val = getattr (
545- self ,
546- "unbacked_var_to_val" ,
547- getattr (self , "oblivious_var_to_val" , False ),
548- )
549547 if (
550- var_to_val
551- and not (correct_hint := orig_expr .xreplace (var_to_val )).free_symbols
548+ backed_var_to_val
549+ and getattr (self , "real_tensor_prop_unbacked_vals" , True )
550+ and not (
551+ correct_hint := orig_expr .xreplace (backed_var_to_val )
552+ ).free_symbols
552553 and not (
553554 counterfactual_hint := orig_expr .xreplace (
554- {k : max (2 , v ) for k , v in var_to_val .items ()}
555+ {k : max (2 , v ) for k , v in backed_var_to_val .items ()}
555556 )
556557 ).free_symbols
557558 and correct_hint == counterfactual_hint
@@ -574,10 +575,10 @@ def compute_concrete_val() -> sympy.Basic:
574575 # and if they pass we add a runtime assertions and continue.
575576 if (
576577 not ok
577- and var_to_val
578+ and backed_var_to_val
578579 and not (
579- unsound_result := orig_expr .xreplace (var_to_val ).xreplace (
580- var_to_val
580+ unsound_result := orig_expr .xreplace (backed_var_to_val ).xreplace (
581+ backed_var_to_val
581582 )
582583 ).free_symbols
583584 ):
0 commit comments