[jit] do the code reorg (#33851)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/33851

Rationale and context described in #33828.

Script to reproduce the move:
https://gist.github.com/suo/16cbefaaeb67ca5a7c6caffd49b7f6e9
ghstack-source-id: 99079645

Test Plan: Make sure CI passes

Reviewed By: jamesr66a

Differential Revision: D20133869

fbshipit-source-id: 390e9241a9c85366d9005c492ac31f10aa96488e
This commit is contained in:
Michael Suo
2020-02-27 12:18:24 -08:00
committed by Facebook Github Bot
parent afbd04449e
commit dbe850af5b
385 changed files with 998 additions and 993 deletions

View File

@ -349,34 +349,34 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
${TORCH_SRC_DIR}/csrc/autograd/record_function_ops.cpp
${TORCH_SRC_DIR}/csrc/autograd/saved_variable.cpp
${TORCH_SRC_DIR}/csrc/autograd/variable.cpp
${TORCH_SRC_DIR}/csrc/jit/autodiff.cpp
${TORCH_SRC_DIR}/csrc/jit/attributes.cpp
${TORCH_SRC_DIR}/csrc/jit/argument_spec.cpp
${TORCH_SRC_DIR}/csrc/jit/custom_class.cpp
${TORCH_SRC_DIR}/csrc/jit/pass_manager.cpp
${TORCH_SRC_DIR}/csrc/jit/pickler.cpp
${TORCH_SRC_DIR}/csrc/jit/unpickler.cpp
${TORCH_SRC_DIR}/csrc/jit/graph_executor.cpp
${TORCH_SRC_DIR}/csrc/jit/import_source.cpp
${TORCH_SRC_DIR}/csrc/jit/import.cpp
${TORCH_SRC_DIR}/csrc/jit/pickle.cpp
${TORCH_SRC_DIR}/csrc/jit/import_export_helpers.cpp
${TORCH_SRC_DIR}/csrc/jit/instruction.cpp
${TORCH_SRC_DIR}/csrc/jit/interpreter.cpp
${TORCH_SRC_DIR}/csrc/jit/constants.cpp
${TORCH_SRC_DIR}/csrc/jit/node_hashing.cpp
${TORCH_SRC_DIR}/csrc/jit/type_hashing.cpp
${TORCH_SRC_DIR}/csrc/jit/ir.cpp
${TORCH_SRC_DIR}/csrc/jit/irparser.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/autodiff.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/attributes.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/argument_spec.cpp
${TORCH_SRC_DIR}/csrc/jit/api/custom_class.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/pass_manager.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/pickler.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/unpickler.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/graph_executor.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/import_source.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/import.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/pickle.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/import_export_helpers.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/instruction.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/interpreter.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/constants.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/node_hashing.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/type_hashing.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/ir.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/irparser.cpp
${TORCH_SRC_DIR}/csrc/jit/jit_log.cpp
${TORCH_SRC_DIR}/csrc/jit/operator.cpp
${TORCH_SRC_DIR}/csrc/jit/register_c10_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/subgraph_matcher.cpp
${TORCH_SRC_DIR}/csrc/jit/symbolic_script.cpp
${TORCH_SRC_DIR}/csrc/jit/profiling_record.cpp
${TORCH_SRC_DIR}/csrc/jit/profiling_graph_executor_impl.cpp
${TORCH_SRC_DIR}/csrc/jit/update_graph_executor_opt.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/alias_analysis.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/operator.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/register_c10_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/subgraph_matcher.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/symbolic_script.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/profiling_record.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/profiling_graph_executor_impl.cpp
${TORCH_SRC_DIR}/csrc/jit/python/update_graph_executor_opt.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/alias_analysis.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/batch_mm.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/bailout_graph.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/canonicalize.cpp
@ -412,49 +412,49 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
${TORCH_SRC_DIR}/csrc/jit/passes/specialize_autogradzero.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/subgraph_rewrite.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/tensorexpr_fuser.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/python_print.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/python_print.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/utils/subgraph_utils.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/utils/check_alias_annotation.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/utils/memory_dag.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/quantization.cpp
${TORCH_SRC_DIR}/csrc/jit/passes/fuse_linear.cpp
${TORCH_SRC_DIR}/csrc/jit/print_handler.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/interface.cpp
${TORCH_SRC_DIR}/csrc/jit/register_prim_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/register_prim_ops_c10.cpp
${TORCH_SRC_DIR}/csrc/jit/register_string_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/register_special_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/scope.cpp
${TORCH_SRC_DIR}/csrc/jit/script/ir_emitter.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/print_handler.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/interface.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/register_prim_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/register_prim_ops_c10.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/register_string_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/register_special_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/scope.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/ir_emitter.cpp
${TORCH_SRC_DIR}/csrc/jit/testing/file_check.cpp
${TORCH_SRC_DIR}/csrc/jit/script/convert_to_ssa.cpp
${TORCH_SRC_DIR}/csrc/jit/script/exit_transforms.cpp
${TORCH_SRC_DIR}/csrc/jit/script/inline_loop_condition.cpp
${TORCH_SRC_DIR}/csrc/jit/script/schema_matching.cpp
${TORCH_SRC_DIR}/csrc/jit/script/script_type_parser.cpp
${TORCH_SRC_DIR}/csrc/jit/script/sugared_value.cpp
${TORCH_SRC_DIR}/csrc/jit/script/class_type.cpp
${TORCH_SRC_DIR}/csrc/jit/script/parser.cpp
${TORCH_SRC_DIR}/csrc/jit/script/builtin_functions.cpp
${TORCH_SRC_DIR}/csrc/jit/script/canonicalize_modified_loop.cpp
${TORCH_SRC_DIR}/csrc/jit/script/edit_distance.cpp
${TORCH_SRC_DIR}/csrc/jit/script/logging.cpp
${TORCH_SRC_DIR}/csrc/jit/script/module.cpp
${TORCH_SRC_DIR}/csrc/jit/script/object.cpp
${TORCH_SRC_DIR}/csrc/jit/script/jit_exception.cpp
${TORCH_SRC_DIR}/csrc/jit/script/string_to_type.cpp
${TORCH_SRC_DIR}/csrc/jit/source_range_serialization.cpp
${TORCH_SRC_DIR}/csrc/jit/tracer.cpp
${TORCH_SRC_DIR}/csrc/jit/hooks_for_testing.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/convert_to_ssa.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/exit_transforms.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/inline_loop_condition.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/schema_matching.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/script_type_parser.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/sugared_value.cpp
${TORCH_SRC_DIR}/csrc/jit/ir/class_type.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/parser.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/builtin_functions.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/canonicalize_modified_loop.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/edit_distance.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/logging.cpp
${TORCH_SRC_DIR}/csrc/jit/api/module.cpp
${TORCH_SRC_DIR}/csrc/jit/api/object.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/jit_exception.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/string_to_type.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/source_range_serialization.cpp
${TORCH_SRC_DIR}/csrc/jit/frontend/tracer.cpp
${TORCH_SRC_DIR}/csrc/jit/testing/hooks_for_testing.cpp
${TORCH_SRC_DIR}/csrc/utils/tensor_flatten.cpp
${TORCH_SRC_DIR}/csrc/utils/variadic.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/kernel_cache.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/compiler.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/executor.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/codegen.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/fallback.cpp
${TORCH_SRC_DIR}/csrc/jit/function.cpp
${TORCH_SRC_DIR}/csrc/jit/vararg_functions.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/kernel_cache.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/compiler.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/executor.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/codegen.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/fallback.cpp
${TORCH_SRC_DIR}/csrc/jit/api/function.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/vararg_functions.cpp
${TORCH_SRC_DIR}/csrc/jit/tensorexpr/mem_arena.cpp
${TORCH_SRC_DIR}/csrc/jit/tensorexpr/codegen.cpp
@ -489,12 +489,12 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
if (NOT INTERN_BUILD_MOBILE)
list(APPEND TORCH_SRCS
${TORCH_SRC_DIR}/csrc/api/src/jit.cpp
${TORCH_SRC_DIR}/csrc/jit/export.cpp
${TORCH_SRC_DIR}/csrc/jit/export_module.cpp
${TORCH_SRC_DIR}/csrc/jit/import_legacy.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/export.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/export_module.cpp
${TORCH_SRC_DIR}/csrc/jit/serialization/import_legacy.cpp
${TORCH_SRC_DIR}/csrc/jit/netdef_converter.cpp
${TORCH_SRC_DIR}/csrc/jit/fuser/cpu/fused_kernel.cpp
${TORCH_SRC_DIR}/csrc/jit/script/module_save.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/cpu/fused_kernel.cpp
${TORCH_SRC_DIR}/csrc/jit/api/module_save.cpp
${TORCH_SRC_DIR}/csrc/utils/byte_order.cpp
)
if (USE_DISTRIBUTED)
@ -526,14 +526,14 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
${TORCH_SRC_DIR}/csrc/distributed/rpc/script_resp.cpp
${TORCH_SRC_DIR}/csrc/distributed/rpc/types.cpp
${TORCH_SRC_DIR}/csrc/distributed/rpc/utils.cpp
${TORCH_SRC_DIR}/csrc/jit/register_distributed_ops.cpp
${TORCH_SRC_DIR}/csrc/jit/runtime/register_distributed_ops.cpp
)
endif()
endif()
if (USE_CUDA)
list(APPEND Caffe2_GPU_SRCS
${TORCH_SRC_DIR}/csrc/jit/fuser/cuda/fused_kernel.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp
${TORCH_SRC_DIR}/csrc/autograd/profiler_cuda.cpp
${TORCH_SRC_DIR}/csrc/autograd/functions/comm.cpp
${TORCH_SRC_DIR}/csrc/cuda/comm.cpp
@ -550,7 +550,7 @@ if (NOT INTERN_BUILD_MOBILE OR NOT BUILD_CAFFE2_MOBILE)
if (USE_ROCM)
list(APPEND Caffe2_HIP_SRCS
${TORCH_SRC_DIR}/csrc/jit/fuser/cuda/fused_kernel.cpp
${TORCH_SRC_DIR}/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp
${TORCH_SRC_DIR}/csrc/autograd/profiler_cuda.cpp
${TORCH_SRC_DIR}/csrc/autograd/functions/comm.cpp
${TORCH_SRC_DIR}/csrc/cuda/comm.cpp
@ -864,8 +864,8 @@ if(USE_ROCM)
USE_ROCM
__HIP_PLATFORM_HCC__
)
# NB: Massive hack. torch/csrc/jit/fuser/codegen.cpp includes
# torch/csrc/jit/fuser/cuda/resource_strings.h which changes the
# NB: Massive hack. torch/csrc/jit/codegen/fuser/codegen.cpp includes
# torch/csrc/jit/codegen/fuser/cuda/resource_strings.h which changes the
# strings depending on if you're __HIP_PLATFORM_HCC__ or not.
# But that file is in torch_cpu! So, against all odds, this macro
# has to be set on torch_cpu too. I also added it to torch for