Skip to content

Ensuring caching is disabled on einops from Dynamo #130547

@ezyang

Description

@ezyang

🐛 Describe the bug

It should be permissible to change the behavior of hash(symint) to just cause a specialization. However, this causes previously OK to be dynamic code with einops to stop working, because einops is specifically looking for the TypeError here https://github.com/arogozhnikov/einops/blob/6181e1e95dc58c00a3143c1726da1c6ee0463164/einops/einops.py#L237

Need to figure out how to force uncached behavior here....

Sample stack:

torch/_dynamo/variables/builder.py:1900 in wrap_fx_proxy_cls
torch/_dynamo/utils.py:1815 in get_fake_value
torch/_dynamo/utils.py:1311 in wrap_fake_exception
torch/_dynamo/utils.py:1816 in <lambda>
torch/_dynamo/utils.py:1933 in run_node
einops/einops.py:591 in rearrange
einops/einops.py:523 in reduce
einops/einops.py:234 in _apply_recipe
torch/__init__.py:518 in __hash__
torch/__init__.py:380 in __int__
torch/fx/experimental/sym_node.py:380 in int_
torch/fx/experimental/sym_node.py:386 in guard_int
torch/fx/experimental/recording.py:245 in wrapper
torch/fx/experimental/symbolic_shapes.py:5130 in evaluate_expr
torch/fx/experimental/symbolic_shapes.py:5292 in _evaluate_expr
torch/fx/experimental/symbolic_shapes.py:4935 in _maybe_guard_rel
torch/fx/experimental/symbolic_shapes.py:5479 in _refine_ranges
torch/fx/experimental/symbolic_shapes.py:4850 in _set_replacement
torch/_logging/_internal.py:1085 in trace_structured

Internal xref: https://fb.workplace.com/groups/1075192433118967/posts/1462584834379723/

Versions

main

cc @gchanan @zou3519 @kadeng @msaroufim @chauhang @penguinwu @bobrenjc93 @anijain2305

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions