pytorch/torch/csrc/jit/python
Scott Wolchok 2d885ab73d [jit] Reduce refcounting of Types (#65345)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65345

FooType::get() can return a const reference. Inconveniently, converting shared_ptr<FooType> to shared_ptr<Type> requires a copy & refcount bump, so to properly take advantage of this in unshapedType() we need to take a const Type& in isSubtypeOf(), which is good practice anyway -- don't require a shared_ptr if you don't need to take ownership.
ghstack-source-id: 140044165

Test Plan:
CI

perf says c10::unshapedType time decreased from 2.8% to 2.2% during static runtime startup, though I expect this to be generally beneficial.

Reviewed By: hlu1

Differential Revision: D31027361

fbshipit-source-id: 676feb81db9f74ad7b8651d8774f4ecb4cfa6ab8
2021-10-08 09:03:04 -07:00
..
init.cpp Precomputing Transposes for frozen linear layers (#65631) 2021-10-05 20:08:32 -07:00
init.h
module_python.h [JIT] Add reference semantics to TorchScript classes (#44324) 2021-06-30 14:27:17 -07:00
pybind_utils.cpp [jit] Reduce refcounting of Types (#65345) 2021-10-08 09:03:04 -07:00
pybind_utils.h [jit] Reduce refcounting of Types (#65345) 2021-10-08 09:03:04 -07:00
pybind.h irange-ify 11 (#62121) 2021-07-28 13:32:09 -07:00
python_arg_flatten.cpp irange-ify 11 (#62121) 2021-07-28 13:32:09 -07:00
python_arg_flatten.h irange-ify 11 (#62121) 2021-07-28 13:32:09 -07:00
python_custom_class.cpp
python_custom_class.h
python_dict.cpp [JIT] Add torch._C.ScriptDict (#52659) 2021-05-27 10:25:30 -07:00
python_dict.h [JIT] Add torch._C.ScriptDict (#52659) 2021-05-27 10:25:30 -07:00
python_interpreter.cpp [jit] Make operation call accept Stack& instead Stack* (#63414) 2021-08-30 11:49:20 -07:00
python_ir.cpp fix clang-tidy error introduced by #64382 (#65977) 2021-10-05 20:13:13 -07:00
python_ir.h Fix InlinedCallStack annotation to account for module calling its own (#61791) 2021-07-26 15:00:57 -07:00
python_ivalue.h Modernize override (#61744) 2021-07-23 23:04:46 -07:00
python_list.cpp irange-ify 11 (#62121) 2021-07-28 13:32:09 -07:00
python_list.h [JIT] Add torch._C.ScriptList` (#52832) 2021-07-01 20:28:13 -07:00
python_sugared_value.cpp [jit] Reduce refcounting of Types (#65345) 2021-10-08 09:03:04 -07:00
python_sugared_value.h [ROCm] Changes not to rely on CUDA_VERSION or HIP_VERSION (#65610) 2021-09-29 09:55:43 -07:00
python_tracer.cpp irange-ify 11 (#62121) 2021-07-28 13:32:09 -07:00
python_tracer.h
python_tree_views.cpp
python_tree_views.h
script_init.cpp [PyTorch Edge][type] Add type check in compatibility api (#63129) 2021-10-06 02:23:44 -07:00
script_init.h
update_graph_executor_opt.cpp Disable avoid-non-const-global-variables lint check (#62008) 2021-07-22 18:04:40 -07:00
update_graph_executor_opt.h