Skip to content

Commit f321128

Browse files
generatedunixname499836121meta-codesync[bot]
authored andcommitted
Revert "Reapply "[dynamo] Support type inspection on unrealized LazyConstantVariables (#169513)" (#180856)"
Summary: This reverts commit 0dd03562dfd81df775bf7aa4ecc9e83076bf0062. Reverted pytorch/pytorch#180856 on behalf of https://github.com/laithsakka due to no signal ([comment](pytorch/pytorch#180856 (comment))) Reviewed By: wdvr Differential Revision: D102894142 fbshipit-source-id: 696a169e237c0e5e3a1fe40d23f921b60258d0c5
1 parent 8f51225 commit f321128

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

  • userbenchmark/dynamo/dynamobench/_dynamo

userbenchmark/dynamo/dynamobench/_dynamo/utils.py

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

28032803
# Guard and specialize
2804-
if isinstance(arg, LazyVariableTracker):
2805-
if not arg.is_realized():
2806-
# Find if the arg would be realized as SymNodeVariable later on. If yes,
2807-
# realize it and specialize. Else return the arg.
2808-
2809-
source = arg.original_source()
2810-
value = arg.original_value()
2811-
2812-
is_symnode_vt = is_torch_sym(value) or (
2813-
not config.specialize_int
2814-
and type(value) is int
2815-
and not is_int_specialization_case(value, source)
2816-
)
2804+
if isinstance(arg, LazyVariableTracker) and not arg.is_realized():
2805+
# Find if the arg would be realized as SymNodeVariable later on. If yes,
2806+
# realize it and specialize. Else return the arg.
2807+
2808+
source = arg.original_source()
2809+
value = arg.original_value()
28172810

2818-
if not is_symnode_vt:
2819-
return arg
2811+
is_symnode_vt = is_torch_sym(value) or (
2812+
not config.specialize_int
2813+
and type(value) is int
2814+
and not is_int_specialization_case(value, source)
2815+
)
28202816

2821-
# Realize to get the underlying variable (handles both realized and unrealized)
2822-
arg = arg.realize()
2817+
if not is_symnode_vt:
2818+
return arg
28232819

28242820
if isinstance(arg, SymNodeVariable):
28252821
return ConstantVariable.create(arg.evaluate_expr())

0 commit comments

Comments
 (0)