Skip to content

Commit eda31bc

Browse files
williamwen42meta-codesync[bot]
authored andcommitted
Revert "Support type inspection on unrealized LazyConstantVariables (#169513)" (#173496)
Summary: Manual revert for pytorch/pytorch#169513 since the auto revert didn't work. This reverts commit a90b73c9b9715aae901afc12ca1955b9b6c80695. X-link: pytorch/pytorch#173496 Approved by: https://github.com/zou3519 Reviewed By: wdvr Differential Revision: D91627940 fbshipit-source-id: 1028c6950a8232c19121d7f8bfe15cc7b60a04d1
1 parent f66bdcd commit eda31bc

File tree

1 file changed

+13
-17
lines changed
  • userbenchmark/dynamo/dynamobench/_dynamo

1 file changed

+13
-17
lines changed

userbenchmark/dynamo/dynamobench/_dynamo/utils.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,25 +2616,21 @@ def specialize_symnode(arg: Any) -> Any:
26162616
from .variables import ConstantVariable, LazyVariableTracker, SymNodeVariable
26172617

26182618
# Guard and specialize
2619-
if isinstance(arg, LazyVariableTracker):
2620-
if not arg.is_realized():
2621-
# Find if the arg would be realized as SymNodeVariable later on. If yes,
2622-
# realize it and specialize. Else return the arg.
2623-
2624-
source = arg.original_source()
2625-
value = arg.original_value()
2626-
2627-
is_symnode_vt = is_torch_sym(value) or (
2628-
not config.specialize_int
2629-
and type(value) is int
2630-
and not is_int_specialization_case(value, source)
2631-
)
2619+
if isinstance(arg, LazyVariableTracker) and not arg.is_realized():
2620+
# Find if the arg would be realized as SymNodeVariable later on. If yes,
2621+
# realize it and specialize. Else return the arg.
2622+
2623+
source = arg.original_source()
2624+
value = arg.original_value()
26322625

2633-
if not is_symnode_vt:
2634-
return arg
2626+
is_symnode_vt = is_torch_sym(value) or (
2627+
not config.specialize_int
2628+
and type(value) is int
2629+
and not is_int_specialization_case(value, source)
2630+
)
26352631

2636-
# Realize to get the underlying variable (handles both realized and unrealized)
2637-
arg = arg.realize()
2632+
if not is_symnode_vt:
2633+
return arg
26382634

26392635
if isinstance(arg, SymNodeVariable):
26402636
return ConstantVariable.create(arg.evaluate_expr())

0 commit comments

Comments
 (0)