pytorch/torch/csrc/jit/runtime
Behrang Javaherian 386776c49a [torch] Reduce the memory usage by adding flags to clearing intermediate graphs used for optimization during the ineference. (#115657)
Summary: During the inference time the intermediate graphs for optimization are not used so the Executor's graph is the only graph we need to keep around these two flags

Test Plan:
the FLAGS are all off by default

baseline
```
buck run mode/opt-clang  sigrid/predictor/client/localnet:run_model -- --model_id_to_load=951679039 --model_snapshot_to_load=244 --torch_jit_do_not_store_optimized_graph=true
I1212 10:24:20.407408 401092 SigridPredictorLocalModelFactory.cpp:32] Memory usage for 951679039_244 is 182863 Kb
```
```
buck run mode/opt-clang  sigrid/predictor/client/localnet:run_model -- --model_id_to_load=951679039 --model_snapshot_to_load=244 --torch_jit_do_not_store_optimized_graph=true --torch_jit_release_profiling_graph_after_optimization=true
I1212 10:31:37.663487 464000 SigridPredictorLocalModelFactory.cpp:32] Memory usage for 951679039_244 is 186127 Kb
```
```
buck run mode/opt-clang  sigrid/predictor/client/localnet:run_model -- --model_id_to_load=951679039 --model_snapshot_to_load=244 --torch_jit_do_not_store_optimized_graph=true --torch_jit_release_profiling_graph_after_optimization=true --torch_jit_execution_plan_avoid_extra_graph_copy=true
I1212 10:29:42.848093 447218 SigridPredictorLocalModelFactory.cpp:32] Memory usage for 951679039_244 is 129451 Kb```

Differential Revision: D52081631

Pull Request resolved: https://github.com/pytorch/pytorch/pull/115657
Approved by: https://github.com/houseroad
2023-12-18 17:56:39 +00:00
..
interpreter
static [1/N] Use std::in_place (#115170) 2023-12-09 03:52:39 +00:00
argument_spec.cpp
argument_spec.h [Reland] [1/N] Fixes clang-tidy warnings in header files (#114668) 2023-11-29 07:11:51 +00:00
autodiff.cpp [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
autodiff.h [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
calculate_necessary_args.h
custom_operator.h
decomposition_registry_util.cpp
decomposition_registry_util.h
decomposition_registry.cpp
decomposition_registry.h
exception_message.h
graph_executor_impl.h
graph_executor.cpp [torch] Reduce the memory usage by adding flags to clearing intermediate graphs used for optimization during the ineference. (#115657) 2023-12-18 17:56:39 +00:00
graph_executor.h [torch] Reduce the memory usage by adding flags to clearing intermediate graphs used for optimization during the ineference. (#115657) 2023-12-18 17:56:39 +00:00
graph_iterator.h
instruction.cpp
instruction.h
interpreter.cpp [torch] Reduce the memory usage by adding flags to clearing intermediate graphs used for optimization during the ineference. (#115657) 2023-12-18 17:56:39 +00:00
interpreter.h [torch] Reduce the memory usage by adding flags to clearing intermediate graphs used for optimization during the ineference. (#115657) 2023-12-18 17:56:39 +00:00
jit_exception.cpp
jit_exception.h
jit_trace.cpp
jit_trace.h
logging.cpp
logging.h
operator_options.h
operator.cpp [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
operator.h
print_handler.cpp
print_handler.h
profiling_graph_executor_impl.cpp [torch] Reduce the memory usage by adding flags to clearing intermediate graphs used for optimization during the ineference. (#115657) 2023-12-18 17:56:39 +00:00
profiling_graph_executor_impl.h [torch] Reduce the memory usage by adding flags to clearing intermediate graphs used for optimization during the ineference. (#115657) 2023-12-18 17:56:39 +00:00
profiling_record.cpp [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
profiling_record.h
register_c10_ops.cpp [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
register_cuda_ops.cpp
register_distributed_ops.cpp
register_ops_utils.cpp Add support for torch.Generator type in TorchScript (#110413) 2023-11-21 23:07:21 +00:00
register_ops_utils.h Add support for torch.Generator type in TorchScript (#110413) 2023-11-21 23:07:21 +00:00
register_prim_ops_fulljit.cpp
register_prim_ops.cpp Add support for torch.Generator type in TorchScript (#110413) 2023-11-21 23:07:21 +00:00
register_special_ops.cpp Add support for torch.Generator type in TorchScript (#110413) 2023-11-21 23:07:21 +00:00
script_profile.cpp
script_profile.h
serialized_shape_function_registry.cpp
serialized_shape_function_registry.h
shape_function_registry.h
simple_graph_executor_impl.cpp [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
simple_graph_executor_impl.h
slice_indices_adjust.cpp
slice_indices_adjust.h
symbolic_script.cpp
symbolic_script.h
symbolic_shape_registry_util.cpp
symbolic_shape_registry_util.h
symbolic_shape_registry.cpp
symbolic_shape_registry.h
vararg_functions.cpp [BE] Do not use AT_ERROR (#114883) 2023-12-01 13:44:17 +00:00
vararg_functions.h
variable_tensor_list.h