[dynamo] refactor CacheEntry and ExtraState to eval_frame.c to C++ (#118438)

Part of implementing CacheEntry invalidation to fix https://github.com/pytorch/pytorch/issues/112090.

Changes:
- Move CacheEntry and ExtraState to C++
- Use pybind to control reference counting
- Use std::list instead of manually implementing a linked list

Pull Request resolved: https://github.com/pytorch/pytorch/pull/118438
Approved by: https://github.com/jansel
This commit is contained in:
William Wen
2024-02-05 23:39:22 -08:00
committed by PyTorch MergeBot
parent 73f0fdea5b
commit ae4e866bba
13 changed files with 507 additions and 457 deletions

View File

@ -807,9 +807,11 @@ libtorch_python_core_sources = [
"torch/csrc/autograd/python_variable.cpp",
"torch/csrc/autograd/python_variable_indexing.cpp",
"torch/csrc/dynamo/python_compiled_autograd.cpp",
"torch/csrc/dynamo/cache_entry.cpp",
"torch/csrc/dynamo/cpp_shim.cpp",
"torch/csrc/dynamo/cpython_defs.c",
"torch/csrc/dynamo/eval_frame.c",
"torch/csrc/dynamo/extra_state.cpp",
"torch/csrc/dynamo/guards.cpp",
"torch/csrc/dynamo/init.cpp",
"torch/csrc/functorch/init.cpp",