Support id() on containers and copy.deepcopy tracing (#177484)
Summary:
Allow dynamo to trace through stdlib copy.deepcopy by removing the
copy module from BUILTIN_SKIPLIST and copy.deepcopy from
_builtin_function_ids. Dynamo now inlines the Python implementation
of deepcopy, which works for constant containers (dicts, lists,
tuples). For tensors, __deepcopy__ triggers a graph break since
FakeTensors cannot be deep-copied.
To support id() on ConstDictVariable, ListVariable, TupleVariable,
ConstantVariable, SymNodeVariable, and SetVariable, introduce
FakeIdVariable — a compile-time-only variable that holds id(vt) and
can participate as a dict key but intentionally blocks reconstruction
across graph breaks to prevent silently baking stale ids into resumed
bytecode.
Authored with Claude.
X-link: https://github.com/pytorch/pytorch/pull/177484
Approved by: https://github.com/Skylion007, https://github.com/guilhermeleobas
ghstack dependencies: #177720
Reviewed By: williamwen42
Differential Revision: D97499987
fbshipit-source-id: 1e9d36861f76de410485385f4050ade1ca7924cb