From b7bb53ff732c818b012cfc1ea0d3341714579f4c Mon Sep 17 00:00:00 2001 From: zhoufeng Date: Fri, 4 Mar 2022 16:40:06 +0800 Subject: [PATCH] build libmindspore_backend.so Signed-off-by: zhoufeng --- cmake/package.cmake | 2 +- cmake/package_mac.cmake | 2 +- cmake/package_tar.cmake | 2 +- cmake/package_win.cmake | 2 +- mindspore/ccsrc/CMakeLists.txt | 133 +++++++++++------ .../optimizer/common_backend_optimization.cc | 2 +- .../common/optimizer/const_input_to_attr.h | 3 +- .../ccsrc/backend/common/optimizer/helper.h | 5 +- .../backend/common/optimizer/optimizer.h | 5 +- .../backend/common/optimizer/pass_manager.cc | 2 +- .../backend/common/optimizer/pass_manager.h | 3 +- .../pass/common_subexpression_elimination.h | 2 +- .../backend/common/session/CMakeLists.txt | 1 + .../common/session/anf_runtime_algorithm.cc | 36 +++++ .../common/session/anf_runtime_algorithm.h | 3 +- .../common/session/ascend_auto_monad.cc | 2 +- .../backend/common/session/ascend_session.cc | 8 +- .../backend/common/session/cpu_session.cc | 5 +- .../ccsrc/backend/common/session/executor.h | 3 +- .../common/session/executor_manager.cc | 5 + .../backend/common/session/executor_manager.h | 9 +- .../backend/common/session/gpu_session.cc | 7 +- .../backend/common/session/kernel_graph.h | 3 +- .../backend/common/session/session_basic.cc | 8 +- .../backend/common/session/session_basic.h | 7 +- .../backend/common/session/session_factory.h | 4 +- mindspore/ccsrc/backend/common/somas/somas.cc | 4 +- .../backend/common/somas/somas_solver_pre.cc | 2 +- .../ccsrc/backend/graph_compiler/backend.cc | 4 +- .../ccsrc/backend/graph_compiler/backend.h | 7 +- .../backend/graph_compiler/graph_partition.h | 7 +- .../ccsrc/backend/graph_compiler/transform.cc | 4 +- .../ccsrc/backend/graph_compiler/transform.h | 15 +- mindspore/ccsrc/backend/graph_compiler/vm.cc | 6 +- mindspore/ccsrc/backend/graph_compiler/vm.h | 3 +- mindspore/ccsrc/common/CMakeLists.txt | 2 + .../{pybind_api => common}/api_register.cc | 4 +- mindspore/ccsrc/common/debug/CMakeLists.txt | 4 + .../{ => common}/debug/anf_dump_utils.cc | 30 +++- .../ccsrc/{ => common}/debug/anf_ir_dump.cc | 69 ++------- mindspore/ccsrc/{ => common}/debug/common.cc | 11 +- mindspore/ccsrc/{ => common}/debug/draw.cc | 54 ++----- .../ccsrc/{ => common}/debug/dump_proto.cc | 21 +-- .../{ => common}/debug/env_config_parser.cc | 10 +- .../{ => common}/debug/rdr/base_recorder.cc | 35 ++++- .../debug/rdr/recorder_manager.cc | 20 ++- .../adapter/graph_kernel_pass_manager.cc | 2 +- .../common/graph_kernel/add_atomic_clean.cc | 2 +- .../lite_adapter/graph_kernel_pass_manager.cc | 2 +- .../ccsrc/common/graph_kernel/reorder_ops.cc | 2 +- .../graph_kernel/transform_op_optimizer.cc | 2 +- mindspore/ccsrc/cxx_api/CMakeLists.txt | 16 +- .../cxx_api/graph/ascend/ascend_graph_impl.cc | 51 ++++++- .../ccsrc/cxx_api/model/acl/acl_vm/acl_vm.cc | 2 +- mindspore/ccsrc/debug/CMakeLists.txt | 22 ++- .../ccsrc/debug/data_dump/cpu_e2e_dump.cc | 5 +- .../ccsrc/debug/data_dump/dump_json_parser.cc | 4 +- .../ccsrc/debug/data_dump/dump_json_parser.h | 17 ++- mindspore/ccsrc/debug/data_dump/dump_utils.cc | 4 +- mindspore/ccsrc/debug/data_dump/e2e_dump.cc | 4 +- mindspore/ccsrc/debug/data_dump/e2e_dump.h | 3 +- .../ccsrc/debug/data_dump/tensor_stat_dump.cc | 2 +- .../ccsrc/debug/data_dump/tensor_stat_dump.h | 3 - mindspore/ccsrc/debug/debug_services.cc | 5 +- mindspore/ccsrc/debug/debugger/debugger.cc | 18 +-- mindspore/ccsrc/debug/debugger/debugger.h | 7 +- .../ccsrc/debug/debugger/debugger_utils.cc | 2 +- .../ccsrc/debug/debugger/proto_exporter.cc | 4 +- .../ccsrc/debug/debugger/proto_exporter.h | 2 +- .../debug/rdr/graph_exec_order_recorder.cc | 17 ++- .../debug/rdr/graph_exec_order_recorder.h | 7 +- mindspore/ccsrc/debug/rdr/graph_recorder.cc | 32 ++-- mindspore/ccsrc/debug/rdr/graph_recorder.h | 8 +- .../ccsrc/debug/rdr/mem_address_recorder.cc | 46 ++++++ .../ccsrc/debug/rdr/mem_address_recorder.h | 9 +- .../ccsrc/debug/rdr/running_data_recorder.cc | 140 ------------------ .../ccsrc/debug/rdr/running_data_recorder.h | 64 -------- .../debug/rdr/stream_exec_order_recorder.cc | 14 ++ .../debug/rdr/stream_exec_order_recorder.h | 5 +- mindspore/ccsrc/debug/rdr/string_recorder.cc | 15 +- mindspore/ccsrc/debug/rdr/string_recorder.h | 5 +- .../debug/rdr/task_debug_info_recorder.cc | 16 ++ .../debug/rdr/task_debug_info_recorder.h | 6 +- .../distributed/cluster/cluster_context.cc | 2 +- .../distributed/cluster/cluster_context.h | 3 +- .../collective/collective_manager.h | 3 +- mindspore/ccsrc/distributed/init.h | 3 +- .../ccsrc/fl/server/iteration_metrics.cc | 2 +- mindspore/ccsrc/fl/server/server.cc | 5 + mindspore/ccsrc/fl/server/server.h | 8 +- mindspore/ccsrc/fl/server/server_recovery.cc | 2 +- mindspore/ccsrc/fl/worker/fl_worker.cc | 5 + mindspore/ccsrc/fl/worker/fl_worker.h | 8 +- .../frontend/operator/composite/composite.cc | 4 +- .../operator/composite/do_signature.cc | 2 +- .../composite/list_append_operation.cc | 2 +- .../composite/list_insert_operation.cc | 2 +- .../ccsrc/frontend/operator/composite/map.cc | 4 +- .../operator/composite/multitype_funcgraph.cc | 4 +- .../operator/composite/unpack_call.cc | 2 +- .../ccsrc/frontend/operator/composite/vmap.cc | 2 +- .../operator/composite/zip_operation.cc | 2 +- .../ccsrc/frontend/optimizer/ad/dfunctor.cc | 2 +- .../ccsrc/frontend/optimizer/ad/dfunctor.h | 2 +- .../ccsrc/frontend/optimizer/ad/kprim.cc | 6 +- .../ccsrc/frontend/optimizer/ad/kpynative.cc | 4 +- mindspore/ccsrc/frontend/optimizer/clean.cc | 2 +- mindspore/ccsrc/frontend/optimizer/cse_pass.h | 2 +- .../ccsrc/frontend/optimizer/optimizer.h | 8 +- mindspore/ccsrc/frontend/optimizer/pattern.cc | 2 +- mindspore/ccsrc/frontend/optimizer/py_pass.h | 2 +- .../parallel/graph_util/graph_info.cc | 6 +- .../parallel/graph_util/graph_splitter.cc | 2 +- .../parallel/ops_info/operator_info.cc | 57 +++++++ .../parallel_strategy_checkpoint.cc | 2 +- .../backend/visible.h} | 25 ++-- .../include/common/debug/anf_dump_utils.h | 43 ++++++ .../{ => include/common}/debug/anf_ir_dump.h | 26 ++-- .../ccsrc/{ => include/common}/debug/common.h | 15 +- .../ccsrc/{ => include/common}/debug/draw.h | 10 +- .../{ => include/common}/debug/dump_proto.h | 16 +- .../common}/debug/env_config_parser.h | 16 +- .../common}/debug/rdr/base_recorder.h | 40 ++--- .../common}/debug/rdr/recorder_manager.h | 23 +-- .../common}/pybind_api/api_register.h | 9 +- .../optimizer => include/common/utils}/cse.h | 11 +- .../common/utils}/philox_generator.h | 46 ++++-- .../include/common/utils/python_adapter.h | 9 ++ mindspore/ccsrc/include/common/visible.h | 17 +++ .../kernel/akg/akg_kernel_json_decoder.cc | 2 +- mindspore/ccsrc/kernel/common_utils.cc | 2 +- mindspore/ccsrc/kernel/kernel_build_info.cc | 7 +- mindspore/ccsrc/kernel/oplib/oplib.h | 3 +- .../minddata/dataset/engine/CMakeLists.txt | 12 ++ .../dataset/engine/cache/CMakeLists.txt | 3 - .../dataset/engine/cache/cache_admin.cc | 1 - .../dataset/engine/cache/cache_main.cc | 93 ++++++------ .../dataset/engine/cache/perf/CMakeLists.txt | 2 - .../dataset/engine/cache/perf/cache_perf.cc | 1 - .../engine/cache/perf/cache_pipeline.cc | 1 - .../engine/datasetops/device_queue_op.h | 1 - .../engine/datasetops/source/conll2000_op.cc | 2 +- .../engine/datasetops/source/dbpedia_op.cc | 2 +- .../engine/datasetops/source/emnist_op.cc | 2 +- .../engine/datasetops/source/iwslt_op.h | 2 +- .../engine/datasetops/source/kitti_op.cc | 2 +- .../engine/datasetops/source/multi30k_op.cc | 2 +- .../datasetops/source/penn_treebank_op.cc | 2 +- .../engine/datasetops/source/photo_tour_op.cc | 2 +- .../engine/datasetops/source/places365_op.cc | 2 +- .../engine/datasetops/source/qmnist_op.cc | 2 +- .../engine/datasetops/source/sogou_news_op.cc | 2 +- .../engine/datasetops/source/stl10_op.cc | 2 +- .../engine/datasetops/source/wiki_text_op.cc | 2 +- .../datasetops/source/yahoo_answers_op.cc | 2 +- .../datasetops/source/yelp_review_op.cc | 2 +- .../ir/datasetops/source/iwslt2016_node.cc | 2 +- .../ir/datasetops/source/iwslt2017_node.cc | 2 +- .../ccsrc/minddata/mindrecord/CMakeLists.txt | 3 - mindspore/ccsrc/pipeline/jit/CMakeLists.txt | 4 + .../pipeline/jit/compile_cache_manager.cc | 6 +- .../{ => pipeline/jit}/debug/anf_ir_utils.cc | 29 ++-- .../{ => pipeline/jit}/debug/anf_ir_utils.h | 8 +- .../ccsrc/{ => pipeline/jit}/debug/trace.cc | 6 +- .../ccsrc/{ => pipeline/jit}/debug/trace.h | 4 +- mindspore/ccsrc/pipeline/jit/init.cc | 2 +- .../pipeline/jit/parse/data_converter.cc | 5 + .../pipeline/jit/parse/function_block.cc | 2 +- mindspore/ccsrc/pipeline/jit/parse/parse.cc | 2 +- mindspore/ccsrc/pipeline/jit/parse/resolve.cc | 34 +++++ mindspore/ccsrc/pipeline/jit/pipeline.cc | 28 ++-- mindspore/ccsrc/pipeline/jit/pipeline.h | 9 -- mindspore/ccsrc/pipeline/jit/pipeline_ge.cc | 4 +- .../pipeline/jit/remove_value_node_dup.cc | 2 +- mindspore/ccsrc/pipeline/jit/resource.cc | 2 +- .../jit/static_analysis/async_eval_result.cc | 4 +- .../pipeline/jit/static_analysis/evaluator.cc | 2 +- .../jit/static_analysis/program_specialize.cc | 2 +- .../jit/static_analysis/stack_frame.cc | 2 +- .../jit/static_analysis/static_analysis.cc | 4 +- mindspore/ccsrc/pipeline/jit/validator.cc | 2 +- .../pipeline/pynative/pynative_execute.cc | 6 +- .../hal/device/ascend_kernel_runtime.cc | 6 +- .../hal/device/ascend_launch_atomic_clean.cc | 2 +- .../ascend/hal/device/ascend_stream_assign.cc | 2 +- .../hal/device/distribute/ascend_collective.h | 4 +- .../hal/device/ge_runtime/runtime_model.cc | 2 +- .../ascend/hal/device/kernel_select_ascend.cc | 2 +- .../hal/device/tasksink/task_generator.cc | 2 +- .../hal/hardware/ascend_device_context.cc | 7 +- .../hal/hardware/ascend_graph_optimization.cc | 4 +- .../ascend/kernel/tbe/tbe_kernel_compile.cc | 2 +- .../device/ascend/kernel/tbe/tbe_utils.cc | 2 +- .../optimizer/ascend_backend_optimization.cc | 10 +- ...batchmatmul_dropoutdomaskv3_fusion_pass.cc | 2 +- .../bnupdate_eltwise_eltwise_fusion_pass.cc | 2 +- .../conv_single_in_fusion_pass.cc | 2 +- .../matmul_dropoutdomaskv3_add_fusion_pass.cc | 2 +- .../reduce_eltwise_fusion_pass.cc | 2 +- .../buffer_fusion/ub_pattern_fusion.cc | 2 +- .../add_placeholder_for_dynamic_rnn.h | 2 +- .../optimizer/ir_fission/transdata_split.cc | 2 +- .../ir_fusion/transposed_update_fusion.cc | 2 +- .../cpu/hal/device/cpu_kernel_runtime.cc | 5 +- .../cpu/kernel/akg/akg_cpu_kernel_mod.cc | 2 +- .../cpu/kernel/apply_momentum_cpu_kernel.h | 2 +- .../plugin/device/cpu/kernel/cpu_kernel.h | 3 +- .../cpu/kernel/embedding_look_up_cpu_kernel.h | 2 +- .../cpu/kernel/pyfunc/py_func_cpu_kernel.cc | 4 +- .../cpu/kernel/sparse_apply_adam_cpu_kernel.h | 2 +- .../cpu/kernel/sparse_apply_ftrl_cpu_kernel.h | 2 +- .../sparse_apply_lazy_adam_cpu_kernel.h | 2 +- .../distribution/collective_fake_init.h | 5 +- .../hal/device/distribution/collective_init.h | 3 +- .../gpu/hal/device/gpu_device_address.cc | 2 +- .../gpu/hal/device/gpu_kernel_runtime.cc | 5 +- .../gpu/hal/hardware/gpu_device_context.cc | 3 +- .../kernel/data/dataset_iterator_kernel.cc | 2 +- .../optimizer/trt_pass/graph_partitioner.cc | 2 +- .../device/ascend/ascend_profiling.cc | 2 +- .../ccsrc/profiler/device/ascend/options.cc | 2 +- .../ascend/parallel_strategy_profiling.cc | 35 +++-- .../ascend/parallel_strategy_profiling.h | 3 +- .../device/ascend/pynative_profiling.cc | 2 +- .../profiler/device/cpu/cpu_profiling.cc | 2 +- .../profiler/device/gpu/gpu_profiling.cc | 2 +- mindspore/ccsrc/profiler/device/profiling.cc | 2 +- mindspore/ccsrc/ps/core/abstract_node.h | 3 +- mindspore/ccsrc/ps/core/file_configuration.h | 3 +- mindspore/ccsrc/ps/core/node.h | 3 +- mindspore/ccsrc/ps/core/ps_scheduler_node.h | 3 +- mindspore/ccsrc/ps/core/ps_worker_node.h | 3 +- mindspore/ccsrc/ps/core/scheduler_node.h | 3 +- mindspore/ccsrc/ps/core/worker_node.h | 3 +- mindspore/ccsrc/ps/parameter_server.cc | 5 + mindspore/ccsrc/ps/parameter_server.h | 9 +- .../ccsrc/ps/ps_cache/ps_cache_manager.cc | 5 + .../ccsrc/ps/ps_cache/ps_cache_manager.h | 8 +- mindspore/ccsrc/ps/ps_context.h | 3 +- mindspore/ccsrc/ps/scheduler.cc | 5 + mindspore/ccsrc/ps/scheduler.h | 8 +- mindspore/ccsrc/ps/util.h | 3 +- mindspore/ccsrc/ps/worker.cc | 5 + mindspore/ccsrc/ps/worker.h | 8 +- mindspore/ccsrc/pybind_api/ir/anf_py.cc | 2 +- mindspore/ccsrc/pybind_api/ir/cell_py.cc | 2 +- mindspore/ccsrc/pybind_api/ir/dtype_py.cc | 2 +- .../ccsrc/pybind_api/ir/func_graph_py.cc | 2 +- .../ccsrc/pybind_api/ir/param_info_py.cc | 2 +- mindspore/ccsrc/pybind_api/ir/primitive_py.cc | 13 +- mindspore/ccsrc/pybind_api/ir/signature_py.cc | 2 +- mindspore/ccsrc/pybind_api/ir/tensor_py.cc | 8 +- mindspore/ccsrc/pybind_api/ir/value_py.cc | 2 +- .../random_normal/random_cpu_kernel.h | 32 +--- .../ccsrc/pybind_api/utils/ms_context_py.cc | 2 +- .../ccsrc/pybind_api/utils/security_py.cc | 2 +- .../ccsrc/runtime/device/context_extends.h | 23 +-- .../ccsrc/runtime/device/kernel_runtime.cc | 2 +- .../ccsrc/runtime/device/kernel_runtime.h | 5 +- .../runtime/device/kernel_runtime_manager.h | 4 +- .../ccsrc/runtime/device/memory_manager.cc | 4 +- .../runtime/device/ms_device_shape_transfer.h | 5 +- .../graph_scheduler/actor/recorder_actor.cc | 4 +- .../runtime/graph_scheduler/graph_compiler.cc | 5 +- .../graph_scheduler/graph_scheduler.cc | 10 +- .../runtime/graph_scheduler/graph_scheduler.h | 8 +- .../hardware/device_context_manager.cc | 5 + .../runtime/hardware/device_context_manager.h | 9 +- .../ccsrc/runtime/pynative/op_executor.h | 3 +- .../ccsrc/runtime/recovery/recovery_context.h | 14 +- .../transform/express_ir/mindir_exporter.cc | 4 +- .../{frontend/optimizer => utils}/cse.cc | 2 +- .../philox_generator.cc | 14 +- mindspore/core/utils/log_adapter.cc | 8 +- mindspore/core/utils/system/file_system.h | 2 +- mindspore/lite/tools/converter/CMakeLists.txt | 2 + tests/ut/cpp/CMakeLists.txt | 21 ++- tests/ut/cpp/common/backend_common_test.cc | 2 +- tests/ut/cpp/ir/clone_test.cc | 2 +- tests/ut/cpp/ir/manager_test.cc | 2 +- tests/ut/cpp/operator/composite_test.cc | 2 +- .../cpp/operator/grad_implementations_test.cc | 2 +- tests/ut/cpp/optimizer/ad/ad_test.cc | 2 +- tests/ut/cpp/optimizer/ad/kpynative_test.cc | 2 +- tests/ut/cpp/optimizer/cconv_test.cc | 2 +- tests/ut/cpp/optimizer/clean_test.cc | 2 +- tests/ut/cpp/optimizer/lib_test.cc | 2 +- tests/ut/cpp/optimizer/opt_test.cc | 4 +- tests/ut/cpp/optimizer/optimizer_test.cc | 2 +- tests/ut/cpp/parallel/step_parallel_test.cc | 2 +- .../pipeline/parse/parser_abnormal_test.cc | 2 +- .../cpp/pipeline/parse/parser_class_test.cc | 2 +- .../pipeline/parse/parser_integrate_test.cc | 2 +- .../pipeline/parse/parser_primitive_test.cc | 2 +- tests/ut/cpp/pipeline/parse/parser_test.cc | 2 +- tests/ut/cpp/pipeline/parse/resolve_test.cc | 2 +- .../static_analysis/evaluator_test.cc | 2 +- .../cpp/pipeline/static_analysis/prim_test.cc | 2 +- .../static_analysis/specialize_test.cc | 2 +- .../static_analysis/static_analysis_test.cc | 2 +- .../buffer_fusion/buffer_fusion_test.cc | 2 +- .../dynamic_shape/dynamic_shape_pass_test.cc | 4 +- .../getnext_tensor_move_elimination_test.cc | 2 +- .../insert_tensor_move_for_getnext_test.cc | 2 +- .../insert_tensor_move_for_hccl_op_test.cc | 2 +- .../format_type/check_consistency_test.cc | 2 +- .../ascend/format_type/insert_cast_test.cc | 2 +- .../format_type/insert_trans_op_test.cc | 2 +- .../format_type/merge_cast_to_op_test.cc | 2 +- .../remove_internal_output_test.cc | 2 +- .../ascend/ir_fission/bn_grad_split_test.cc | 2 +- .../ascend/ir_fission/bn_split_test.cc | 2 +- .../ir_fission/layer_norm_grad_split_test.cc | 2 +- .../ir_fission/reduce_min_fission_test.cc | 2 +- .../single_batch_norm_fission_test.cc | 2 +- .../tensor_scatter_update_fission_test.cc | 2 +- .../ascend/ir_fission/topk_split_test.cc | 2 +- .../ascend/ir_fission/transdata_split_test.cc | 2 +- .../unsorted_segment_sum_fission_test.cc | 2 +- .../ir_fusion/adam_apply_one_fusion_test.cc | 2 +- .../adam_apply_one_with_decay_rule_test.cc | 2 +- .../ir_fusion/batchnorm_to_bninfer_test.cc | 2 +- .../batchnormgrad_to_bninfergrad_test.cc | 2 +- ...p_by_norm_no_div_square_sum_fusion_test.cc | 2 +- .../ir_fusion/clip_by_value_fusion_test.cc | 2 +- .../confusion_mul_grad_fusion_test.cc | 2 +- .../ir_fusion/confusion_softmax_grad_test.cc | 2 +- .../ascend/ir_fusion/derelu_fusion_test.cc | 2 +- .../ir_fusion/lamb_next_mv_rule_test.cc | 2 +- .../lamb_next_mv_with_decay_rule_test.cc | 2 +- .../lamb_update_with_lr_rule_fusion_test.cc | 2 +- .../ir_fusion/lamb_update_with_lr_v2_test.cc | 2 +- ...er_norm_beta_gamma_backprop_fusion_test.cc | 2 +- .../ascend/ir_fusion/mul_add_fusion_test.cc | 2 +- .../ascend/ir_fusion/mul_addn_fusion_test.cc | 2 +- .../reshape_transpose_fusion_test.cc | 2 +- .../ir_fusion/softmax_grad_ext_fusion_test.cc | 2 +- .../ir_fusion/square_sum_fusion_test.cc | 2 +- .../transpose_reshape_fusion_test.cc | 2 +- .../mindir/all_to_all_unify_mindir_test.cc | 2 +- .../pass/allreduce_fusion_test.cc | 2 +- .../common_subexpression_elimination_test.cc | 2 +- .../pass/convert_const_input_to_attr_test.cc | 2 +- ...onvert_const_input_to_tensor_input_test.cc | 2 +- ...nvert_tuple_input_to_dynamic_input_test.cc | 2 +- .../convert_tuple_output_to_maketuple_test.cc | 2 +- .../pass/eliminate_redundant_op_test.cc | 2 +- .../pre_activate/pass/getitem_tuple_test.cc | 2 +- tests/ut/cpp/stub/anf_ir/dump_proto_stub.cc | 2 +- tests/ut/cpp/tbe/tbe_json_creator_test.cc | 2 +- tests/ut/cpp/utils/callback_test.cc | 2 +- tests/ut/cpp/utils/ir_import_test.cc | 2 +- tests/ut/cpp/vm/segment_runner_test.cc | 2 +- 353 files changed, 1456 insertions(+), 1107 deletions(-) rename mindspore/ccsrc/{pybind_api => common}/api_register.cc (88%) create mode 100644 mindspore/ccsrc/common/debug/CMakeLists.txt rename mindspore/ccsrc/{ => common}/debug/anf_dump_utils.cc (74%) rename mindspore/ccsrc/{ => common}/debug/anf_ir_dump.cc (93%) rename mindspore/ccsrc/{ => common}/debug/common.cc (97%) rename mindspore/ccsrc/{ => common}/debug/draw.cc (91%) rename mindspore/ccsrc/{ => common}/debug/dump_proto.cc (97%) rename mindspore/ccsrc/{ => common}/debug/env_config_parser.cc (97%) rename mindspore/ccsrc/{ => common}/debug/rdr/base_recorder.cc (56%) rename mindspore/ccsrc/{ => common}/debug/rdr/recorder_manager.cc (87%) delete mode 100644 mindspore/ccsrc/debug/rdr/running_data_recorder.cc delete mode 100644 mindspore/ccsrc/debug/rdr/running_data_recorder.h rename mindspore/ccsrc/{debug/anf_dump_utils.h => include/backend/visible.h} (54%) create mode 100644 mindspore/ccsrc/include/common/debug/anf_dump_utils.h rename mindspore/ccsrc/{ => include/common}/debug/anf_ir_dump.h (58%) rename mindspore/ccsrc/{ => include/common}/debug/common.h (88%) rename mindspore/ccsrc/{ => include/common}/debug/draw.h (90%) rename mindspore/ccsrc/{ => include/common}/debug/dump_proto.h (66%) rename mindspore/ccsrc/{ => include/common}/debug/env_config_parser.h (88%) rename mindspore/ccsrc/{ => include/common}/debug/rdr/base_recorder.h (56%) rename mindspore/ccsrc/{ => include/common}/debug/rdr/recorder_manager.h (82%) rename mindspore/ccsrc/{ => include/common}/pybind_api/api_register.h (86%) rename mindspore/ccsrc/{frontend/optimizer => include/common/utils}/cse.h (84%) rename mindspore/ccsrc/{pybind_api/random_normal => include/common/utils}/philox_generator.h (51%) rename mindspore/ccsrc/{ => pipeline/jit}/debug/anf_ir_utils.cc (97%) rename mindspore/ccsrc/{ => pipeline/jit}/debug/anf_ir_utils.h (96%) rename mindspore/ccsrc/{ => pipeline/jit}/debug/trace.cc (99%) rename mindspore/ccsrc/{ => pipeline/jit}/debug/trace.h (95%) rename mindspore/ccsrc/{frontend/optimizer => utils}/cse.cc (99%) rename mindspore/ccsrc/{pybind_api/random_normal => utils}/philox_generator.cc (84%) diff --git a/cmake/package.cmake b/cmake/package.cmake index 68784f927aa..38e74425fa0 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -90,7 +90,7 @@ install( ) install( - TARGETS mindspore_core mindspore_common + TARGETS mindspore_core mindspore_common mindspore_backend DESTINATION ${INSTALL_LIB_DIR} COMPONENT mindspore ) diff --git a/cmake/package_mac.cmake b/cmake/package_mac.cmake index 4440c66ce87..51afe235b65 100644 --- a/cmake/package_mac.cmake +++ b/cmake/package_mac.cmake @@ -67,7 +67,7 @@ install( ) install( - TARGETS mindspore_core mindspore_common + TARGETS mindspore_core mindspore_common mindspore_backend DESTINATION ${INSTALL_LIB_DIR} COMPONENT mindspore ) diff --git a/cmake/package_tar.cmake b/cmake/package_tar.cmake index 87754fc96d3..a447c8de349 100644 --- a/cmake/package_tar.cmake +++ b/cmake/package_tar.cmake @@ -27,7 +27,7 @@ install( ) install( - TARGETS mindspore_core mindspore_common + TARGETS mindspore_core mindspore_common mindspore_backend DESTINATION ${INSTALL_LIB_DIR} COMPONENT mindspore ) diff --git a/cmake/package_win.cmake b/cmake/package_win.cmake index 1a7486fec2e..980a50e1ea6 100644 --- a/cmake/package_win.cmake +++ b/cmake/package_win.cmake @@ -74,7 +74,7 @@ install( ) install( - TARGETS mindspore_core mindspore_common + TARGETS mindspore_core mindspore_common mindspore_backend DESTINATION ${INSTALL_LIB_DIR} COMPONENT mindspore ) diff --git a/mindspore/ccsrc/CMakeLists.txt b/mindspore/ccsrc/CMakeLists.txt index 528f4a485d1..e85323c0236 100644 --- a/mindspore/ccsrc/CMakeLists.txt +++ b/mindspore/ccsrc/CMakeLists.txt @@ -244,35 +244,7 @@ set(SUB_COMP frontend/operator pipeline/jit pipeline/pynative - debug pybind_api - profiler ps fl distributed - kernel - common/mem_reuse - backend/common/optimizer - backend/common/pass - backend/common/session - backend/common/somas - common/graph_kernel - backend/graph_compiler - runtime/collective - runtime/device - runtime/graph_scheduler - runtime/hardware - runtime/recovery - runtime/pynative - plugin/device/ascend/hal/device - plugin/device/ascend/hal/hardware - plugin/device/ascend/hal/hccl_adapter - plugin/device/ascend/kernel - plugin/device/ascend/optimizer - plugin/device/cpu/hal/device - plugin/device/cpu/hal/hardware - plugin/device/cpu/kernel - plugin/device/cpu/optimizer - plugin/device/gpu/hal/device - plugin/device/gpu/hal/hardware - plugin/device/gpu/kernel - plugin/device/gpu/optimizer + pybind_api ) foreach(_comp ${SUB_COMP}) @@ -287,10 +259,12 @@ endforeach() set_property(SOURCE ${SUB_OBJECTS_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_ME) add_library(mindspore STATIC ${SUB_OBJECTS_SRC}) +add_subdirectory(debug) set(COMMON_SUB_COMP transform/graph_ir utils common + common/debug ) foreach(_comp ${COMMON_SUB_COMP}) @@ -327,6 +301,90 @@ if(NOT WIN32) target_link_libraries(mindspore PUBLIC dl) endif() +set(BACKEND_SUB_COMP + profiler + ps + fl + distributed + kernel + common/mem_reuse + backend/common/optimizer + backend/common/pass + backend/common/session + backend/common/somas + common/graph_kernel + backend/graph_compiler + runtime/collective + runtime/device + runtime/graph_scheduler + runtime/hardware + runtime/pynative + runtime/recovery + plugin/device/ascend/hal/device + plugin/device/ascend/hal/hardware + plugin/device/ascend/hal/hccl_adapter + plugin/device/ascend/kernel + plugin/device/ascend/optimizer + plugin/device/cpu/hal/device + plugin/device/cpu/hal/hardware + plugin/device/cpu/kernel + plugin/device/cpu/optimizer + plugin/device/gpu/hal/device + plugin/device/gpu/hal/hardware + plugin/device/gpu/kernel + plugin/device/gpu/optimizer + ) + +foreach(_comp ${BACKEND_SUB_COMP}) + add_subdirectory(${_comp}) + string(REPLACE "/" "_" sub ${_comp}) + if(TARGET _mindspore_${sub}_obj) + list(APPEND BACKEND_SUB_OBJECTS_SRC $) + add_dependencies(_mindspore_${sub}_obj proto_input) + if(CMAKE_SYSTEM_NAME MATCHES "Windows") + target_compile_definitions(_mindspore_${sub}_obj PRIVATE BACKEND_DLL) + endif() + endif() +endforeach() + +set_property(SOURCE ${BACKEND_SUB_OBJECTS_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_ME) +add_library(mindspore_backend SHARED ${BACKEND_SUB_OBJECTS_SRC}) +if(MODE_ASCEND_ACL) + add_library(mindspore_backend_static STATIC ${BACKEND_SUB_OBJECTS_SRC}) +endif() +if(CMAKE_SYSTEM_NAME MATCHES "Windows") + target_link_libraries(mindspore_backend PRIVATE mindspore::pybind11_module mindspore_debug) +else() + target_link_libraries(mindspore_backend PRIVATE mindspore_debug) +endif() +target_link_libraries(mindspore_backend PRIVATE mindspore_core mindspore_common proto_input mindspore::protobuf) +target_link_libraries(mindspore_backend PRIVATE securec) +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + set_target_properties(mindspore_backend PROPERTIES MACOSX_RPATH ON) + set_target_properties(mindspore_backend PROPERTIES INSTALL_RPATH @loader_path) +else() + set_target_properties(mindspore_backend PROPERTIES INSTALL_RPATH $ORIGIN) +endif() +if(ENABLE_CPU AND NOT WIN32) + target_link_libraries(mindspore_backend PRIVATE ps_cache) +endif() +if(ENABLE_CPU) + target_link_libraries(mindspore_backend PRIVATE mindspore::dnnl mindspore::mkldnn nnacl) +endif() +if(ENABLE_GPU) + message("add gpu lib to mindspore_backend") + target_link_libraries(mindspore_backend PRIVATE gpu_cuda_lib gpu_queue cublas cuda_ops + ${CUDA_PATH}/lib64/libcurand.so + ${CUDNN_LIBRARY_PATH} + ${CUDA_PATH}/lib64/libcudart.so + ${CUDA_PATH}/lib64/stubs/libcuda.so + ${CUDA_PATH}/lib64/libcusolver.so + ${CUDA_PATH}/lib64/libcufft.so) + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(mindspore_backend PRIVATE mindspore::crypto mindspore::ssl) + endif() +endif() + if(MODE_ASCEND_ALL OR MODE_ASCEND_ACL) # common env paths if(DEFINED ENV{D_LINK_PATH}) @@ -386,7 +444,7 @@ if(MODE_ASCEND_ALL) find_library(OPT_FEATURE opt_feature ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH} ${ASCEND_RUNTIME_NEW_PATH} ${ASCEND_TOOLKIT_RUNTIME_NEW_PATH}) - target_link_libraries(mindspore PUBLIC ${RUNTIME_LIB} ${TSDCLIENT} ${DATATRANSFER} ${ERROR_MANAGER} + target_link_libraries(mindspore_backend PUBLIC ${RUNTIME_LIB} ${TSDCLIENT} ${DATATRANSFER} ${ERROR_MANAGER} -Wl,--no-as-needed ${OPTILING} ${PLATFORM} ${ACL} ${ACL_TDT_CHANNEL} ${OPT_FEATURE} ${PROFILING}) target_link_libraries(mindspore PUBLIC -Wl,--start-group proto_input mindspore::protobuf -Wl,--end-group) elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") @@ -437,13 +495,13 @@ set_target_properties(_c_expression PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH}) if(CMAKE_SYSTEM_NAME MATCHES "Windows") target_link_libraries(mindspore PUBLIC mindspore::pybind11_module) target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore -Wl,--no-whole-archive mindspore_core - mindspore_common) + mindspore_common mindspore_backend) elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") target_link_libraries(mindspore PUBLIC proto_input mindspore::protobuf mindspore::event mindspore::event_pthreads mindspore::event_openssl mindspore::eigen mindspore::json) target_link_libraries(mindspore PUBLIC mindspore::event_core ps_cache) target_link_libraries(_c_expression PRIVATE -Wl,-all_load mindspore proto_input -Wl,-noall_load mindspore_core - mindspore_common) + mindspore_common mindspore_backend) target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module) else() if(ENABLE_CPU AND NOT WIN32) @@ -455,7 +513,7 @@ else() endif() endif() target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore proto_input -Wl,--no-whole-archive - mindspore_core mindspore_common) + mindspore_core mindspore_common mindspore_backend) target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module) endif() @@ -468,14 +526,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") endif() if(ENABLE_GPU) - message("add gpu lib to c_expression") - target_link_libraries(_c_expression PRIVATE gpu_cuda_lib gpu_queue cublas cuda_ops - ${CUDA_PATH}/lib64/libcurand.so - ${CUDNN_LIBRARY_PATH} - ${CUDA_PATH}/lib64/libcudart.so - ${CUDA_PATH}/lib64/stubs/libcuda.so - ${CUDA_PATH}/lib64/libcusolver.so - ${CUDA_PATH}/lib64/libcufft.so) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") target_link_libraries(_c_expression PRIVATE mindspore::crypto mindspore::ssl) endif() @@ -514,4 +564,3 @@ if(ENABLE_D) endif() add_subdirectory(cxx_api) -# include(${CMAKE_CURRENT_SOURCE_DIR}/sharedlib.cmake) diff --git a/mindspore/ccsrc/backend/common/optimizer/common_backend_optimization.cc b/mindspore/ccsrc/backend/common/optimizer/common_backend_optimization.cc index 17ec1e50eb3..deb1724b217 100644 --- a/mindspore/ccsrc/backend/common/optimizer/common_backend_optimization.cc +++ b/mindspore/ccsrc/backend/common/optimizer/common_backend_optimization.cc @@ -35,7 +35,7 @@ #include "backend/common/pass/sparse_process.h" #include "backend/common/pass/insert_assign_for_custom_op.h" #include "utils/ms_context.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/mindspore/ccsrc/backend/common/optimizer/const_input_to_attr.h b/mindspore/ccsrc/backend/common/optimizer/const_input_to_attr.h index 202535c68ac..08c66b18d40 100644 --- a/mindspore/ccsrc/backend/common/optimizer/const_input_to_attr.h +++ b/mindspore/ccsrc/backend/common/optimizer/const_input_to_attr.h @@ -21,6 +21,7 @@ #include "utils/hash_map.h" #include "utils/hash_set.h" #include "utils/ms_utils.h" +#include "include/backend/visible.h" namespace mindspore { namespace opt { @@ -47,7 +48,7 @@ class ConstInputToAttrInfoRegister { mindspore::HashSet input_attr_set_; }; -class ConstInputToAttrInfoRegistry { +class BACKEND_EXPORT ConstInputToAttrInfoRegistry { public: static ConstInputToAttrInfoRegistry &Instance(); void Register(const ConstInputToAttrInfoRegister ®); diff --git a/mindspore/ccsrc/backend/common/optimizer/helper.h b/mindspore/ccsrc/backend/common/optimizer/helper.h index 945fe36a281..96820c7e63b 100644 --- a/mindspore/ccsrc/backend/common/optimizer/helper.h +++ b/mindspore/ccsrc/backend/common/optimizer/helper.h @@ -26,6 +26,7 @@ #include "backend/common/session/kernel_graph.h" #include "utils/ms_utils.h" #include "backend/common/optimizer/pattern_engine.h" +#include "include/backend/visible.h" namespace mindspore { namespace opt { @@ -170,7 +171,7 @@ void CreateMultipleOutputsOfAnfNode(const FuncGraphPtr &kernel_graph, const AnfN tensor::TensorPtr CreateTensorWithValueTuple(const ValueTuplePtr &value_tuple_ptr, const TypePtr &type_ptr, size_t data_length); -tensor::TensorPtr CreateTupleTensor(const ValueTuplePtr &value_tuple); +BACKEND_EXPORT tensor::TensorPtr CreateTupleTensor(const ValueTuplePtr &value_tuple); bool IsAllNopNode(const session::KernelGraph *const graph); @@ -238,7 +239,7 @@ std::vector GetNodeOutputUsedNum(const session::KernelGraph &kernel_gra int64_t GetNodeOutputTotalUsedNum(const session::KernelGraph &kernel_graph, const AnfNodePtr &node); // Get custom operator attr input indexes -void GetCustomOpAttrIndex(const PrimitivePtr &primitive, mindspore::HashSet *indexes); +BACKEND_EXPORT void GetCustomOpAttrIndex(const PrimitivePtr &primitive, mindspore::HashSet *indexes); } // namespace opt } // namespace mindspore #endif // MINDSPORE_CCSRC_BACKEND_OPTIMIZER_COMMON_HELPER_H_ diff --git a/mindspore/ccsrc/backend/common/optimizer/optimizer.h b/mindspore/ccsrc/backend/common/optimizer/optimizer.h index 28eb7fd335f..a72413245f2 100644 --- a/mindspore/ccsrc/backend/common/optimizer/optimizer.h +++ b/mindspore/ccsrc/backend/common/optimizer/optimizer.h @@ -29,12 +29,13 @@ #include "ir/graph_utils.h" #include "utils/ms_utils.h" #include "backend/common/optimizer/helper.h" +#include "include/backend/visible.h" namespace mindspore { namespace opt { using PatternListType = std::initializer_list; -class PatternProcessPass : public NodePass { +class BACKEND_EXPORT PatternProcessPass : public NodePass { public: explicit PatternProcessPass(const std::string &name = "", bool multigraph = true); ~PatternProcessPass() override = default; @@ -77,7 +78,7 @@ class MultipleOutputPatternProcessPass : public PatternProcessPass { EquivPtr child_equiv_; }; -class GraphOptimizer { +class BACKEND_EXPORT GraphOptimizer { public: explicit GraphOptimizer(const std::string &name = "graph_optimizer") : name_(name) {} virtual ~GraphOptimizer() = default; diff --git a/mindspore/ccsrc/backend/common/optimizer/pass_manager.cc b/mindspore/ccsrc/backend/common/optimizer/pass_manager.cc index e9bc34f85c0..a75f6ab0369 100644 --- a/mindspore/ccsrc/backend/common/optimizer/pass_manager.cc +++ b/mindspore/ccsrc/backend/common/optimizer/pass_manager.cc @@ -21,7 +21,7 @@ #include "ir/anf.h" #include "ir/manager.h" #include "utils/ms_context.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/anfalgo.h" namespace mindspore { diff --git a/mindspore/ccsrc/backend/common/optimizer/pass_manager.h b/mindspore/ccsrc/backend/common/optimizer/pass_manager.h index d731b79cdec..395232c1f84 100644 --- a/mindspore/ccsrc/backend/common/optimizer/pass_manager.h +++ b/mindspore/ccsrc/backend/common/optimizer/pass_manager.h @@ -24,6 +24,7 @@ #include "backend/common/optimizer/pass.h" #include "backend/common/optimizer/node_pass.h" +#include "include/backend/visible.h" namespace mindspore { namespace opt { @@ -41,7 +42,7 @@ class CacheManager { }; // @brief For optimization passes management -class PassManager { +class BACKEND_EXPORT PassManager { public: explicit PassManager(const std::string &name = "pm", bool run_only_once = true) : name_(name), passes_{}, run_only_once_(run_only_once), cache_manager_(std::make_shared()) {} diff --git a/mindspore/ccsrc/backend/common/pass/common_subexpression_elimination.h b/mindspore/ccsrc/backend/common/pass/common_subexpression_elimination.h index a51bcca4aa0..63aaa0fd27b 100644 --- a/mindspore/ccsrc/backend/common/pass/common_subexpression_elimination.h +++ b/mindspore/ccsrc/backend/common/pass/common_subexpression_elimination.h @@ -17,7 +17,7 @@ #define MINDSPORE_CCSRC_BACKEND_OPTIMIZER_PASS_COMMON_SUBEXPRESSION_ELIMINATION_H_ #include #include "backend/common/optimizer/pass.h" -#include "frontend/optimizer/cse.h" +#include "include/common/utils/cse.h" namespace mindspore { namespace opt { diff --git a/mindspore/ccsrc/backend/common/session/CMakeLists.txt b/mindspore/ccsrc/backend/common/session/CMakeLists.txt index 98c92bed90e..2b10868f740 100644 --- a/mindspore/ccsrc/backend/common/session/CMakeLists.txt +++ b/mindspore/ccsrc/backend/common/session/CMakeLists.txt @@ -6,6 +6,7 @@ file(GLOB_RECURSE _SESSION_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "executor.cc" "executor_manager.cc" "anf_runtime_algorithm.cc" + "debug_register.cc" "single_kernel_graph.cc" ) diff --git a/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.cc b/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.cc index 5f379373c80..06e6aff3a64 100644 --- a/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.cc +++ b/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.cc @@ -26,6 +26,7 @@ #include "include/common/utils/utils.h" #include "include/common/utils/parallel_context.h" #include "include/common/utils/anfalgo.h" +#include "include/common/debug/anf_dump_utils.h" #include "runtime/device/kernel_info.h" #include "runtime/device/device_address.h" #include "backend/common/optimizer/helper.h" @@ -83,6 +84,41 @@ static std::map, std::mapname(), {{{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 0}}, {{1, 0}, {2, 1}, {3, 2}, {4, 3}, {0, 4}}}}}; + +std::string PrintKernelFormatAndType(const std::string &fmt, const TypeId &type, const std::vector &shape) { + std::ostringstream buffer; + buffer << "<" << TypeToShortString(type); + if (!fmt.empty()) { + buffer << "x" << fmt << shape; + } + buffer << ">"; + return buffer.str(); +} + +struct AnfDumpHandlerRegister { + AnfDumpHandlerRegister() { + AnfDumpHandler::SetPrintInputTypeShapeFormatHandler( + [](const std::shared_ptr &node, size_t idx) -> std::string { + if (node == nullptr) { + return ""; + } + auto format = AnfAlgo::GetInputFormat(node, idx); + auto type = AnfAlgo::GetInputDeviceDataType(node, idx); + auto shape = AnfAlgo::GetInputDeviceShape(node, idx); + return PrintKernelFormatAndType(format, type, shape); + }); + AnfDumpHandler::SetPrintOutputTypeShapeFormatHandler( + [](const std::shared_ptr &node, size_t idx) -> std::string { + if (node == nullptr) { + return ""; + } + auto format = AnfAlgo::GetOutputFormat(node, idx); + auto type = AnfAlgo::GetOutputDeviceDataType(node, idx); + auto shape = AnfAlgo::GetOutputDeviceShape(node, idx); + return PrintKernelFormatAndType(format, type, shape); + }); + } +} callback_register; } // namespace AnfNodePtr AnfRuntimeAlgorithm::MakeMonadValueNode(const KernelGraphPtr &kg) { diff --git a/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.h b/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.h index c32d3ff66d8..6d126473ace 100644 --- a/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.h +++ b/mindspore/ccsrc/backend/common/session/anf_runtime_algorithm.h @@ -37,6 +37,7 @@ #include "include/common/utils/contract.h" #include "utils/anf_utils.h" #include "backend/common/session/kernel_graph.h" +#include "include/backend/visible.h" namespace mindspore { namespace session { @@ -45,7 +46,7 @@ using DeviceAddressPtr = device::DeviceAddressPtr; using Address = kernel::Address; using AddressPtr = kernel::AddressPtr; -class AnfRuntimeAlgorithm { +class BACKEND_EXPORT AnfRuntimeAlgorithm { public: static AnfNodePtr MakeMonadValueNode(const KernelGraphPtr &kg); static void KeepOrder(const KernelGraphPtr &kg, const AnfNodePtr &former, const AnfNodePtr &latter); diff --git a/mindspore/ccsrc/backend/common/session/ascend_auto_monad.cc b/mindspore/ccsrc/backend/common/session/ascend_auto_monad.cc index b3c7a108c0a..cb4238ba152 100644 --- a/mindspore/ccsrc/backend/common/session/ascend_auto_monad.cc +++ b/mindspore/ccsrc/backend/common/session/ascend_auto_monad.cc @@ -28,7 +28,7 @@ #include "utils/ms_context.h" #include "utils/ordered_map.h" #include "base/core_ops.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "pipeline/jit/base.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" diff --git a/mindspore/ccsrc/backend/common/session/ascend_session.cc b/mindspore/ccsrc/backend/common/session/ascend_session.cc index c7ed76f28e4..932738bd80a 100644 --- a/mindspore/ccsrc/backend/common/session/ascend_session.cc +++ b/mindspore/ccsrc/backend/common/session/ascend_session.cc @@ -51,11 +51,10 @@ #include "debug/data_dump/e2e_dump.h" #include "debug/debugger/debugger_utils.h" #endif -#include "debug/anf_ir_utils.h" #include "common/graph_kernel/adapter/graph_kernel_optimization.h" #include "backend/common/session/ascend_auto_monad.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" #include "abstract/utils.h" #ifdef ENABLE_DEBUGGER #include "debug/tensor_load.h" @@ -67,8 +66,7 @@ #include "toolchain/adx_datadump_callback.h" #include "toolchain/adx_datadump_server.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#include "debug/rdr/recorder_manager.h" +#include "include/common/debug/rdr/recorder_manager.h" #include "debug/rdr/graph_recorder.h" #endif #if ENABLE_CPU && ENABLE_D diff --git a/mindspore/ccsrc/backend/common/session/cpu_session.cc b/mindspore/ccsrc/backend/common/session/cpu_session.cc index fccd3a2a0b9..2704a925a97 100644 --- a/mindspore/ccsrc/backend/common/session/cpu_session.cc +++ b/mindspore/ccsrc/backend/common/session/cpu_session.cc @@ -36,9 +36,9 @@ #include "common/graph_kernel/adapter/graph_kernel_optimization.h" #include "backend/common/pass/replace_node_by_proxy.h" #include "backend/common/pass/erase_visit_attr.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/optimizer/common_backend_optimization.h" -#include "debug/dump_proto.h" +#include "include/common/debug/dump_proto.h" #ifndef ENABLE_SECURITY #include "debug/data_dump/dump_json_parser.h" #endif @@ -48,7 +48,6 @@ #endif #ifdef ENABLE_DUMP_IR #include "debug/rdr/graph_recorder.h" -#include "debug/rdr/running_data_recorder.h" #endif namespace mindspore { diff --git a/mindspore/ccsrc/backend/common/session/executor.h b/mindspore/ccsrc/backend/common/session/executor.h index 069d36fe1b2..850fe8cbaed 100644 --- a/mindspore/ccsrc/backend/common/session/executor.h +++ b/mindspore/ccsrc/backend/common/session/executor.h @@ -33,6 +33,7 @@ #include "utils/any.h" #include "include/common/utils/comm_manager.h" #include "include/common/utils/contract.h" +#include "include/backend/visible.h" namespace mindspore { namespace session { @@ -152,7 +153,7 @@ class ExitTask : public Task { enum class ExecutorEvent { kClear, kRunGraphFinished, kException }; -class Executor { +class BACKEND_EXPORT Executor { public: Executor(const std::string &device_name, uint32_t device_id); ~Executor(); diff --git a/mindspore/ccsrc/backend/common/session/executor_manager.cc b/mindspore/ccsrc/backend/common/session/executor_manager.cc index 6637cd9551f..7b4b9848dd6 100644 --- a/mindspore/ccsrc/backend/common/session/executor_manager.cc +++ b/mindspore/ccsrc/backend/common/session/executor_manager.cc @@ -17,6 +17,11 @@ #include "include/common/thread_pool.h" namespace mindspore { namespace session { +ExecutorManager &ExecutorManager::Instance() { + static ExecutorManager instance{}; + return instance; +} + std::shared_ptr ExecutorManager::GetExecutor(const std::string &device_name, uint32_t device_id) { std::string device_key = device_name + "_" + std::to_string(device_id); auto iter = executors_.find(device_key); diff --git a/mindspore/ccsrc/backend/common/session/executor_manager.h b/mindspore/ccsrc/backend/common/session/executor_manager.h index 730b9f58dfc..9729d208a4d 100644 --- a/mindspore/ccsrc/backend/common/session/executor_manager.h +++ b/mindspore/ccsrc/backend/common/session/executor_manager.h @@ -20,15 +20,14 @@ #include #include #include "backend/common/session/executor.h" +#include "include/backend/visible.h" + namespace mindspore { namespace session { class Executor; -class ExecutorManager { +class BACKEND_EXPORT ExecutorManager { public: - static ExecutorManager &Instance() { - static ExecutorManager instance{}; - return instance; - } + static ExecutorManager &Instance(); std::shared_ptr GetExecutor(const std::string &device_name, uint32_t device_id); void OnEvent(const ExecutorEvent &event); void Clear(); diff --git a/mindspore/ccsrc/backend/common/session/gpu_session.cc b/mindspore/ccsrc/backend/common/session/gpu_session.cc index 5fca8e5af6f..b0dc4375797 100644 --- a/mindspore/ccsrc/backend/common/session/gpu_session.cc +++ b/mindspore/ccsrc/backend/common/session/gpu_session.cc @@ -59,8 +59,8 @@ #include "backend/common/pass/optimize_updatestate.h" #include "backend/common/pass/adjust_depend_for_parallel_optimizer_recompute_all_gather.h" #include "runtime/device/ms_device_shape_transfer.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" #ifdef ENABLE_DEBUGGER #include "debug/data_dump/e2e_dump.h" #include "debug/data_dump/dump_json_parser.h" @@ -89,9 +89,6 @@ #include "ps/util.h" #include "ps/ps_cache/ps_cache_manager.h" #endif -#ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#endif namespace mindspore { namespace session { diff --git a/mindspore/ccsrc/backend/common/session/kernel_graph.h b/mindspore/ccsrc/backend/common/session/kernel_graph.h index a4c1ad0a638..2b3f907d4ff 100644 --- a/mindspore/ccsrc/backend/common/session/kernel_graph.h +++ b/mindspore/ccsrc/backend/common/session/kernel_graph.h @@ -32,6 +32,7 @@ #include "ir/graph_utils.h" #include "include/common/utils/contract.h" #include "runtime/device/kernel_info.h" +#include "include/backend/visible.h" namespace mindspore { namespace session { @@ -52,7 +53,7 @@ struct KernelWithIndexCmp { using DeviceAddressType = device::DeviceAddressType; using KernelMapTensor = std::map; -class KernelGraph : public FuncGraph { +class BACKEND_EXPORT KernelGraph : public FuncGraph { public: KernelGraph() : graph_id_(0), start_label_(nullptr), end_goto_(nullptr), current_epoch_(0), is_dynamic_shape_(false) { inputs_ = std::make_shared>(); diff --git a/mindspore/ccsrc/backend/common/session/session_basic.cc b/mindspore/ccsrc/backend/common/session/session_basic.cc index f919153dba6..26619d5ad09 100644 --- a/mindspore/ccsrc/backend/common/session/session_basic.cc +++ b/mindspore/ccsrc/backend/common/session/session_basic.cc @@ -41,8 +41,8 @@ #include "ir/anf.h" #include "ir/func_graph_cloner.h" #include "include/common/utils/utils.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" #include "utils/file_utils.h" #include "utils/trace_base.h" #include "include/common/utils/parallel_context.h" @@ -63,8 +63,8 @@ #include "debug/debugger/proto_exporter_stub.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#include "debug/rdr/recorder_manager.h" +#include "debug/rdr/graph_exec_order_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" #include "debug/rdr/graph_recorder.h" #include "runtime/hardware/device_context_manager.h" #endif diff --git a/mindspore/ccsrc/backend/common/session/session_basic.h b/mindspore/ccsrc/backend/common/session/session_basic.h index a3ce8273e41..ab292a573ad 100644 --- a/mindspore/ccsrc/backend/common/session/session_basic.h +++ b/mindspore/ccsrc/backend/common/session/session_basic.h @@ -39,6 +39,7 @@ #endif #include "runtime/hardware/device_context.h" #include "backend/common/session/pynative_task_manager.h" +#include "include/backend/visible.h" namespace mindspore { namespace runtime { @@ -96,7 +97,7 @@ struct GraphOutputInfo { class Executor; -class SessionBasic : public std::enable_shared_from_this { +class BACKEND_EXPORT SessionBasic : public std::enable_shared_from_this { public: SessionBasic() : context_(nullptr), summary_callback_(nullptr), device_id_(0) { #if defined(ENABLE_DEBUGGER) && !defined(_WIN32) && !defined(_WIN64) @@ -366,8 +367,8 @@ class SessionBasic : public std::enable_shared_from_this { using SessionPtr = std::shared_ptr; using NamedSummaryOutputs = std::map>; } // namespace session -void DumpGraphExeOrder(const std::string &file_name, const std::string &target_dir, - const std::vector &execution_order); +BACKEND_EXPORT void DumpGraphExeOrder(const std::string &file_name, const std::string &target_dir, + const std::vector &execution_order); uint32_t GetRankId(); } // namespace mindspore #endif // MINDSPORE_CCSRC_BACKEND_SESSION_SESSION_BASIC_H diff --git a/mindspore/ccsrc/backend/common/session/session_factory.h b/mindspore/ccsrc/backend/common/session/session_factory.h index bde7e44a4ca..b58d9ad048e 100644 --- a/mindspore/ccsrc/backend/common/session/session_factory.h +++ b/mindspore/ccsrc/backend/common/session/session_factory.h @@ -23,10 +23,12 @@ #include #include "utils/ms_utils.h" #include "backend/common/session/session_basic.h" +#include "include/backend/visible.h" + namespace mindspore { namespace session { using SessionCreator = std::function()>; -class SessionFactory { +class BACKEND_EXPORT SessionFactory { public: static SessionFactory &Get(); void Register(const std::string &device_name, SessionCreator &&session_creator); diff --git a/mindspore/ccsrc/backend/common/somas/somas.cc b/mindspore/ccsrc/backend/common/somas/somas.cc index dd1854295da..8f283cb043f 100644 --- a/mindspore/ccsrc/backend/common/somas/somas.cc +++ b/mindspore/ccsrc/backend/common/somas/somas.cc @@ -31,9 +31,9 @@ #endif #include "backend/common/optimizer/helper.h" #include "utils/ms_context.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "debug/rdr/string_recorder.h" #endif #include "include/common/thread_pool.h" #ifndef ENABLE_SECURITY diff --git a/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc b/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc index 1c0950dff46..553fe77c4f2 100644 --- a/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc +++ b/mindspore/ccsrc/backend/common/somas/somas_solver_pre.cc @@ -23,7 +23,7 @@ #include "backend/common/somas/somas_solver_core.h" #include "backend/common/somas/somas_solver_pre.h" -#include "debug/common.h" +#include "include/common/debug/common.h" namespace mindspore { namespace somas { diff --git a/mindspore/ccsrc/backend/graph_compiler/backend.cc b/mindspore/ccsrc/backend/graph_compiler/backend.cc index b2dee7aa122..866274b234c 100644 --- a/mindspore/ccsrc/backend/graph_compiler/backend.cc +++ b/mindspore/ccsrc/backend/graph_compiler/backend.cc @@ -734,9 +734,7 @@ void RunControlOperator(const std::shared_ptr &graph_compiler, co VectorRef args; GetControlOpInput(graph_compiler, cnode, kernel, op_output_map, parameter_index, graph_inputs, input_tensor_info, &args); - auto py_prim = prim->cast(); - MS_EXCEPTION_IF_NULL(py_prim); - BaseRef out = py_prim->RunHookFunction(args); + BaseRef out = python_adapter::PyAdapterCallback::RunPrimitivePyHookFunction(prim, args); // Convert pyobject output to tensor. if (utils::isa(out)) { PyObjectRef py_ref = utils::cast(out); diff --git a/mindspore/ccsrc/backend/graph_compiler/backend.h b/mindspore/ccsrc/backend/graph_compiler/backend.h index f44c0ca64dc..7fa5eafa079 100644 --- a/mindspore/ccsrc/backend/graph_compiler/backend.h +++ b/mindspore/ccsrc/backend/graph_compiler/backend.h @@ -34,6 +34,7 @@ #include "runtime/hardware/device_context.h" #include "runtime/graph_scheduler/graph_scheduler.h" #include "runtime/pynative/op_task.h" +#include "include/backend/visible.h" namespace mindspore { namespace compile { @@ -53,7 +54,7 @@ enum SwitchCondStatus { kCondAlreadyRun, }; -class Backend { +class BACKEND_EXPORT Backend { public: explicit Backend(const std::string &name); @@ -75,7 +76,7 @@ class Backend { bool is_multi_graph_sink_; }; -class MsBackend : public Backend { +class BACKEND_EXPORT MsBackend : public Backend { public: MsBackend(const std::string &name, const std::string &target, uint32_t device_id); ~MsBackend() override = default; @@ -101,7 +102,7 @@ class MsBackend : public Backend { mindspore::HashMap graph_id_map_; }; -class MindRTBackend : public Backend { +class BACKEND_EXPORT MindRTBackend : public Backend { public: MindRTBackend(const std::string &backend_name, const std::string &device_name, uint32_t device_id); ~MindRTBackend() override = default; diff --git a/mindspore/ccsrc/backend/graph_compiler/graph_partition.h b/mindspore/ccsrc/backend/graph_compiler/graph_partition.h index 4b5a934da22..2308e735fe6 100644 --- a/mindspore/ccsrc/backend/graph_compiler/graph_partition.h +++ b/mindspore/ccsrc/backend/graph_compiler/graph_partition.h @@ -23,11 +23,12 @@ #include "ir/func_graph.h" #include "ir/graph_utils.h" #include "base/base_ref.h" +#include "include/backend/visible.h" namespace mindspore { -extern const char kMsVm[]; -extern const char kGeVm[]; -extern const char kMsConvert[]; +BACKEND_EXPORT extern const char kMsVm[]; +BACKEND_EXPORT extern const char kGeVm[]; +BACKEND_EXPORT extern const char kMsConvert[]; namespace compile { class GraphPartition { diff --git a/mindspore/ccsrc/backend/graph_compiler/transform.cc b/mindspore/ccsrc/backend/graph_compiler/transform.cc index be2e0f19a48..00a5181d7a3 100644 --- a/mindspore/ccsrc/backend/graph_compiler/transform.cc +++ b/mindspore/ccsrc/backend/graph_compiler/transform.cc @@ -25,13 +25,13 @@ #include #include "abstract/abstract_value.h" +#include "abstract/abstract_function.h" #ifdef ENABLE_D #include "include/transform/graph_ir/convert.h" #endif #include "ir/graph_utils.h" #include "utils/ms_context.h" -#include "debug/trace.h" -#include "debug/anf_ir_dump.h" +#include "utils/trace_base.h" #if ((defined ENABLE_CPU) && (!defined _WIN32)) #include "ps/ps_context.h" #endif diff --git a/mindspore/ccsrc/backend/graph_compiler/transform.h b/mindspore/ccsrc/backend/graph_compiler/transform.h index 5f8db0b08d7..a6f34a569f3 100644 --- a/mindspore/ccsrc/backend/graph_compiler/transform.h +++ b/mindspore/ccsrc/backend/graph_compiler/transform.h @@ -32,6 +32,7 @@ #include "backend/graph_compiler/segment_runner.h" #include "backend/graph_compiler/backend.h" #include "backend/graph_compiler/graph_partition.h" +#include "include/backend/visible.h" // mindspore namespace is the top level namespace of MindSpore project. // Other namespace should be a sub namespace of mindspore namespace in the ME project. @@ -42,14 +43,14 @@ extern const char kGeVm[]; // compile namespace // A sub namespace in ME to support compile related definition. namespace compile { -extern std::vector nonlinear_ops; -extern std::vector control_ops; -const std::vector &GetMsNonlinearOps(); +BACKEND_EXPORT extern std::vector nonlinear_ops; +BACKEND_EXPORT extern std::vector control_ops; +BACKEND_EXPORT const std::vector &GetMsNonlinearOps(); FuncGraphPtr WrapPrimitives(const FuncGraphPtr &graph); using VmEvalFunc = std::function; using VmEvalFuncPtr = std::shared_ptr>; -class CompileGraph { +class BACKEND_EXPORT CompileGraph { public: explicit CompileGraph(const BackendPtr &backend, const std::vector &cut_list = nonlinear_ops); @@ -110,7 +111,7 @@ class CompileGraph { using CompileGraphPtr = std::shared_ptr; // CompileGraphs is used to Convert a graph cluster into instruction lists. -class CompileGraphs { +class BACKEND_EXPORT CompileGraphs { public: explicit CompileGraphs(const BackendPtr &backend, const std::vector &cut_list = nonlinear_ops); @@ -132,10 +133,10 @@ class CompileGraphs { BackendPtr backend_; }; -BackendPtr CreateBackend(); +BACKEND_EXPORT BackendPtr CreateBackend(); // Set mindRT whether enable. GPU and CPU use mindRT currently, and other hardwares will use it in the future. -void SetMindRTEnable(); +BACKEND_EXPORT void SetMindRTEnable(); } // namespace compile } // namespace mindspore diff --git a/mindspore/ccsrc/backend/graph_compiler/vm.cc b/mindspore/ccsrc/backend/graph_compiler/vm.cc index 0bae2329ec1..749f2f1764f 100644 --- a/mindspore/ccsrc/backend/graph_compiler/vm.cc +++ b/mindspore/ccsrc/backend/graph_compiler/vm.cc @@ -108,7 +108,7 @@ BaseRef FinalVM::Ref(int64_t i) { if (utils::isa(insts_stack_[sp_next])) { py::object value = utils::cast(insts_stack_[sp_next]).object_; MS_LOG(DEBUG) << "VM ref python:" << py::str(value); - return parse::data_converter::PyDataToValue(value); + return python_adapter::PyAdapterCallback::PyDataToValue(value); } MS_LOG(DEBUG) << "Ref not python :" << insts_stack_[sp_next].ToString(); return insts_stack_[sp_next]; @@ -471,9 +471,7 @@ void FinalVM::InstPushPrim(const VectorRef &args) { } if (prim->name() == kBpropCutOpName) { - auto py_prim = prim->cast(); - MS_EXCEPTION_IF_NULL(py_prim); - auto outs = py_prim->RunHookFunction(tuple); + BaseRef outs = python_adapter::PyAdapterCallback::RunPrimitivePyHookFunction(prim, tuple); Push(outs); } else { auto outs = RunOperation(prim, tuple); diff --git a/mindspore/ccsrc/backend/graph_compiler/vm.h b/mindspore/ccsrc/backend/graph_compiler/vm.h index ea5bcb01d8b..d847dad1fdc 100644 --- a/mindspore/ccsrc/backend/graph_compiler/vm.h +++ b/mindspore/ccsrc/backend/graph_compiler/vm.h @@ -33,6 +33,7 @@ #include "ir/anf.h" #include "base/base_ref.h" +#include "include/backend/visible.h" namespace py = pybind11; @@ -96,7 +97,7 @@ class StructSimuSwitch : public Base { std::ostream &operator<<(std::ostream &os, const StructSimuSwitch &other); bool operator==(const StructSimuSwitch &lhs, const StructSimuSwitch &rhs); -class FinalVM { +class BACKEND_EXPORT FinalVM { public: // Create a VM with the specified instructions and backend. explicit FinalVM(const InstSet &insts, const BackendPtr &backend); diff --git a/mindspore/ccsrc/common/CMakeLists.txt b/mindspore/ccsrc/common/CMakeLists.txt index 90a0ef62716..2d97e010419 100644 --- a/mindspore/ccsrc/common/CMakeLists.txt +++ b/mindspore/ccsrc/common/CMakeLists.txt @@ -2,11 +2,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") file(GLOB_RECURSE _COMMON_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "duplex_pipe_win.cc" "thread_pool.cc" + "api_register.cc" ) else() file(GLOB_RECURSE _COMMON_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "duplex_pipe.cc" "thread_pool.cc" + "api_register.cc" ) endif() diff --git a/mindspore/ccsrc/pybind_api/api_register.cc b/mindspore/ccsrc/common/api_register.cc similarity index 88% rename from mindspore/ccsrc/pybind_api/api_register.cc rename to mindspore/ccsrc/common/api_register.cc index 7e575da0b07..c16aeba3221 100644 --- a/mindspore/ccsrc/pybind_api/api_register.cc +++ b/mindspore/ccsrc/common/api_register.cc @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { PybindDefineRegister &PybindDefineRegister::GetSingleton() { - static PybindDefineRegister instance; + static PybindDefineRegister instance{}; return instance; } diff --git a/mindspore/ccsrc/common/debug/CMakeLists.txt b/mindspore/ccsrc/common/debug/CMakeLists.txt new file mode 100644 index 00000000000..9f0e02f4f36 --- /dev/null +++ b/mindspore/ccsrc/common/debug/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB_RECURSE _COMMON_DEBUG_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc") +set_property(SOURCE ${_COMMON_DEBUG_SRC_LIST} PROPERTY COMPILE_DEFINITIONS + SUBMODULE_ID=mindspore::SubModuleId::SM_DEBUG) +add_library(_mindspore_common_debug_obj OBJECT ${_COMMON_DEBUG_SRC_LIST}) diff --git a/mindspore/ccsrc/debug/anf_dump_utils.cc b/mindspore/ccsrc/common/debug/anf_dump_utils.cc similarity index 74% rename from mindspore/ccsrc/debug/anf_dump_utils.cc rename to mindspore/ccsrc/common/debug/anf_dump_utils.cc index 6f46c579804..03fb1f1ede4 100644 --- a/mindspore/ccsrc/debug/anf_dump_utils.cc +++ b/mindspore/ccsrc/common/debug/anf_dump_utils.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "debug/anf_dump_utils.h" +#include "include/common/debug/anf_dump_utils.h" #include "abstract/abstract_function.h" namespace mindspore { @@ -72,4 +72,32 @@ std::string GetNodeFuncStr(const AnfNodePtr &nd) { } return GetAbstractFuncStr(abs_func); } + +std::string TypeToShortString(const TypeId &typeId) { + std::string label = TypeIdLabel(typeId); + std::string prefix = "kNumberType"; + if (prefix.length() > label.length()) { + return label; + } + auto position = label.find(prefix); + // Position is 0 when label begins with prefix + if (position != 0) { + return label; + } + auto sub_position = position + prefix.length(); + if (sub_position >= label.length()) { + return label; + } + return label.substr(sub_position); +} + +std::string GetKernelNodeName(const AnfNodePtr &anf_node) { + MS_EXCEPTION_IF_NULL(anf_node); + std::string kernel_name = anf_node->fullname_with_scope(); + if (kernel_name.empty()) { + kernel_name = anf_node->ToString(); + } + MS_LOG(DEBUG) << "Full scope kernel name is " << kernel_name << "."; + return kernel_name; +} } // namespace mindspore diff --git a/mindspore/ccsrc/debug/anf_ir_dump.cc b/mindspore/ccsrc/common/debug/anf_ir_dump.cc similarity index 93% rename from mindspore/ccsrc/debug/anf_ir_dump.cc rename to mindspore/ccsrc/common/debug/anf_ir_dump.cc index 112b4ac8d1a..be52819da59 100644 --- a/mindspore/ccsrc/debug/anf_ir_dump.cc +++ b/mindspore/ccsrc/common/debug/anf_ir_dump.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #if defined(_WIN32) || defined(_WIN64) #include #endif @@ -23,45 +23,13 @@ #include "utils/hash_map.h" #include "ir/primitive.h" #include "ir/func_graph.h" -#include "runtime/device/kernel_info.h" #include "ir/graph_utils.h" -#include "backend/common/session/anf_runtime_algorithm.h" -#include "include/common/utils/anfalgo.h" -#include "frontend/parallel/ops_info/operator_info.h" -#include "pipeline/jit/base.h" -#include "debug/trace.h" -#include "debug/anf_dump_utils.h" #include "utils/trace_base.h" #include "utils/anf_utils.h" +#include "include/common/utils/anfalgo.h" +#include "include/common/debug/anf_dump_utils.h" namespace mindspore { -const std::string ToShortString(const TypeId &typeId) { - std::string label = TypeIdLabel(typeId); - std::string prefix = "kNumberType"; - if (prefix.length() > label.length()) { - return label; - } - auto position = label.find(prefix); - // Position is 0 when label begins with prefix - if (position != 0) { - return label; - } - auto sub_position = position + prefix.length(); - if (sub_position >= label.length()) { - return label; - } - return label.substr(sub_position); -} - -void PrintKernelFormatAndType(std::ostringstream &buffer, const std::string &fmt, const TypeId &type, - const std::vector &shape) { - buffer << "<" << ToShortString(type); - if (!fmt.empty()) { - buffer << "x" << fmt << shape; - } - buffer << ">"; -} - void PrintTupleNodeUsedFlags(std::ostringstream &buffer, const abstract::AbstractSequencePtr &sequence_abs) { if (sequence_abs == nullptr || sequence_abs->sequence_nodes() == nullptr || sequence_abs->sequence_nodes()->empty()) { return; @@ -190,10 +158,7 @@ void DumpKernelInfo(const CNodePtr &node, const std::shared_ptr if (i != 0) { gsub->buffer << ", "; } - auto format = AnfAlgo::GetInputFormat(node, i); - auto type = AnfAlgo::GetInputDeviceDataType(node, i); - auto shape = AnfAlgo::GetInputDeviceShape(node, i); - PrintKernelFormatAndType(gsub->buffer, format, type, shape); + gsub->buffer << AnfDumpHandler::PrintInputTypeShapeFormat(node, i); } gsub->buffer << ") -> ("; size_t output_num = common::AnfAlgo::GetOutputTensorNum(node); @@ -201,10 +166,7 @@ void DumpKernelInfo(const CNodePtr &node, const std::shared_ptr if (i != 0) { gsub->buffer << ", "; } - auto format = AnfAlgo::GetOutputFormat(node, i); - auto type = AnfAlgo::GetOutputDeviceDataType(node, i); - auto shape = AnfAlgo::GetOutputDeviceShape(node, i); - PrintKernelFormatAndType(gsub->buffer, format, type, shape); + gsub->buffer << AnfDumpHandler::PrintOutputTypeShapeFormat(node, i); } gsub->buffer << ")"; gsub->buffer << std::endl; @@ -235,10 +197,7 @@ int32_t DumpParams(const FuncGraphPtr &graph, std::ostringstream &buffer, Ordere auto kernel_info = p->kernel_info(); if (kernel_info != nullptr && kernel_info->has_build_info()) { buffer << " : "; - auto type = AnfAlgo::GetOutputDeviceDataType(p, 0); - auto format = AnfAlgo::GetOutputFormat(p, 0); - auto shape = AnfAlgo::GetOutputDeviceShape(p, 0); - PrintKernelFormatAndType(buffer, format, type, shape); + buffer << AnfDumpHandler::PrintOutputTypeShapeFormat(p, 0); buffer << " : IsWeight:" << std::boolalpha << common::AnfAlgo::IsParameterWeight(parameter_ptr); } buffer << std::endl; @@ -376,23 +335,15 @@ void DumpParallelInfo(const CNodePtr &node, const std::shared_ptruser_data(); - if (operator_info == nullptr) { + ValuePtr in_tmp = AnfDumpHandler::InStrategyValue(node); + if (in_tmp == nullptr) { return; } - - auto in_strategy = operator_info->strategy(); - if (in_strategy == nullptr) { - return; - } - - ValuePtr in_tmp = MakeValue(in_strategy->GetInputDim()); gsub->buffer << " {in_strategy: "; gsub->buffer << in_tmp->ToString(); - auto out_strategy = operator_info->out_strategy(); - if (out_strategy) { - ValuePtr out_tmp = MakeValue(out_strategy->GetInputDim()); + ValuePtr out_tmp = AnfDumpHandler::OutStrategyValue(node); + if (out_tmp != nullptr) { gsub->buffer << ", out_strategy: "; gsub->buffer << out_tmp->ToString(); } diff --git a/mindspore/ccsrc/debug/common.cc b/mindspore/ccsrc/common/debug/common.cc similarity index 97% rename from mindspore/ccsrc/debug/common.cc rename to mindspore/ccsrc/common/debug/common.cc index 700e3809eed..363524bb6ea 100644 --- a/mindspore/ccsrc/debug/common.cc +++ b/mindspore/ccsrc/common/debug/common.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "debug/common.h" +#include "include/common/debug/common.h" #include #include @@ -301,6 +301,15 @@ std::string Common::GetCompilerCachePath() { return compile_cache_dir; } +bool Common::GetDebugTerminate() { return debugger_terminate_; } + +bool Common::GetDebugExitSuccess() { return exit_success_; } + +void Common::DebugTerminate(bool val, bool exit_success) { + debugger_terminate_ = val; + exit_success_ = exit_success; +} + struct GlogLogDirRegister { GlogLogDirRegister() { const char *logtostderr = std::getenv("GLOG_logtostderr"); diff --git a/mindspore/ccsrc/debug/draw.cc b/mindspore/ccsrc/common/debug/draw.cc similarity index 91% rename from mindspore/ccsrc/debug/draw.cc rename to mindspore/ccsrc/common/debug/draw.cc index eeef993ea35..8535bc81ed0 100644 --- a/mindspore/ccsrc/debug/draw.cc +++ b/mindspore/ccsrc/common/debug/draw.cc @@ -14,22 +14,20 @@ * limitations under the License. */ -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include #include #include #include +#include #include "ir/meta_func_graph.h" -#include "ir/param_info.h" #include "ir/primitive.h" #include "ir/graph_utils.h" -#include "include/common/utils/utils.h" -#include "frontend/operator/composite/composite.h" -#include "frontend/parallel/ops_info/operator_info.h" -#include "pipeline/jit/parse/resolve.h" #include "ir/tensor.h" +#include "include/common/utils/utils.h" +#include "include/common/debug/anf_dump_utils.h" namespace mindspore { // namespace to support debug utils @@ -44,20 +42,6 @@ std::string ValueType(const ValueNodePtr &node) { MS_EXCEPTION_IF_NULL(v); return v->type_name(); } - -std::string ReplaceSpecialChar(const std::string &str) { - std::ostringstream oss; - for (size_t i = 0; i < str.size(); i++) { - if (str[i] == '<') { - oss << "「"; - } else if (str[i] == '>') { - oss << "」"; - } else { - oss << str[i]; - } - } - return oss.str(); -} } // namespace // API of debug utils @@ -400,12 +384,8 @@ static void DrawValueNode(Graphviz *const graph_obj, const ValueNodePtr &node) { << "'>"; graph_obj->buffer() << "" << ValueType(node) << "" << ""; - if (IsValueNode(node)) { - graph_obj->buffer() << node->value()->cast()->name(); - } else if (IsValueNode(node)) { - graph_obj->buffer() << node->value()->cast()->name(); - } else if (IsValueNode(node)) { - graph_obj->buffer() << ReplaceSpecialChar(node->value()->cast()->name()); + if (std::string value_node_str = AnfDumpHandler::ValueNodeStr(node); !value_node_str.empty()) { + graph_obj->buffer() << value_node_str; } else { std::ostringstream ss; ss << node->value()->ToString(); @@ -448,18 +428,16 @@ static void DrawParallelInfo(Graphviz *const graph_obj, const CNodePtr &node) { if (graph_obj == nullptr || node == nullptr) { return; } - auto distributed_operation_info = node->user_data(); - if (distributed_operation_info != nullptr) { - auto strategyPtr = distributed_operation_info->strategy(); - if (strategyPtr != nullptr) { - auto num = node->inputs().size(); - graph_obj->buffer() << "buffer() << "bgcolor='" << graph_obj->Color(node) << "'>"; - std::vector temp = {MakeValue(strategyPtr->GetInputStage()), MakeValue(strategyPtr->GetInputDim())}; - ValueTuplePtr strategy_tuple = std::make_shared(temp); - graph_obj->buffer() << "Strategy " << strategy_tuple->ToString(); - graph_obj->buffer() << "" << std::endl; - } + + auto in_value = AnfDumpHandler::InStrategyValue(node); + auto in_stage_value = AnfDumpHandler::InStrategyStageValue(node); + if (in_value != nullptr && in_stage_value != nullptr) { + auto num = node->inputs().size(); + graph_obj->buffer() << "buffer() << "bgcolor='" << graph_obj->Color(node) << "'>"; + ValueTuplePtr strategy_tuple = std::make_shared(std::vector{in_stage_value, in_value}); + graph_obj->buffer() << "Strategy " << strategy_tuple->ToString(); + graph_obj->buffer() << "" << std::endl; } } diff --git a/mindspore/ccsrc/debug/dump_proto.cc b/mindspore/ccsrc/common/debug/dump_proto.cc similarity index 97% rename from mindspore/ccsrc/debug/dump_proto.cc rename to mindspore/ccsrc/common/debug/dump_proto.cc index 427d0f5c6a3..33d7295cce5 100644 --- a/mindspore/ccsrc/debug/dump_proto.cc +++ b/mindspore/ccsrc/common/debug/dump_proto.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "debug/dump_proto.h" +#include "include/common/debug/dump_proto.h" #include #include @@ -22,15 +22,14 @@ #include #include -#include "debug/anf_ir_utils.h" #include "proto/anf_ir.pb.h" #include "ir/graph_utils.h" #include "utils/ms_context.h" #include "utils/symbolic.h" #include "include/common/utils/utils.h" -#include "pipeline/jit/base.h" +#include "include/common/debug/anf_dump_utils.h" #include "utils/anf_utils.h" -#include "mindspore/ccsrc/frontend/parallel/ops_info/operator_info.h" +#include "frontend/parallel/ops_info/ops_utils.h" // todo: use constant string now namespace mindspore { class ProtoExporter { @@ -368,15 +367,11 @@ void ProtoExporter::GetOpNodeTypeAndAttrs(const FuncGraphPtr &, const CNodePtr & } // Only CNode save the operator strategy - auto operator_info = cnode->user_data(); - if (operator_info != nullptr) { - auto strategy = operator_info->strategy(); - if (strategy != nullptr) { - ValuePtr strategy_value = MakeValue(strategy->GetInputDim()); - irpb::AttributeProto *attr_proto = node_proto->add_attribute(); - attr_proto->set_name(mindspore::parallel::IN_STRATEGY); - SetValueToProto(strategy_value, attr_proto->mutable_value()); - } + auto strategy_value = AnfDumpHandler::InStrategyValue(cnode); + if (strategy_value != nullptr) { + irpb::AttributeProto *attr_proto = node_proto->add_attribute(); + attr_proto->set_name(mindspore::parallel::IN_STRATEGY); + SetValueToProto(strategy_value, attr_proto->mutable_value()); } node_proto->set_scope(op_node->scope()->name()); diff --git a/mindspore/ccsrc/debug/env_config_parser.cc b/mindspore/ccsrc/common/debug/env_config_parser.cc similarity index 97% rename from mindspore/ccsrc/debug/env_config_parser.cc rename to mindspore/ccsrc/common/debug/env_config_parser.cc index e26b97d3032..587a9e17b2a 100644 --- a/mindspore/ccsrc/debug/env_config_parser.cc +++ b/mindspore/ccsrc/common/debug/env_config_parser.cc @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "debug/env_config_parser.h" +#include "include/common/debug/env_config_parser.h" #include #include #include "nlohmann/json.hpp" #include "utils/log_adapter.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "utils/ms_context.h" #include "utils/convert_utils_base.h" @@ -37,6 +37,12 @@ constexpr auto KEY_MEM_REUSE = "mem_reuse"; } // namespace namespace mindspore { +EnvConfigParser &EnvConfigParser::GetInstance() { + static EnvConfigParser instance = EnvConfigParser(); + instance.Parse(); + return instance; +} + #ifdef ENABLE_DUMP_IR std::optional GetRdrEnableFromEnv() { // get environment variable to configure RDR diff --git a/mindspore/ccsrc/debug/rdr/base_recorder.cc b/mindspore/ccsrc/common/debug/rdr/base_recorder.cc similarity index 56% rename from mindspore/ccsrc/debug/rdr/base_recorder.cc rename to mindspore/ccsrc/common/debug/rdr/base_recorder.cc index 827b6a40e67..380d4828236 100644 --- a/mindspore/ccsrc/debug/rdr/base_recorder.cc +++ b/mindspore/ccsrc/common/debug/rdr/base_recorder.cc @@ -13,12 +13,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "debug/rdr/base_recorder.h" -#include "debug/common.h" -#include "include/common/utils/utils.h" +#include "include/common/debug/rdr/base_recorder.h" +#include "include/common/debug/common.h" #include "include/common/utils/comm_manager.h" +#include "include/common/debug/env_config_parser.h" namespace mindspore { +namespace { +constexpr int kMaxNameLength = 32; +} // namespace +BaseRecorder::BaseRecorder() : module_(""), name_(""), directory_(""), filename_(""), timestamp_("") {} +BaseRecorder::BaseRecorder(const std::string &module, const std::string &name) + : module_(module), name_(name), filename_("") { + directory_ = mindspore::EnvConfigParser::GetInstance().RdrPath(); + + if (name.length() > kMaxNameLength) { + name_ = name.substr(0, kMaxNameLength); + MS_LOG(WARNING) << "The name length is " << name.length() << ", exceeding the limit " << kMaxNameLength + << ". It will be intercepted as '" << name_ << "'."; + } + + std::string err_msg = module_ + ":" + name_ + " set filename failed."; + if (!filename_.empty() && !Common::IsFilenameValid(filename_, MAX_FILENAME_LENGTH, err_msg)) { + filename_ = ""; + } + auto sys_time = GetTimeString(); + for (auto ch : sys_time) { + if (ch == '.') { + break; + } + if (ch != '-' && ch != ':') { + timestamp_.push_back(ch); + } + } +} + std::optional BaseRecorder::GetFileRealPath(const std::string &suffix) const { std::string filename; if (filename_.empty()) { diff --git a/mindspore/ccsrc/debug/rdr/recorder_manager.cc b/mindspore/ccsrc/common/debug/rdr/recorder_manager.cc similarity index 87% rename from mindspore/ccsrc/debug/rdr/recorder_manager.cc rename to mindspore/ccsrc/common/debug/rdr/recorder_manager.cc index d0b50d81a6f..9b898a036d9 100644 --- a/mindspore/ccsrc/debug/rdr/recorder_manager.cc +++ b/mindspore/ccsrc/common/debug/rdr/recorder_manager.cc @@ -13,12 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "debug/rdr/recorder_manager.h" +#include "include/common/debug/rdr/recorder_manager.h" #include -#include "debug/rdr/base_recorder.h" -#include "debug/env_config_parser.h" +#include "include/common/debug/rdr/base_recorder.h" +#include "include/common/debug/env_config_parser.h" namespace mindspore { +RecorderManager &RecorderManager::Instance() { + static RecorderManager manager{}; + manager.UpdateRdrEnable(); + return manager; +} + void RecorderManager::UpdateRdrEnable() { static bool updated = false; if (updated) { @@ -131,4 +137,12 @@ void RecorderManager::ClearAll() { rdr_has_record_mem_ = false; MS_LOG(INFO) << "RDR clear all recorders."; } + +namespace RDR { +void TriggerAll() { mindspore::RecorderManager::Instance().TriggerAll(); } + +void Snapshot() { mindspore::RecorderManager::Instance().Snapshot(); } + +void ResetRecorder() { mindspore::RecorderManager::Instance().ClearAll(); } +} // namespace RDR } // namespace mindspore diff --git a/mindspore/ccsrc/common/graph_kernel/adapter/graph_kernel_pass_manager.cc b/mindspore/ccsrc/common/graph_kernel/adapter/graph_kernel_pass_manager.cc index 96afaad2085..6a2f64aca17 100644 --- a/mindspore/ccsrc/common/graph_kernel/adapter/graph_kernel_pass_manager.cc +++ b/mindspore/ccsrc/common/graph_kernel/adapter/graph_kernel_pass_manager.cc @@ -21,7 +21,7 @@ #include "ir/func_graph.h" #include "ir/manager.h" #include "utils/ms_context.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore::graphkernel { void GraphKernelPassManager::AddPass(const opt::PassPtr &pass, unsigned int pass_level, bool supported_device) { diff --git a/mindspore/ccsrc/common/graph_kernel/add_atomic_clean.cc b/mindspore/ccsrc/common/graph_kernel/add_atomic_clean.cc index 1cc158d0bfa..802ef859b27 100644 --- a/mindspore/ccsrc/common/graph_kernel/add_atomic_clean.cc +++ b/mindspore/ccsrc/common/graph_kernel/add_atomic_clean.cc @@ -32,7 +32,7 @@ #include "common/graph_kernel/graph_kernel_helper.h" #include "common/graph_kernel/core/graph_kernel_utils.h" #include "backend/common/session/kernel_graph.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "kernel/common_utils.h" namespace mindspore::graphkernel { diff --git a/mindspore/ccsrc/common/graph_kernel/lite_adapter/graph_kernel_pass_manager.cc b/mindspore/ccsrc/common/graph_kernel/lite_adapter/graph_kernel_pass_manager.cc index d4ac50d9deb..4814bca7317 100644 --- a/mindspore/ccsrc/common/graph_kernel/lite_adapter/graph_kernel_pass_manager.cc +++ b/mindspore/ccsrc/common/graph_kernel/lite_adapter/graph_kernel_pass_manager.cc @@ -20,7 +20,7 @@ #include "ir/anf.h" #include "ir/func_graph.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore::graphkernel { void GraphKernelPassManager::AddPass(const opt::PassPtr &pass, unsigned int pass_level, bool supported_device) { diff --git a/mindspore/ccsrc/common/graph_kernel/reorder_ops.cc b/mindspore/ccsrc/common/graph_kernel/reorder_ops.cc index 1a50772f0ed..bc0ff398680 100644 --- a/mindspore/ccsrc/common/graph_kernel/reorder_ops.cc +++ b/mindspore/ccsrc/common/graph_kernel/reorder_ops.cc @@ -24,7 +24,7 @@ #include "utils/log_adapter.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/graph_kernel/core/graph_kernel_utils.h" namespace mindspore::graphkernel { diff --git a/mindspore/ccsrc/common/graph_kernel/transform_op_optimizer.cc b/mindspore/ccsrc/common/graph_kernel/transform_op_optimizer.cc index d109b82160e..027c6be36db 100644 --- a/mindspore/ccsrc/common/graph_kernel/transform_op_optimizer.cc +++ b/mindspore/ccsrc/common/graph_kernel/transform_op_optimizer.cc @@ -25,7 +25,7 @@ #include #include "base/core_ops.h" #include "ir/graph_utils.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "kernel/common_utils.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" diff --git a/mindspore/ccsrc/cxx_api/CMakeLists.txt b/mindspore/ccsrc/cxx_api/CMakeLists.txt index 63b19be8d0c..e3626e5de9c 100644 --- a/mindspore/ccsrc/cxx_api/CMakeLists.txt +++ b/mindspore/ccsrc/cxx_api/CMakeLists.txt @@ -56,6 +56,15 @@ set(MSLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/types.cc ${API_OPS_SRC} ) +if(ENABLE_D) + list(APPEND MSLIB_SRC + "${CMAKE_SOURCE_DIR}/mindspore/ccsrc/frontend/parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc" + "${CMAKE_SOURCE_DIR}/mindspore/ccsrc/frontend/parallel/tensor_layout/array.cc" + "${CMAKE_SOURCE_DIR}/mindspore/ccsrc/frontend/parallel/tensor_layout/map.cc" + "${CMAKE_SOURCE_DIR}/mindspore/ccsrc/frontend/parallel/tensor_layout/arrangement.cc" + "${CMAKE_SOURCE_DIR}/mindspore/ccsrc/frontend/parallel/tensor_layout/shape_util.cc") +endif() + if(NOT ENABLE_TESTCASES AND NOT BUILD_LITE) # users of shared_lib cannot find symbols in indirect dependency set(MSLIB_SRC ${MSLIB_SRC} ${CMAKE_SOURCE_DIR}/mindspore/core/utils/status.cc) @@ -81,8 +90,9 @@ add_library(mindspore_shared_lib SHARED $) add_dependencies(mindspore_shared_lib _mindspore_transform_graph_ir_obj) -elseif(ENABLE_ACL AND NOT ENABLE_D) - target_link_libraries(mindspore_shared_lib PRIVATE $) +elseif(MODE_ASCEND_ACL) + target_link_libraries(mindspore_shared_lib PRIVATE $ + mindspore_backend_static mindspore_debug) endif() if(NOT BUILD_LITE) set_target_properties(mindspore_shared_lib PROPERTIES OUTPUT_NAME mindspore) @@ -90,7 +100,7 @@ endif() if(ENABLE_D OR ENABLE_GPU) target_link_libraries(mindspore_shared_lib PRIVATE -Wl,--as-needed ${PYTHON_LIBRARIES} ${SECUREC_LIBRARY} - -Wl,--whole-archive mindspore -Wl,--no-whole-archive mindspore_core mindspore_common proto_input + mindspore_backend mindspore_core mindspore_common proto_input mindspore::protobuf) else() if(BUILD_LITE) diff --git a/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc b/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc index 650a940f95f..61245523d29 100644 --- a/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc +++ b/mindspore/ccsrc/cxx_api/graph/ascend/ascend_graph_impl.cc @@ -26,16 +26,53 @@ #include "backend/common/session/executor_manager.h" #include "runtime/device/kernel_runtime_manager.h" #include "runtime/dev.h" -#include "pipeline/jit/pipeline.h" -#include "frontend/parallel/step_parallel.h" -#include "pybind11/pybind11.h" +#include "frontend/parallel/strategy_checkpoint/parallel_strategy_checkpoint.h" +#include "include/common/utils/python_adapter.h" namespace mindspore { +namespace { API_FACTORY_REG(GraphCell::GraphImpl, AscendGraphImpl); -static constexpr const char *kHcclEnable = "MS_ENABLE_HCCL"; -static constexpr const char *kHcclGroupFile = "PARA_GROUP_FILE"; +constexpr const char *kHcclEnable = "MS_ENABLE_HCCL"; +constexpr const char *kHcclGroupFile = "PARA_GROUP_FILE"; +void InitHccl() { + auto ms_context = MsContext::GetInstance(); + MS_EXCEPTION_IF_NULL(ms_context); + mindspore::python_adapter::set_python_env_flag(true); + uint32_t device_id = ms_context->get_param(MS_CTX_DEVICE_ID); + if (ms_context->backend_policy() == "ms") { + auto runtime_instance = device::KernelRuntimeManager::Instance().GetKernelRuntime(kAscendDevice, device_id); + MS_EXCEPTION_IF_NULL(runtime_instance); +#ifndef ENABLE_SECURITY + runtime_instance->PreInit(); +#endif + (void)context::OpenTsd(ms_context); + if (!runtime_instance->Init()) { + MS_LOG(EXCEPTION) << "Runtime init failed."; + } + } else { + (void)context::OpenTsd(ms_context); + } +} + +bool CreateGroupsByCkptFile(const std::string &file) { + parallel::GroupInfoMap group_info_map; + if (parallel::StrategyCheckpoint::GetInstance().LoadGroupInfo(file, &group_info_map) != parallel::SUCCESS) { + return false; + } + + for (const auto &[group_name, rank_ids] : group_info_map) { + if (!CommManager::GetInstance().CreateGroupSync(group_name, rank_ids)) { + MS_LOG(ERROR) << "Create group " << group_name << " rank ids " << rank_ids << " failed."; + return false; + } + } + + MS_LOG(INFO) << "Create groups by checkpoint file success"; + return true; +} +} // namespace AscendGraphImpl::AscendGraphImpl() : session_impl_(nullptr), graph_id_(0), @@ -308,13 +345,13 @@ AscendGraphImpl::MsEnvGuard::MsEnvGuard(uint32_t device_id) { ms_context->set_param(MS_CTX_IS_MULTI_GRAPH_SINK, true); if (ms_context->get_param(MS_CTX_ENABLE_HCCL)) { - pipeline::InitHccl(); + InitHccl(); auto para_group_file = common::GetEnv(kHcclGroupFile); if (para_group_file.empty()) { MS_LOG(INFO) << "Cannot get Env " << kHcclGroupFile << ", skip."; } else { MS_LOG(INFO) << "Get env " << kHcclGroupFile << " success: " << para_group_file; - if (!parallel::CreateGroupsByCkptFile(para_group_file)) { + if (!CreateGroupsByCkptFile(para_group_file)) { MS_LOG(ERROR) << "CreateGroupsByCkptFile failed."; errno_ = kMCFailed; return; diff --git a/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_vm.cc b/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_vm.cc index 4f91ee47dbe..03de5c4823d 100644 --- a/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_vm.cc +++ b/mindspore/ccsrc/cxx_api/model/acl/acl_vm/acl_vm.cc @@ -19,7 +19,7 @@ #include #include "cxx_api/model/acl/acl_model_options.h" #include "cxx_api/model/acl/acl_vm/acl_multi_graph_session.h" -#include "debug/trace.h" +#include "utils/trace_base.h" namespace mindspore { namespace { diff --git a/mindspore/ccsrc/debug/CMakeLists.txt b/mindspore/ccsrc/debug/CMakeLists.txt index 1d782857133..fa536768794 100644 --- a/mindspore/ccsrc/debug/CMakeLists.txt +++ b/mindspore/ccsrc/debug/CMakeLists.txt @@ -3,16 +3,7 @@ include_directories(${CMAKE_BINARY_DIR}) file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" MSVERSION) add_definitions(-DMSVERSION=\"${MSVERSION}\") -set(_DEBUG_SRC_LIST - "${CMAKE_CURRENT_SOURCE_DIR}/anf_ir_dump.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/anf_ir_utils.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/anf_dump_utils.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/draw.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/dump_proto.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/trace.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/common.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/env_config_parser.cc" -) +set(_DEBUG_SRC_LIST) set(_OFFLINE_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/debug_services.cc" @@ -57,7 +48,6 @@ if(NOT ENABLE_SECURITY) ) if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") list(APPEND _DEBUG_SRC_LIST - "${CMAKE_CURRENT_SOURCE_DIR}/common.cc" "${CMAKE_CURRENT_SOURCE_DIR}/data_dump/e2e_dump.cc" ) endif() @@ -65,7 +55,15 @@ endif() set_property(SOURCE ${_DEBUG_SRC_LIST} ${_RDR_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEBUG) -add_library(_mindspore_debug_obj OBJECT ${_DEBUG_SRC_LIST} ${_RDR_SRC_LIST}) +list(APPEND _DEBUG_SRC_LIST ${_RDR_SRC_LIST}) +list(LENGTH _DEBUG_SRC_LIST debug_files_size) +if(${debug_files_size} GREATER 0) + add_library(mindspore_debug STATIC ${_DEBUG_SRC_LIST}) + if(CMAKE_SYSTEM_NAME MATCHES "Windows") + target_compile_definitions(mindspore_debug PRIVATE BACKEND_DLL) + endif() + add_dependencies(mindspore_debug proto_input) +endif() if(ENABLE_DEBUGGER) if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") add_compile_options(-Wall -DOFFLINE_DBG_MODE -fPIC -O2) diff --git a/mindspore/ccsrc/debug/data_dump/cpu_e2e_dump.cc b/mindspore/ccsrc/debug/data_dump/cpu_e2e_dump.cc index 3c76ad77d3b..3e4ab7bb3b6 100644 --- a/mindspore/ccsrc/debug/data_dump/cpu_e2e_dump.cc +++ b/mindspore/ccsrc/debug/data_dump/cpu_e2e_dump.cc @@ -16,10 +16,11 @@ #include "debug/data_dump/cpu_e2e_dump.h" #include +#include #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" -#include "debug/anf_ir_utils.h" -#include "debug/common.h" +#include "include/common/debug/anf_dump_utils.h" +#include "include/common/debug/common.h" namespace mindspore { void CPUE2eDump::DumpCNodeData(const CNodePtr &node, uint32_t graph_id) { diff --git a/mindspore/ccsrc/debug/data_dump/dump_json_parser.cc b/mindspore/ccsrc/debug/data_dump/dump_json_parser.cc index 5bbb6558a1c..e3959a5349f 100644 --- a/mindspore/ccsrc/debug/data_dump/dump_json_parser.cc +++ b/mindspore/ccsrc/debug/data_dump/dump_json_parser.cc @@ -16,14 +16,14 @@ #include "debug/data_dump/dump_json_parser.h" #include #include "utils/log_adapter.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "debug/utils.h" #include "utils/ms_context.h" #include "utils/convert_utils_base.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "debug/data_dump/npy_header.h" -#include "debug/anf_ir_utils.h" +#include "include/common/debug/anf_dump_utils.h" #include "include/common/utils/comm_manager.h" namespace { diff --git a/mindspore/ccsrc/debug/data_dump/dump_json_parser.h b/mindspore/ccsrc/debug/data_dump/dump_json_parser.h index 307971ee022..10804dec14d 100644 --- a/mindspore/ccsrc/debug/data_dump/dump_json_parser.h +++ b/mindspore/ccsrc/debug/data_dump/dump_json_parser.h @@ -22,17 +22,24 @@ #include #include #include +#include #include "nlohmann/json.hpp" #include "utils/ms_utils.h" #include "backend/common/session/kernel_graph.h" +#include "include/backend/visible.h" + namespace mindspore { -class DumpJsonParser { +class BACKEND_EXPORT DumpJsonParser { public: static DumpJsonParser &GetInstance() { - static DumpJsonParser instance; - return instance; + std::lock_guard lock(instance_mutex_); + if (instance_ == nullptr) { + instance_ = std::shared_ptr(new DumpJsonParser); + } + return *instance_; } + ~DumpJsonParser() = default; void Parse(); static bool DumpToFile(const std::string &filename, const void *data, size_t len, const ShapeVector &shape, TypeId type); @@ -75,9 +82,11 @@ class DumpJsonParser { private: DumpJsonParser() = default; - ~DumpJsonParser() = default; DISABLE_COPY_AND_ASSIGN(DumpJsonParser) + inline static std::shared_ptr instance_ = nullptr; + inline static std::mutex instance_mutex_; + std::mutex lock_; bool async_dump_enabled_{false}; bool e2e_dump_enabled_{false}; diff --git a/mindspore/ccsrc/debug/data_dump/dump_utils.cc b/mindspore/ccsrc/debug/data_dump/dump_utils.cc index 9ce99393bbb..e8c320e1315 100644 --- a/mindspore/ccsrc/debug/data_dump/dump_utils.cc +++ b/mindspore/ccsrc/debug/data_dump/dump_utils.cc @@ -20,13 +20,13 @@ #include "runtime/device/ms_device_shape_transfer.h" #include "utils/ms_context.h" -#include "debug/anf_ir_utils.h" +#include "pipeline/jit/debug/anf_ir_utils.h" #include "debug/data_dump/dump_json_parser.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "runtime/device/kernel_runtime_manager.h" #include "include/common/utils/utils.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "runtime/graph_scheduler/device_tensor_store.h" using mindspore::runtime::DeviceTensorStore; diff --git a/mindspore/ccsrc/debug/data_dump/e2e_dump.cc b/mindspore/ccsrc/debug/data_dump/e2e_dump.cc index 435d8f23347..d6e74c7be6f 100644 --- a/mindspore/ccsrc/debug/data_dump/e2e_dump.cc +++ b/mindspore/ccsrc/debug/data_dump/e2e_dump.cc @@ -26,8 +26,8 @@ #include #include "debug/data_dump/dump_json_parser.h" #include "runtime/device/ms_device_shape_transfer.h" -#include "debug/anf_ir_utils.h" -#include "debug/common.h" +#include "include/common/debug/anf_dump_utils.h" +#include "include/common/debug/common.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "utils/ms_context.h" diff --git a/mindspore/ccsrc/debug/data_dump/e2e_dump.h b/mindspore/ccsrc/debug/data_dump/e2e_dump.h index 54390707f5e..cb7a425e144 100644 --- a/mindspore/ccsrc/debug/data_dump/e2e_dump.h +++ b/mindspore/ccsrc/debug/data_dump/e2e_dump.h @@ -30,6 +30,7 @@ #ifdef ENABLE_D #include "proto/dump_data.pb.h" #endif +#include "include/backend/visible.h" using mindspore::kernel::KernelLaunchInfo; #ifndef ENABLE_DEBUGGER @@ -127,7 +128,7 @@ class E2eDump { static bool DumpTensorDataIfNeeded(const dump_data_t &dump_tensor_info); #endif - inline static unsigned int starting_graph_id = INT32_MAX; + BACKEND_EXPORT inline static unsigned int starting_graph_id = INT32_MAX; }; } // namespace mindspore #endif // MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_E_2_E_DUMP_UTIL_H_ diff --git a/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.cc b/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.cc index ab5b1437151..380dcc184bf 100644 --- a/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.cc +++ b/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.cc @@ -19,7 +19,7 @@ #include #include #include "utils/file_utils.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "debug/debug_services.h" #include "debug/debugger/debugger.h" diff --git a/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.h b/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.h index db72b0f7faa..971e4d0dc42 100644 --- a/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.h +++ b/mindspore/ccsrc/debug/data_dump/tensor_stat_dump.h @@ -63,9 +63,6 @@ class TensorStatDump { const Debugger *debugger); private: - static const char CSV_HEADER[]; - static const char CSV_FILE_NAME[]; - const std::string op_type_; const std::string op_name_; const std::string task_id_; diff --git a/mindspore/ccsrc/debug/debug_services.cc b/mindspore/ccsrc/debug/debug_services.cc index 78cdd70da0f..2927a1a3ca8 100644 --- a/mindspore/ccsrc/debug/debug_services.cc +++ b/mindspore/ccsrc/debug/debug_services.cc @@ -31,10 +31,9 @@ #include "pybind11/embed.h" #include "pybind11/stl.h" #ifdef ONLINE_DBG_MODE -#include "debug/common.h" +#include "include/common/debug/common.h" #include "debug/debugger/debugger.h" -#include "debug/anf_ir_utils.h" -#include "backend/common/session/anf_runtime_algorithm.h" +#include "include/common/debug/anf_dump_utils.h" #include "include/common/utils/anfalgo.h" #endif #include "debug/utils.h" diff --git a/mindspore/ccsrc/debug/debugger/debugger.cc b/mindspore/ccsrc/debug/debugger/debugger.cc index 2fdb5f3a3d4..7ef6236c455 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.cc +++ b/mindspore/ccsrc/debug/debugger/debugger.cc @@ -27,18 +27,18 @@ #include #include "debug/debugger/debugger.h" #include "debug/data_dump/dump_json_parser.h" -#include "pipeline/jit/pipeline.h" +#include "backend/common/session/session_basic.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "runtime/device/kernel_runtime_manager.h" #include "runtime/device/kernel_runtime.h" #include "debug/data_dump/e2e_dump.h" #include "include/common/utils/config_manager.h" -#include "debug/env_config_parser.h" +#include "include/common/debug/env_config_parser.h" #include "include/common/utils/comm_manager.h" #include "runtime/hardware/device_context_manager.h" -#include "debug/anf_ir_dump.h" -#include "debug/anf_ir_utils.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/anf_dump_utils.h" #include "runtime/graph_scheduler/device_tensor_store.h" #ifdef ENABLE_DEBUGGER #include "debug/debugger/proto_exporter.h" @@ -64,8 +64,6 @@ namespace mindspore { static constexpr auto g_chunk_size = 1024 * 1024 * 3; static constexpr int32_t heartbeat_period_second = 30; -DebuggerPtr Debugger::debugger_ = nullptr; -std::mutex Debugger::instance_lock_; Debugger::Debugger() : grpc_client_(nullptr), @@ -423,7 +421,7 @@ void Debugger::PreExecute(const KernelGraphPtr &graph_ptr) { // Multiple graph, and not the initial step, // stop only when receive the first sub run graph for each step for old runtime // if we have stopped for the last kernel before, no need to stop again - if (pipeline::GraphExecutorPy::GetDebugTerminate()) { + if (Common::GetDebugTerminate()) { return; } if (!(run_level_ == "node" && suspended_at_last_kernel_)) { @@ -595,7 +593,7 @@ void Debugger::PostExecuteGraphDebugger() { void Debugger::PostExecute() { // access lock for public method std::lock_guard a_lock(access_lock_); - if (pipeline::GraphExecutorPy::GetDebugTerminate()) { + if (Common::GetDebugTerminate()) { return; } if (debugger_ && debugger_->DebuggerBackendEnabled()) { @@ -648,7 +646,7 @@ bool Debugger::ReadNodeDataRequired(const CNodePtr &kernel) const { void Debugger::PostExecuteNode(const CNodePtr &kernel, bool last_kernel) { // access lock for public method std::lock_guard a_lock(access_lock_); - if (pipeline::GraphExecutorPy::GetDebugTerminate()) { + if (Common::GetDebugTerminate()) { return; } if (debugger_enabled_ && !is_dataset_graph_) { @@ -1278,7 +1276,7 @@ void Debugger::Exit(bool exit_success) { // debugger will notify main thread to exit because main thread can only exit at step boundary. MS_LOG(INFO) << "Exit Debugger"; SetEnableHeartbeat(false); - pipeline::GraphExecutorPy::DebugTerminate(true, exit_success); + Common::DebugTerminate(true, exit_success); } std::list Debugger::CheckWatchpoints(const std::string &watchnode, const CNodePtr &kernel, diff --git a/mindspore/ccsrc/debug/debugger/debugger.h b/mindspore/ccsrc/debug/debugger/debugger.h index 7c088f39bd2..8c32e39b489 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.h +++ b/mindspore/ccsrc/debug/debugger/debugger.h @@ -30,6 +30,7 @@ #include "debug/dump_data_builder.h" #endif #include "runtime/device/device_address.h" +#include "include/backend/visible.h" using debugger::Chunk; using debugger::DataType; @@ -61,7 +62,7 @@ enum class DebuggerCommand { kUnknownCMD = -1 }; -class Debugger : public std::enable_shared_from_this { +class BACKEND_EXPORT Debugger : public std::enable_shared_from_this { public: static std::shared_ptr GetInstance() { std::lock_guard i_lock(instance_lock_); @@ -331,8 +332,8 @@ class Debugger : public std::enable_shared_from_this { #endif // singleton - static std::mutex instance_lock_; - static std::shared_ptr debugger_; + inline static std::mutex instance_lock_ = {}; + inline static std::shared_ptr debugger_ = nullptr; uint32_t not_dataset_graph_sum_; std::list rungraph_id_list_; bool ascend_kernel_by_kernel_; diff --git a/mindspore/ccsrc/debug/debugger/debugger_utils.cc b/mindspore/ccsrc/debug/debugger/debugger_utils.cc index e5a927b10ed..7652f09eeca 100644 --- a/mindspore/ccsrc/debug/debugger/debugger_utils.cc +++ b/mindspore/ccsrc/debug/debugger/debugger_utils.cc @@ -19,7 +19,7 @@ #include #include #include -#include "debug/anf_ir_utils.h" +#include "include/common/debug/anf_dump_utils.h" #include "debug/debugger/debugger.h" #include "plugin/device/gpu/hal/device/gpu_device_address.h" #include "debug/data_dump/dump_json_parser.h" diff --git a/mindspore/ccsrc/debug/debugger/proto_exporter.cc b/mindspore/ccsrc/debug/debugger/proto_exporter.cc index 9e2f97d514e..b928cc56851 100644 --- a/mindspore/ccsrc/debug/debugger/proto_exporter.cc +++ b/mindspore/ccsrc/debug/debugger/proto_exporter.cc @@ -23,9 +23,9 @@ #include "utils/hash_map.h" #include "utils/hash_set.h" -#include "debug/anf_ir_utils.h" +#include "include/common/debug/anf_dump_utils.h" #include "debug/data_dump/dump_utils.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "debug/debugger/debugger.h" #include "debug/data_dump/dump_json_parser.h" #include "proto/debug_graph.pb.h" diff --git a/mindspore/ccsrc/debug/debugger/proto_exporter.h b/mindspore/ccsrc/debug/debugger/proto_exporter.h index 21dd6ce936c..05d40b27ec9 100644 --- a/mindspore/ccsrc/debug/debugger/proto_exporter.h +++ b/mindspore/ccsrc/debug/debugger/proto_exporter.h @@ -20,7 +20,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "debug/data_dump/dump_json_parser.h" #include "ir/graph_utils.h" #include "proto/debug_graph.pb.h" diff --git a/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.cc b/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.cc index 6326bd6405c..f013cdc9224 100644 --- a/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.cc +++ b/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.cc @@ -15,11 +15,12 @@ */ #include "debug/rdr/graph_exec_order_recorder.h" #include +#include #include "mindspore/core/ir/anf.h" #include "mindspore/core/utils/log_adapter.h" #include "backend/common/session/anf_runtime_algorithm.h" -#include "include/common/utils/anfalgo.h" #include "include/common/utils/utils.h" +#include "include/common/debug/rdr/recorder_manager.h" namespace mindspore { namespace { @@ -56,4 +57,18 @@ void GraphExecOrderRecorder::Export() { std::string real_file_path = realpath.value() + ".txt"; DumpGraphExeOrder(real_file_path, exec_order_); } + +namespace RDR { +bool RecordGraphExecOrder(const SubModuleId module, const std::string &name, + const std::vector &final_exec_order) { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return false; + } + std::string submodule_name = std::string(GetSubModuleName(module)); + GraphExecOrderRecorderPtr graph_exec_order_recorder = + std::make_shared(submodule_name, name, final_exec_order); + bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(graph_exec_order_recorder)); + return ans; +} +} // namespace RDR } // namespace mindspore diff --git a/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.h b/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.h index b4c4440ee74..984dd73e328 100644 --- a/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.h +++ b/mindspore/ccsrc/debug/rdr/graph_exec_order_recorder.h @@ -19,7 +19,7 @@ #include #include -#include "debug/rdr/base_recorder.h" +#include "include/common/debug/rdr/base_recorder.h" namespace mindspore { class GraphExecOrderRecorder : public BaseRecorder { @@ -36,5 +36,10 @@ class GraphExecOrderRecorder : public BaseRecorder { std::vector exec_order_; }; using GraphExecOrderRecorderPtr = std::shared_ptr; + +namespace RDR { +bool RecordGraphExecOrder(const SubModuleId module, const std::string &name, + const std::vector &final_exec_order); +} // namespace RDR } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_RDR_GRAPH_EXEC_ORDER_RECORDER_H_ diff --git a/mindspore/ccsrc/debug/rdr/graph_recorder.cc b/mindspore/ccsrc/debug/rdr/graph_recorder.cc index 4e96372fb4f..be6cb48f504 100644 --- a/mindspore/ccsrc/debug/rdr/graph_recorder.cc +++ b/mindspore/ccsrc/debug/rdr/graph_recorder.cc @@ -14,14 +14,16 @@ * limitations under the License. */ #include "debug/rdr/graph_recorder.h" +#include +#include #include "mindspore/core/base/base.h" -#include "mindspore/core/ir/func_graph.h" #include "backend/common/session/kernel_graph.h" #include "mindspore/core/utils/log_adapter.h" -#include "debug/anf_ir_dump.h" -#include "debug/anf_ir_utils.h" -#include "debug/dump_proto.h" -#include "debug/common.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/anf_dump_utils.h" +#include "include/common/debug/dump_proto.h" +#include "include/common/debug/common.h" +#include "include/common/debug/rdr/recorder_manager.h" namespace mindspore { namespace protobuf { @@ -64,11 +66,7 @@ void GraphRecorder::Export() { std::string realpath = tmp_realpath.value(); if (graph_type_.find(".dat") != std::string::npos) { save_flag = true; - AnfExporter exporter(""); - std::string realpath_dat = realpath + ".dat"; - ChangeFileMode(realpath_dat, S_IRWXU); - exporter.ExportFuncGraph(realpath_dat, func_graph_); - ChangeFileMode(realpath_dat, S_IRUSR); + AnfDumpHandler::DumpDat(realpath, func_graph_); } if (graph_type_.find(".ir") != std::string::npos) { save_flag = true; @@ -90,4 +88,18 @@ void GraphRecorder::Export() { MS_LOG(WARNING) << "Unknown save graph type: " << graph_type_; } } + +namespace RDR { +bool RecordAnfGraph(const SubModuleId module, const std::string &name, const FuncGraphPtr &graph, + const DumpGraphParams &info, const std::string &file_type) { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return false; + } + std::string submodule_name = std::string(GetSubModuleName(module)); + GraphRecorderPtr graph_recorder = std::make_shared(submodule_name, name, graph, file_type); + graph_recorder->SetDumpFlag(info); + bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(graph_recorder)); + return ans; +} +} // namespace RDR } // namespace mindspore diff --git a/mindspore/ccsrc/debug/rdr/graph_recorder.h b/mindspore/ccsrc/debug/rdr/graph_recorder.h index 3d532b36461..4f98bb3a59f 100644 --- a/mindspore/ccsrc/debug/rdr/graph_recorder.h +++ b/mindspore/ccsrc/debug/rdr/graph_recorder.h @@ -19,7 +19,8 @@ #include #include -#include "debug/rdr/base_recorder.h" +#include "include/common/debug/rdr/base_recorder.h" +#include "include/backend/visible.h" namespace mindspore { struct DumpGraphParams { @@ -45,5 +46,10 @@ class GraphRecorder : public BaseRecorder { DumpGraphParams dump_graph_info_{false, 0}; }; using GraphRecorderPtr = std::shared_ptr; + +namespace RDR { +BACKEND_EXPORT bool RecordAnfGraph(const SubModuleId module, const std::string &name, const FuncGraphPtr &graph, + const DumpGraphParams &info, const std::string &file_type = ".ir;.pb;.dat"); +} // namespace RDR } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_RDR_GRAPH_RECORDER_H_ diff --git a/mindspore/ccsrc/debug/rdr/mem_address_recorder.cc b/mindspore/ccsrc/debug/rdr/mem_address_recorder.cc index 465c79c2615..1fc4a63f28c 100644 --- a/mindspore/ccsrc/debug/rdr/mem_address_recorder.cc +++ b/mindspore/ccsrc/debug/rdr/mem_address_recorder.cc @@ -16,7 +16,9 @@ #include "debug/rdr/mem_address_recorder.h" #include #include +#include #include "kernel/kernel.h" +#include "include/common/debug/rdr/recorder_manager.h" namespace mindspore { namespace { @@ -76,4 +78,48 @@ void MemAddressRecorder::CleanUp() { mem_info_stream_.str(""); printed_ = false; } + +namespace RDR { +bool RecordMemAddressInfo(const SubModuleId module, const std::string &name) { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return false; + } + std::string submodule_name = std::string(GetSubModuleName(module)); + MemAddressRecorderPtr mem_info_recorder = std::make_shared(submodule_name, name); + mem_info_recorder->Reset(); + bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(mem_info_recorder)); + return ans; +} + +bool UpdateMemAddress(const SubModuleId module, const std::string &name, const std::string &op_name, + const kernel::KernelLaunchInfo &mem_info) { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return false; + } + std::string submodule_name = std::string(GetSubModuleName(module)); + auto recorder = mindspore::RecorderManager::Instance().GetRecorder(submodule_name, name); + bool ans = false; + if (recorder != nullptr) { + auto mem_recorder = std::dynamic_pointer_cast(recorder); + mem_recorder->SaveMemInfo(op_name, mem_info); + ans = true; + } + return ans; +} + +void ClearMemAddressInfo() { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return; + } + if (RecorderManager::Instance().CheckRdrMemIsRecord()) { + std::string name = "mem_address_list"; + std::string submodule_name = "KERNEL"; + auto recorder = RecorderManager::Instance().GetRecorder(submodule_name, name); + if (recorder != nullptr) { + auto mem_recorder = std::dynamic_pointer_cast(recorder); + mem_recorder->CleanUp(); + } + } +} +} // namespace RDR } // namespace mindspore diff --git a/mindspore/ccsrc/debug/rdr/mem_address_recorder.h b/mindspore/ccsrc/debug/rdr/mem_address_recorder.h index 5cf2baa032e..1e1964fb6f5 100644 --- a/mindspore/ccsrc/debug/rdr/mem_address_recorder.h +++ b/mindspore/ccsrc/debug/rdr/mem_address_recorder.h @@ -22,7 +22,7 @@ #include #include -#include "debug/rdr/base_recorder.h" +#include "include/common/debug/rdr/base_recorder.h" namespace mindspore { namespace kernel { @@ -59,5 +59,12 @@ class MemAddressRecorder : public BaseRecorder { std::ostringstream mem_info_stream_; }; using MemAddressRecorderPtr = std::shared_ptr; + +namespace RDR { +bool RecordMemAddressInfo(const SubModuleId module, const std::string &name); +bool UpdateMemAddress(const SubModuleId module, const std::string &name, const std::string &op_name, + const kernel::KernelLaunchInfo &mem_info); +void ClearMemAddressInfo(); +} // namespace RDR } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_RDR_MEM_ADDRESS_RECORDER_H_ diff --git a/mindspore/ccsrc/debug/rdr/running_data_recorder.cc b/mindspore/ccsrc/debug/rdr/running_data_recorder.cc deleted file mode 100644 index ca223de519b..00000000000 --- a/mindspore/ccsrc/debug/rdr/running_data_recorder.cc +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "debug/rdr/running_data_recorder.h" -#include - -#include "debug/rdr/graph_exec_order_recorder.h" -#include "debug/rdr/recorder_manager.h" -#include "debug/rdr/string_recorder.h" -#include "debug/rdr/stream_exec_order_recorder.h" -#include "debug/rdr/mem_address_recorder.h" -#include "mindspore/core/ir/func_graph.h" -#include "mindspore/core/ir/anf.h" -#include "kernel/kernel.h" -#ifdef ENABLE_D -#include "plugin/device/ascend/hal/device/tasksink/task_generator.h" -#include "debug/rdr/task_debug_info_recorder.h" -#endif // ENABLE_D -namespace mindspore { -namespace RDR { -#ifdef ENABLE_D -bool RecordTaskDebugInfo(SubModuleId module, const std::string &name, - const std::vector &task_debug_info_list) { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return false; - } - std::string submodule_name = std::string(GetSubModuleName(module)); - TaskDebugInfoRecorderPtr task_debug_info_recorder = - std::make_shared(submodule_name, name, task_debug_info_list); - bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(task_debug_info_recorder)); - return ans; -} -#endif // ENABLE_D - -bool RecordAnfGraph(const SubModuleId module, const std::string &name, const FuncGraphPtr &graph, - const DumpGraphParams &info, const std::string &file_type) { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return false; - } - std::string submodule_name = std::string(GetSubModuleName(module)); - GraphRecorderPtr graph_recorder = std::make_shared(submodule_name, name, graph, file_type); - graph_recorder->SetDumpFlag(info); - bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(graph_recorder)); - return ans; -} - -bool RecordGraphExecOrder(const SubModuleId module, const std::string &name, - const std::vector &final_exec_order) { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return false; - } - std::string submodule_name = std::string(GetSubModuleName(module)); - GraphExecOrderRecorderPtr graph_exec_order_recorder = - std::make_shared(submodule_name, name, final_exec_order); - bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(graph_exec_order_recorder)); - return ans; -} - -bool RecordString(SubModuleId module, const std::string &name, const std::string &data) { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return false; - } - std::string submodule_name = std::string(GetSubModuleName(module)); - StringRecorderPtr string_recorder = std::make_shared(submodule_name, name, data); - bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(string_recorder)); - return ans; -} - -bool RecordStreamExecOrder(const SubModuleId module, const std::string &name, const std::vector &exec_order) { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return false; - } - std::string submodule_name = std::string(GetSubModuleName(module)); - StreamExecOrderRecorderPtr stream_exec_order_recorder = - std::make_shared(submodule_name, name, exec_order); - bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(stream_exec_order_recorder)); - return ans; -} - -bool RecordMemAddressInfo(const SubModuleId module, const std::string &name) { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return false; - } - std::string submodule_name = std::string(GetSubModuleName(module)); - MemAddressRecorderPtr mem_info_recorder = std::make_shared(submodule_name, name); - mem_info_recorder->Reset(); - bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(mem_info_recorder)); - return ans; -} - -bool UpdateMemAddress(const SubModuleId module, const std::string &name, const std::string &op_name, - const kernel::KernelLaunchInfo &mem_info) { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return false; - } - std::string submodule_name = std::string(GetSubModuleName(module)); - auto recorder = mindspore::RecorderManager::Instance().GetRecorder(submodule_name, name); - bool ans = false; - if (recorder != nullptr) { - auto mem_recorder = std::dynamic_pointer_cast(recorder); - mem_recorder->SaveMemInfo(op_name, mem_info); - ans = true; - } - return ans; -} - -void TriggerAll() { mindspore::RecorderManager::Instance().TriggerAll(); } - -void Snapshot() { mindspore::RecorderManager::Instance().Snapshot(); } - -void ResetRecorder() { mindspore::RecorderManager::Instance().ClearAll(); } - -void ClearMemAddressInfo() { - if (!mindspore::RecorderManager::Instance().RdrEnable()) { - return; - } - if (RecorderManager::Instance().CheckRdrMemIsRecord()) { - std::string name = "mem_address_list"; - std::string submodule_name = "KERNEL"; - auto recorder = RecorderManager::Instance().GetRecorder(submodule_name, name); - if (recorder != nullptr) { - auto mem_recorder = std::dynamic_pointer_cast(recorder); - mem_recorder->CleanUp(); - } - } -} -} // namespace RDR -} // namespace mindspore diff --git a/mindspore/ccsrc/debug/rdr/running_data_recorder.h b/mindspore/ccsrc/debug/rdr/running_data_recorder.h deleted file mode 100644 index ea94a0f8bf8..00000000000 --- a/mindspore/ccsrc/debug/rdr/running_data_recorder.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_DEBUG_RDR_RUNNING_DATA_RECORDER_H_ -#define MINDSPORE_CCSRC_DEBUG_RDR_RUNNING_DATA_RECORDER_H_ -#include -#include -#include - -#include "mindspore/core/utils/log_adapter.h" -#include "debug/rdr/graph_recorder.h" - -namespace mindspore { -namespace kernel { -class Address; -struct KernelLaunchInfo; -using AddressPtr = std::shared_ptr
; -} // namespace kernel -using AddressPtrList = std::vector; -struct MemInfo; -#ifdef ENABLE_D -namespace device { -namespace ascend { -namespace tasksink { -class TaskDebugInfo; -} // namespace tasksink -} // namespace ascend -} // namespace device -using TaskDebugInfoPtr = std::shared_ptr; -#endif // ENABLE_D - -namespace RDR { -bool RecordAnfGraph(const SubModuleId module, const std::string &name, const FuncGraphPtr &graph, - const DumpGraphParams &info, const std::string &file_type = ".ir;.pb;.dat"); -bool RecordGraphExecOrder(const SubModuleId module, const std::string &name, - const std::vector &final_exec_order); -bool RecordString(SubModuleId module, const std::string &name, const std::string &data); -bool RecordStreamExecOrder(const SubModuleId module, const std::string &name, const std::vector &exec_order); -bool RecordMemAddressInfo(const SubModuleId module, const std::string &name); -bool UpdateMemAddress(const SubModuleId module, const std::string &name, const std::string &op_name, - const kernel::KernelLaunchInfo &mem_info); -#ifdef ENABLE_D -bool RecordTaskDebugInfo(SubModuleId module, const std::string &name, - const std::vector &task_debug_info_list); -#endif // ENABLE_D -void TriggerAll(); -void Snapshot(); -void ResetRecorder(); -void ClearMemAddressInfo(); -} // namespace RDR -} // namespace mindspore -#endif // MINDSPORE_CCSRC_DEBUG_RDR_RUNNING_DATA_RECORDER_H_ diff --git a/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.cc b/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.cc index 71a42a93981..149e3575e27 100644 --- a/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.cc +++ b/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.cc @@ -21,6 +21,7 @@ #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "include/common/utils/utils.h" +#include "include/common/debug/rdr/recorder_manager.h" namespace mindspore { std::string Vector2String(const std::vector &v) { @@ -70,4 +71,17 @@ void StreamExecOrderRecorder::Export() { fout.close(); ChangeFileMode(real_file_path, S_IRUSR); } + +namespace RDR { +bool RecordStreamExecOrder(const SubModuleId module, const std::string &name, const std::vector &exec_order) { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return false; + } + std::string submodule_name = std::string(GetSubModuleName(module)); + StreamExecOrderRecorderPtr stream_exec_order_recorder = + std::make_shared(submodule_name, name, exec_order); + bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(stream_exec_order_recorder)); + return ans; +} +} // namespace RDR } // namespace mindspore diff --git a/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.h b/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.h index 68662bfe905..e4056178c2d 100644 --- a/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.h +++ b/mindspore/ccsrc/debug/rdr/stream_exec_order_recorder.h @@ -22,7 +22,7 @@ #include "nlohmann/json.hpp" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" -#include "debug/rdr/base_recorder.h" +#include "include/common/debug/rdr/base_recorder.h" using json = nlohmann::json; @@ -98,5 +98,8 @@ class StreamExecOrderRecorder : public BaseRecorder { std::vector exec_order_; }; using StreamExecOrderRecorderPtr = std::shared_ptr; +namespace RDR { +bool RecordStreamExecOrder(const SubModuleId module, const std::string &name, const std::vector &exec_order); +} // namespace RDR } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_RDR_STREAM_EXEC_ORDER_RECORDER_H_ diff --git a/mindspore/ccsrc/debug/rdr/string_recorder.cc b/mindspore/ccsrc/debug/rdr/string_recorder.cc index 1e9421a8a4a..fcadf700038 100644 --- a/mindspore/ccsrc/debug/rdr/string_recorder.cc +++ b/mindspore/ccsrc/debug/rdr/string_recorder.cc @@ -16,9 +16,10 @@ #include "debug/rdr/string_recorder.h" #include #include -#include "debug/common.h" +#include #include "include/common/utils/utils.h" #include "mindspore/core/utils/log_adapter.h" +#include "include/common/debug/rdr/recorder_manager.h" namespace mindspore { void StringRecorder::Export() { @@ -38,4 +39,16 @@ void StringRecorder::Export() { // set file mode to read only by user ChangeFileMode(file_path, S_IRUSR); } + +namespace RDR { +bool RecordString(SubModuleId module, const std::string &name, const std::string &data) { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return false; + } + std::string submodule_name = std::string(GetSubModuleName(module)); + StringRecorderPtr string_recorder = std::make_shared(submodule_name, name, data); + bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(string_recorder)); + return ans; +} +} // namespace RDR } // namespace mindspore diff --git a/mindspore/ccsrc/debug/rdr/string_recorder.h b/mindspore/ccsrc/debug/rdr/string_recorder.h index f21c400878f..64f73b0e7a8 100644 --- a/mindspore/ccsrc/debug/rdr/string_recorder.h +++ b/mindspore/ccsrc/debug/rdr/string_recorder.h @@ -19,7 +19,7 @@ #include #include -#include "debug/rdr/base_recorder.h" +#include "include/common/debug/rdr/base_recorder.h" namespace mindspore { class StringRecorder : public BaseRecorder { public: @@ -33,5 +33,8 @@ class StringRecorder : public BaseRecorder { std::string data_; }; using StringRecorderPtr = std::shared_ptr; +namespace RDR { +bool RecordString(SubModuleId module, const std::string &name, const std::string &data); +} // namespace RDR } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_RDR_STRING_RECORDER_H_ diff --git a/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.cc b/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.cc index bd76f908407..54b4decd5c9 100644 --- a/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.cc +++ b/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.cc @@ -14,7 +14,9 @@ * limitations under the License. */ #include "debug/rdr/task_debug_info_recorder.h" +#include #include "plugin/device/ascend/hal/device/tasksink/task_generator.h" +#include "include/common/debug/rdr/recorder_manager.h" namespace mindspore { void TaskDebugInfoRecorder::Export() { @@ -25,4 +27,18 @@ void TaskDebugInfoRecorder::Export() { std::string file_path = realpath.value() + ".ir"; device::ascend::tasksink::TaskGenerator::DumpTaskInfo(file_path, task_debug_info_); } + +namespace RDR { +bool RecordTaskDebugInfo(SubModuleId module, const std::string &name, + const std::vector &task_debug_info_list) { + if (!mindspore::RecorderManager::Instance().RdrEnable()) { + return false; + } + std::string submodule_name = std::string(GetSubModuleName(module)); + TaskDebugInfoRecorderPtr task_debug_info_recorder = + std::make_shared(submodule_name, name, task_debug_info_list); + bool ans = mindspore::RecorderManager::Instance().RecordObject(std::move(task_debug_info_recorder)); + return ans; +} +} // namespace RDR } // namespace mindspore diff --git a/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.h b/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.h index b2dc44ad8e2..be538823885 100644 --- a/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.h +++ b/mindspore/ccsrc/debug/rdr/task_debug_info_recorder.h @@ -19,7 +19,7 @@ #include #include -#include "debug/rdr/base_recorder.h" +#include "include/common/debug/rdr/base_recorder.h" namespace mindspore { namespace device { @@ -44,5 +44,9 @@ class TaskDebugInfoRecorder : public BaseRecorder { std::vector task_debug_info_; }; using TaskDebugInfoRecorderPtr = std::shared_ptr; +namespace RDR { +bool RecordTaskDebugInfo(SubModuleId module, const std::string &name, + const std::vector &task_debug_info_list); +} // namespace RDR } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_RDR_TASK_DEBUG_INFO_RECORDER_H_ diff --git a/mindspore/ccsrc/distributed/cluster/cluster_context.cc b/mindspore/ccsrc/distributed/cluster/cluster_context.cc index dd3cf580e13..f537066694a 100644 --- a/mindspore/ccsrc/distributed/cluster/cluster_context.cc +++ b/mindspore/ccsrc/distributed/cluster/cluster_context.cc @@ -22,7 +22,7 @@ #include "distributed/collective/collective_manager.h" #include "utils/ms_context.h" #include "ps/ps_context.h" -#include "debug/common.h" +#include "include/common/debug/common.h" namespace mindspore { namespace distributed { diff --git a/mindspore/ccsrc/distributed/cluster/cluster_context.h b/mindspore/ccsrc/distributed/cluster/cluster_context.h index 1f05a4ec70b..52df4221668 100644 --- a/mindspore/ccsrc/distributed/cluster/cluster_context.h +++ b/mindspore/ccsrc/distributed/cluster/cluster_context.h @@ -37,6 +37,7 @@ #include "ps/core/ps_server_node.h" #include "ps/core/ps_scheduler_node.h" #include "distributed/cluster/actor_route_table_proxy.h" +#include "include/backend/visible.h" namespace mindspore { namespace distributed { @@ -49,7 +50,7 @@ constexpr char kDetailedFailureReason[] = "https://www.mindspore.cn/docs/programming_guide/zh-CN/master/distributed_training_gpu.html#openmpi."; // Node role based cluster built by MindSpore communication framework. -class ClusterContext { +class BACKEND_EXPORT ClusterContext { public: ~ClusterContext(); DISABLE_COPY_AND_ASSIGN(ClusterContext) diff --git a/mindspore/ccsrc/distributed/collective/collective_manager.h b/mindspore/ccsrc/distributed/collective/collective_manager.h index 0e7511c7461..b0404a6b5ce 100644 --- a/mindspore/ccsrc/distributed/collective/collective_manager.h +++ b/mindspore/ccsrc/distributed/collective/collective_manager.h @@ -24,6 +24,7 @@ #include "utils/ms_utils.h" #include "distributed/constants.h" #include "runtime/hardware/device_context_manager.h" +#include "include/backend/visible.h" namespace mindspore { namespace distributed { @@ -37,7 +38,7 @@ using CommunicationGroupPtr = device::CommunicationGroupPtr; // The collective communication API. // MindSpore uses OpenMPI on CPU, NCCL on GPU, HCCL on Ascend, to achieve distributed training. // Besides, MindSpore also has its own communication library which is implemented on the CPU side. -class CollectiveManager { +class BACKEND_EXPORT CollectiveManager { public: ~CollectiveManager(); DISABLE_COPY_AND_ASSIGN(CollectiveManager); diff --git a/mindspore/ccsrc/distributed/init.h b/mindspore/ccsrc/distributed/init.h index 60d60c5a16e..8926f0535ac 100644 --- a/mindspore/ccsrc/distributed/init.h +++ b/mindspore/ccsrc/distributed/init.h @@ -25,13 +25,14 @@ #else #include "distributed/cluster/dummy_cluster_context.h" #endif +#include "include/backend/visible.h" namespace mindspore { namespace distributed { // The static methods of MindSpore distributed execution. They can be exported by Pybind. // Initialize and finalize distributed execution. -bool Initialize(); +BACKEND_EXPORT bool Initialize(); bool Finalize(); // Initialize and finalize the cluster based on MindSpore communication framework. diff --git a/mindspore/ccsrc/fl/server/iteration_metrics.cc b/mindspore/ccsrc/fl/server/iteration_metrics.cc index 8a31729dd05..9f4177186fc 100644 --- a/mindspore/ccsrc/fl/server/iteration_metrics.cc +++ b/mindspore/ccsrc/fl/server/iteration_metrics.cc @@ -18,7 +18,7 @@ #include #include #include "utils/file_utils.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "ps/constants.h" namespace mindspore { diff --git a/mindspore/ccsrc/fl/server/server.cc b/mindspore/ccsrc/fl/server/server.cc index d1cb8ce6c38..51f8ca161f2 100644 --- a/mindspore/ccsrc/fl/server/server.cc +++ b/mindspore/ccsrc/fl/server/server.cc @@ -49,6 +49,11 @@ void SignalHandler(int signal) { (void)g_communicator_with_server->Stop(); } +Server &Server::GetInstance() { + static Server instance; + return instance; +} + void Server::Initialize(bool use_tcp, bool use_http, uint16_t http_port, const std::vector &rounds_config, const CipherConfig &cipher_config, const FuncGraphPtr &func_graph, size_t executor_threshold) { MS_EXCEPTION_IF_NULL(func_graph); diff --git a/mindspore/ccsrc/fl/server/server.h b/mindspore/ccsrc/fl/server/server.h index d979856c3e4..fa109526fd5 100644 --- a/mindspore/ccsrc/fl/server/server.h +++ b/mindspore/ccsrc/fl/server/server.h @@ -30,6 +30,7 @@ #include "fl/server/common.h" #include "fl/server/executor.h" #include "fl/server/iteration.h" +#include "include/backend/visible.h" namespace mindspore { namespace fl { @@ -38,12 +39,9 @@ namespace server { constexpr uint32_t kServerSleepTimeForNetworking = 1000; constexpr uint64_t kDefaultReplayAttackTimeDiff = 600000; // Class Server is the entrance of MindSpore's parameter server training mode and federated learning. -class Server { +class BACKEND_EXPORT Server { public: - static Server &GetInstance() { - static Server instance; - return instance; - } + static Server &GetInstance(); void Initialize(bool use_tcp, bool use_http, uint16_t http_port, const std::vector &rounds_config, const CipherConfig &cipher_config, const FuncGraphPtr &func_graph, size_t executor_threshold); diff --git a/mindspore/ccsrc/fl/server/server_recovery.cc b/mindspore/ccsrc/fl/server/server_recovery.cc index abfebe25ea7..1cf45a25992 100644 --- a/mindspore/ccsrc/fl/server/server_recovery.cc +++ b/mindspore/ccsrc/fl/server/server_recovery.cc @@ -16,7 +16,7 @@ #include "fl/server/server_recovery.h" #include "fl/server/local_meta_store.h" -#include "debug/common.h" +#include "include/common/debug/common.h" namespace mindspore { namespace fl { diff --git a/mindspore/ccsrc/fl/worker/fl_worker.cc b/mindspore/ccsrc/fl/worker/fl_worker.cc index 4c360b307b7..d61914c4d15 100644 --- a/mindspore/ccsrc/fl/worker/fl_worker.cc +++ b/mindspore/ccsrc/fl/worker/fl_worker.cc @@ -25,6 +25,11 @@ namespace mindspore { namespace fl { namespace worker { +FLWorker &FLWorker::GetInstance() { + static FLWorker instance; + return instance; +} + void FLWorker::Run() { if (running_.load()) { return; diff --git a/mindspore/ccsrc/fl/worker/fl_worker.h b/mindspore/ccsrc/fl/worker/fl_worker.h index 19460707226..a0376f29b37 100644 --- a/mindspore/ccsrc/fl/worker/fl_worker.h +++ b/mindspore/ccsrc/fl/worker/fl_worker.h @@ -28,6 +28,7 @@ #include "ps/core/worker_node.h" #include "ps/core/cluster_metadata.h" #include "ps/core/communicator/tcp_communicator.h" +#include "include/backend/visible.h" struct EncryptPublicKeys { std::string flID; @@ -67,12 +68,9 @@ enum class IterationState { namespace worker { // This class is used for hybrid training mode for now. In later version, parameter server mode will also use this class // as worker. -class FLWorker { +class BACKEND_EXPORT FLWorker { public: - static FLWorker &GetInstance() { - static FLWorker instance; - return instance; - } + static FLWorker &GetInstance(); void Run(); void Finalize(); bool SendToServer(uint32_t server_rank, const void *data, size_t size, ps::core::TcpUserCommand command, diff --git a/mindspore/ccsrc/frontend/operator/composite/composite.cc b/mindspore/ccsrc/frontend/operator/composite/composite.cc index ead61513eb2..844b4342f68 100644 --- a/mindspore/ccsrc/frontend/operator/composite/composite.cc +++ b/mindspore/ccsrc/frontend/operator/composite/composite.cc @@ -28,9 +28,9 @@ #include "frontend/operator/cc_implementations.h" #include "frontend/optimizer/opt.h" #include "utils/symbolic.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "ir/signature.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "utils/ms_context.h" #include "include/common/utils/utils.h" diff --git a/mindspore/ccsrc/frontend/operator/composite/do_signature.cc b/mindspore/ccsrc/frontend/operator/composite/do_signature.cc index de2f8761fb1..4a1a61e24db 100644 --- a/mindspore/ccsrc/frontend/operator/composite/do_signature.cc +++ b/mindspore/ccsrc/frontend/operator/composite/do_signature.cc @@ -25,7 +25,7 @@ #include "abstract/param_validator.h" #include "frontend/operator/cc_implementations.h" #include "frontend/optimizer/opt.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // namespace to support composite operators definition diff --git a/mindspore/ccsrc/frontend/operator/composite/list_append_operation.cc b/mindspore/ccsrc/frontend/operator/composite/list_append_operation.cc index 40232cb24e1..61c361bc263 100644 --- a/mindspore/ccsrc/frontend/operator/composite/list_append_operation.cc +++ b/mindspore/ccsrc/frontend/operator/composite/list_append_operation.cc @@ -22,7 +22,7 @@ #include "abstract/param_validator.h" #include "frontend/optimizer/opt.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // namespace to support composite operators definition diff --git a/mindspore/ccsrc/frontend/operator/composite/list_insert_operation.cc b/mindspore/ccsrc/frontend/operator/composite/list_insert_operation.cc index ce6204c22b9..0585b58aa39 100644 --- a/mindspore/ccsrc/frontend/operator/composite/list_insert_operation.cc +++ b/mindspore/ccsrc/frontend/operator/composite/list_insert_operation.cc @@ -22,7 +22,7 @@ #include "abstract/param_validator.h" #include "frontend/optimizer/opt.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // namespace to support composite operators definition diff --git a/mindspore/ccsrc/frontend/operator/composite/map.cc b/mindspore/ccsrc/frontend/operator/composite/map.cc index adbe704d536..7dacc9045f4 100644 --- a/mindspore/ccsrc/frontend/operator/composite/map.cc +++ b/mindspore/ccsrc/frontend/operator/composite/map.cc @@ -25,8 +25,8 @@ #include "abstract/abstract_value.h" #include "abstract/abstract_function.h" #include "abstract/dshape.h" -#include "pybind_api/api_register.h" -#include "debug/trace.h" +#include "include/common/pybind_api/api_register.h" +#include "pipeline/jit/debug/trace.h" #include "frontend/operator/ops.h" namespace mindspore { diff --git a/mindspore/ccsrc/frontend/operator/composite/multitype_funcgraph.cc b/mindspore/ccsrc/frontend/operator/composite/multitype_funcgraph.cc index 4ce9f43db63..c5ca85209d6 100644 --- a/mindspore/ccsrc/frontend/operator/composite/multitype_funcgraph.cc +++ b/mindspore/ccsrc/frontend/operator/composite/multitype_funcgraph.cc @@ -23,10 +23,10 @@ #include "abstract/dshape.h" #include "frontend/optimizer/opt.h" #include "utils/ms_context.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "ir/signature.h" #include "ir/dtype.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" namespace mindspore { // namespace to support composite operators definition diff --git a/mindspore/ccsrc/frontend/operator/composite/unpack_call.cc b/mindspore/ccsrc/frontend/operator/composite/unpack_call.cc index e8aa7bf8886..9bb035f2f6a 100644 --- a/mindspore/ccsrc/frontend/operator/composite/unpack_call.cc +++ b/mindspore/ccsrc/frontend/operator/composite/unpack_call.cc @@ -23,7 +23,7 @@ #include "frontend/operator/cc_implementations.h" #include "ir/anf.h" #include "frontend/optimizer/opt.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // namespace to support composite operators definition diff --git a/mindspore/ccsrc/frontend/operator/composite/vmap.cc b/mindspore/ccsrc/frontend/operator/composite/vmap.cc index 7d05c5f876b..c251ccc3442 100644 --- a/mindspore/ccsrc/frontend/operator/composite/vmap.cc +++ b/mindspore/ccsrc/frontend/operator/composite/vmap.cc @@ -19,7 +19,6 @@ #include #include #include "pybind11/pybind11.h" -#include "pybind_api/api_register.h" #include "ir/anf.h" #include "ir/func_graph.h" #include "base/core_ops.h" @@ -30,6 +29,7 @@ #include "pipeline/jit/parse/resolve.h" #include "pipeline/jit/pipeline.h" #include "include/common/utils/python_adapter.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // namespace to support composite operators definition diff --git a/mindspore/ccsrc/frontend/operator/composite/zip_operation.cc b/mindspore/ccsrc/frontend/operator/composite/zip_operation.cc index 3f75a456679..3ba8ab30ca8 100644 --- a/mindspore/ccsrc/frontend/operator/composite/zip_operation.cc +++ b/mindspore/ccsrc/frontend/operator/composite/zip_operation.cc @@ -24,7 +24,7 @@ #include "abstract/dshape.h" #include "frontend/operator/cc_implementations.h" #include "frontend/optimizer/opt.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // namespace to support composite operators definition diff --git a/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.cc b/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.cc index b335e8185a8..520f65a47f5 100644 --- a/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.cc +++ b/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.cc @@ -32,7 +32,7 @@ #include "pipeline/jit/action.h" #include "pipeline/jit/parse/resolve.h" #include "pipeline/pynative/pynative_execute.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace ad { diff --git a/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.h b/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.h index 80d1c5a4fa9..f73eb640fa0 100644 --- a/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.h +++ b/mindspore/ccsrc/frontend/optimizer/ad/dfunctor.h @@ -34,7 +34,7 @@ #include "frontend/optimizer/ad/adjoint.h" #include "frontend/optimizer/ad/pynative_dfunctor.h" #include "frontend/operator/ops.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "include/common/utils/utils.h" namespace mindspore { diff --git a/mindspore/ccsrc/frontend/optimizer/ad/kprim.cc b/mindspore/ccsrc/frontend/optimizer/ad/kprim.cc index cd904f2797a..41683047249 100644 --- a/mindspore/ccsrc/frontend/optimizer/ad/kprim.cc +++ b/mindspore/ccsrc/frontend/optimizer/ad/kprim.cc @@ -38,9 +38,9 @@ #include "include/common/utils/primitive_utils.h" #include "utils/ms_context.h" #include "utils/info.h" -#include "debug/trace.h" -#include "debug/common.h" -#include "debug/dump_proto.h" +#include "pipeline/jit/debug/trace.h" +#include "include/common/debug/common.h" +#include "include/common/debug/dump_proto.h" #include "mindspore/core/load_mindir/load_model.h" #include "utils/system/sha256.h" #include "utils/file_utils.h" diff --git a/mindspore/ccsrc/frontend/optimizer/ad/kpynative.cc b/mindspore/ccsrc/frontend/optimizer/ad/kpynative.cc index 3370979c60c..322d1130c05 100644 --- a/mindspore/ccsrc/frontend/optimizer/ad/kpynative.cc +++ b/mindspore/ccsrc/frontend/optimizer/ad/kpynative.cc @@ -32,8 +32,8 @@ #include "frontend/optimizer/ad/kpynative.h" #include "frontend/operator/ops.h" #include "utils/info.h" -#include "debug/anf_ir_dump.h" -#include "debug/trace.h" +#include "include/common/debug/anf_ir_dump.h" +#include "pipeline/jit/debug/trace.h" namespace mindspore { namespace ad { diff --git a/mindspore/ccsrc/frontend/optimizer/clean.cc b/mindspore/ccsrc/frontend/optimizer/clean.cc index ea196d34129..f1c572e9fb2 100644 --- a/mindspore/ccsrc/frontend/optimizer/clean.cc +++ b/mindspore/ccsrc/frontend/optimizer/clean.cc @@ -26,7 +26,7 @@ #include "abstract/abstract_value.h" #include "base/base.h" #include "base/core_ops.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "frontend/optimizer/opt.h" #include "frontend/operator/composite/composite.h" #include "ir/anf.h" diff --git a/mindspore/ccsrc/frontend/optimizer/cse_pass.h b/mindspore/ccsrc/frontend/optimizer/cse_pass.h index 194b092fa84..84edee388fc 100644 --- a/mindspore/ccsrc/frontend/optimizer/cse_pass.h +++ b/mindspore/ccsrc/frontend/optimizer/cse_pass.h @@ -23,7 +23,7 @@ #include #include "utils/hash_map.h" -#include "frontend/optimizer/cse.h" +#include "include/common/utils/cse.h" #include "frontend/optimizer/optimizer.h" diff --git a/mindspore/ccsrc/frontend/optimizer/optimizer.h b/mindspore/ccsrc/frontend/optimizer/optimizer.h index 59ae7d41dff..eccde9e4aca 100644 --- a/mindspore/ccsrc/frontend/optimizer/optimizer.h +++ b/mindspore/ccsrc/frontend/optimizer/optimizer.h @@ -27,10 +27,10 @@ #include #include -#include "debug/draw.h" -#include "debug/anf_ir_dump.h" -#include "debug/anf_ir_utils.h" -#include "debug/trace.h" +#include "include/common/debug/draw.h" +#include "include/common/debug/anf_ir_dump.h" +#include "pipeline/jit/debug/anf_ir_utils.h" +#include "pipeline/jit/debug/trace.h" #include "frontend/optimizer/opt.h" #include "pipeline/jit/resource.h" #include "pipeline/jit/action.h" diff --git a/mindspore/ccsrc/frontend/optimizer/pattern.cc b/mindspore/ccsrc/frontend/optimizer/pattern.cc index d95b5344534..6e8cc1eb5ba 100644 --- a/mindspore/ccsrc/frontend/optimizer/pattern.cc +++ b/mindspore/ccsrc/frontend/optimizer/pattern.cc @@ -14,7 +14,7 @@ * limitations under the License. */ #include "frontend/optimizer/pattern.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { namespace opt { diff --git a/mindspore/ccsrc/frontend/optimizer/py_pass.h b/mindspore/ccsrc/frontend/optimizer/py_pass.h index eaed2840f9d..baa3823d4d9 100644 --- a/mindspore/ccsrc/frontend/optimizer/py_pass.h +++ b/mindspore/ccsrc/frontend/optimizer/py_pass.h @@ -21,7 +21,7 @@ #include "utils/hash_map.h" #include "ir/anf.h" #include "frontend/optimizer/pattern.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "pybind_api/export_flags.h" namespace mindspore { diff --git a/mindspore/ccsrc/frontend/parallel/graph_util/graph_info.cc b/mindspore/ccsrc/frontend/parallel/graph_util/graph_info.cc index ec07c31b2b4..5874710c2d3 100644 --- a/mindspore/ccsrc/frontend/parallel/graph_util/graph_info.cc +++ b/mindspore/ccsrc/frontend/parallel/graph_util/graph_info.cc @@ -16,9 +16,9 @@ #include #include "frontend/parallel/graph_util/graph_info.h" -#include "debug/anf_ir_dump.h" -#include "debug/anf_ir_utils.h" -#include "debug/draw.h" +#include "include/common/debug/anf_ir_dump.h" +#include "pipeline/jit/debug/anf_ir_utils.h" +#include "include/common/debug/draw.h" #include "utils/ms_context.h" #include "ir/graph_utils.h" #include "pipeline/jit/pipeline.h" diff --git a/mindspore/ccsrc/frontend/parallel/graph_util/graph_splitter.cc b/mindspore/ccsrc/frontend/parallel/graph_util/graph_splitter.cc index 7754c58efe0..b3e7684f3cb 100644 --- a/mindspore/ccsrc/frontend/parallel/graph_util/graph_splitter.cc +++ b/mindspore/ccsrc/frontend/parallel/graph_util/graph_splitter.cc @@ -26,7 +26,7 @@ #include "base/core_ops.h" #include "mindspore/core/utils/ms_context.h" #include "include/common/utils/anfalgo.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace parallel { diff --git a/mindspore/ccsrc/frontend/parallel/ops_info/operator_info.cc b/mindspore/ccsrc/frontend/parallel/ops_info/operator_info.cc index 7be80d7c093..b51f1a31e0c 100644 --- a/mindspore/ccsrc/frontend/parallel/ops_info/operator_info.cc +++ b/mindspore/ccsrc/frontend/parallel/ops_info/operator_info.cc @@ -31,9 +31,66 @@ #include "frontend/parallel/auto_parallel/graph_costmodel.h" #include "include/common/utils/parallel_context.h" #include "utils/log_adapter.h" +#include "include/common/debug/anf_dump_utils.h" namespace mindspore { namespace parallel { +namespace { +struct InStrategyValueRegister { + InStrategyValueRegister() { + AnfDumpHandler::SetInStrategyValueHandler([](const std::shared_ptr &node) -> ValuePtr { + auto operator_info = node->user_data(); + if (operator_info == nullptr) { + return nullptr; + } + + auto in_strategy = operator_info->strategy(); + if (in_strategy == nullptr) { + return nullptr; + } + + return MakeValue(in_strategy->GetInputDim()); + }); + } +} in_regist; + +struct InStrategyStageValueRegister { + InStrategyStageValueRegister() { + AnfDumpHandler::SetInStrategyStageValueHandler([](const std::shared_ptr &node) -> ValuePtr { + auto operator_info = node->user_data(); + if (operator_info == nullptr) { + return nullptr; + } + + auto in_strategy = operator_info->strategy(); + if (in_strategy == nullptr) { + return nullptr; + } + + return MakeValue(in_strategy->GetInputStage()); + }); + } +} in_stage_regist; + +struct OutStrategyValueRegister { + OutStrategyValueRegister() { + AnfDumpHandler::SetOutStrategyValueHandler([](const std::shared_ptr &node) -> ValuePtr { + auto operator_info = node->user_data(); + if (operator_info == nullptr) { + return nullptr; + } + + auto in_strategy = operator_info->out_strategy(); + if (in_strategy == nullptr) { + return nullptr; + } + + return MakeValue(in_strategy->GetInputDim()); + }); + } +} out_regist; +} // namespace + std::string StrategyToString(const Strategys &strategy) { std::string strategy_str = ""; strategy_str += "("; diff --git a/mindspore/ccsrc/frontend/parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc b/mindspore/ccsrc/frontend/parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc index 30147e17628..aabbe578818 100644 --- a/mindspore/ccsrc/frontend/parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc +++ b/mindspore/ccsrc/frontend/parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc @@ -23,7 +23,7 @@ #include "utils/ms_utils.h" #include "include/common/utils/convert_utils.h" #include "utils/log_adapter.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "proto/node_strategy.pb.h" namespace mindspore { diff --git a/mindspore/ccsrc/debug/anf_dump_utils.h b/mindspore/ccsrc/include/backend/visible.h similarity index 54% rename from mindspore/ccsrc/debug/anf_dump_utils.h rename to mindspore/ccsrc/include/backend/visible.h index 37cd921ef38..dd616606b67 100644 --- a/mindspore/ccsrc/debug/anf_dump_utils.h +++ b/mindspore/ccsrc/include/backend/visible.h @@ -13,16 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_ANF_DUMP_UTILS_H_ -#define MINDSPORE_CCSRC_DEBUG_ANF_DUMP_UTILS_H_ -#include -#include +#ifndef MINDSPORE_CCSRC_INCLUDE_BACKEND_VISIBLE_H_ +#define MINDSPORE_CCSRC_INCLUDE_BACKEND_VISIBLE_H_ -#include "ir/anf.h" - -namespace mindspore { -std::string GetNodeFuncStr(const AnfNodePtr &nd); -} // namespace mindspore - -#endif // MINDSPORE_CCSRC_DEBUG_ANF_DUMP_UTILS_H_ +#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) +#ifdef BACKEND_DLL +#define BACKEND_EXPORT __declspec(dllexport) +#else +#define BACKEND_EXPORT __declspec(dllimport) +#endif +#define BACKEND_LOCAL +#else +#define BACKEND_EXPORT __attribute__((visibility("default"))) +#define BACKEND_LOCAL __attribute__((visibility("hidden"))) +#endif +#endif // MINDSPORE_CCSRC_INCLUDE_BACKEND_VISIBLE_H_ diff --git a/mindspore/ccsrc/include/common/debug/anf_dump_utils.h b/mindspore/ccsrc/include/common/debug/anf_dump_utils.h new file mode 100644 index 00000000000..7edee3614b2 --- /dev/null +++ b/mindspore/ccsrc/include/common/debug/anf_dump_utils.h @@ -0,0 +1,43 @@ +/** + * Copyright 2022 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_DUMP_UTILS_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_DUMP_UTILS_H_ + +#include +#include +#include +#include + +#include "ir/anf.h" +#include "ir/dtype/type.h" +#include "include/common/visible.h" + +namespace mindspore { +COMMON_EXPORT std::string GetNodeFuncStr(const AnfNodePtr &nd); +COMMON_EXPORT std::string TypeToShortString(const TypeId &typeId); +COMMON_EXPORT std::string GetKernelNodeName(const AnfNodePtr &anf_node); + +class COMMON_EXPORT AnfDumpHandler { + HANDLER_DEFINE(std::string, PrintInputTypeShapeFormat, AnfNodePtr, size_t); + HANDLER_DEFINE(std::string, PrintOutputTypeShapeFormat, AnfNodePtr, size_t); + HANDLER_DEFINE(ValuePtr, InStrategyValue, AnfNodePtr); + HANDLER_DEFINE(ValuePtr, InStrategyStageValue, AnfNodePtr); + HANDLER_DEFINE(ValuePtr, OutStrategyValue, AnfNodePtr); + HANDLER_DEFINE(std::string, ValueNodeStr, ValueNodePtr); + HANDLER_DEFINE(void, DumpDat, std::string, FuncGraphPtr); +}; +} // namespace mindspore +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_DUMP_UTILS_H_ diff --git a/mindspore/ccsrc/debug/anf_ir_dump.h b/mindspore/ccsrc/include/common/debug/anf_ir_dump.h similarity index 58% rename from mindspore/ccsrc/debug/anf_ir_dump.h rename to mindspore/ccsrc/include/common/debug/anf_ir_dump.h index 99a0e768098..3909fcf2dcb 100644 --- a/mindspore/ccsrc/debug/anf_ir_dump.h +++ b/mindspore/ccsrc/include/common/debug/anf_ir_dump.h @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_ANF_IR_DUMP_H_ -#define MINDSPORE_CCSRC_DEBUG_ANF_IR_DUMP_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_IR_DUMP_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_IR_DUMP_H_ #include #include #include "ir/dtype/type.h" #include "ir/anf.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "utils/hash_set.h" +#include "include/common/visible.h" namespace mindspore { enum LocDumpMode : int { kOff = 0, kTopStack = 1, kWholeStack = 2, kInValid = 3 }; @@ -37,17 +38,16 @@ typedef struct DumpConfig { } DumpConfig; constexpr char PARALLEL_STRATEGY[] = "strategy"; -void DumpIR(const std::string &filename, const FuncGraphPtr &graph, bool dump_full_name = false, - LocDumpMode dump_location = kOff, const std::string &target_file = ""); -void DumpIR(std::ostringstream &graph_buffer, const FuncGraphPtr &graph, bool dump_full_name = false, - LocDumpMode dump_location = kOff); +COMMON_EXPORT void DumpIR(const std::string &filename, const FuncGraphPtr &graph, bool dump_full_name = false, + LocDumpMode dump_location = kOff, const std::string &target_file = ""); +COMMON_EXPORT void DumpIR(std::ostringstream &graph_buffer, const FuncGraphPtr &graph, bool dump_full_name = false, + LocDumpMode dump_location = kOff); -void GatherInputAndOutputInferType(std::ostringstream &buffer, const AnfNodePtr &node); +COMMON_EXPORT void GatherInputAndOutputInferType(std::ostringstream &buffer, const AnfNodePtr &node); -void DumpIRForRDR(const std::string &filename, const FuncGraphPtr &graph, bool dump_full_name = false, - LocDumpMode dump_location = kOff); -const std::string ToShortString(const TypeId &typeId); -DumpConfig GetDumpConfig(); +COMMON_EXPORT void DumpIRForRDR(const std::string &filename, const FuncGraphPtr &graph, bool dump_full_name = false, + LocDumpMode dump_location = kOff); +COMMON_EXPORT DumpConfig GetDumpConfig(); } // namespace mindspore -#endif // MINDSPORE_CCSRC_DEBUG_ANF_IR_DUMP_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ANF_IR_DUMP_H_ diff --git a/mindspore/ccsrc/debug/common.h b/mindspore/ccsrc/include/common/debug/common.h similarity index 88% rename from mindspore/ccsrc/debug/common.h rename to mindspore/ccsrc/include/common/debug/common.h index 78e7b53e002..ff79c74f10d 100644 --- a/mindspore/ccsrc/debug/common.h +++ b/mindspore/ccsrc/include/common/debug/common.h @@ -14,11 +14,12 @@ * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_COMMON_H_ -#define MINDSPORE_CCSRC_DEBUG_COMMON_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_COMMON_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_COMMON_H_ #include #include +#include "include/common/visible.h" #include "include/common/utils/contract.h" #include "utils/ms_context.h" #include "include/common/utils/comm_manager.h" @@ -30,7 +31,7 @@ static const int MAX_FILENAME_LENGTH = 128; static const int MAX_OS_FILENAME_LENGTH = 255; static const char kCOMPILER_CACHE_PATH[] = "MS_COMPILER_CACHE_PATH"; -class Common { +class COMMON_EXPORT Common { public: Common() = default; ~Common() = default; @@ -46,10 +47,16 @@ class Common { static bool FileExists(const std::string &filepath); static bool CommonFuncForConfigPath(const std::string &default_path, const std::string &env_path, std::string *value); static std::string GetCompilerCachePath(); + static bool GetDebugTerminate(); + static bool GetDebugExitSuccess(); + static void DebugTerminate(bool val, bool exit_success); private: static bool IsEveryFilenameValid(const std::string &path, size_t length_limit, const std::string &error_message); static std::string GetUserDefineCachePath(); + + inline static bool debugger_terminate_ = false; + inline static bool exit_success_ = false; }; inline std::string GetSaveGraphsPathName(const std::string &file_name, const std::string &save_path = "") { @@ -91,4 +98,4 @@ inline std::string ErrnoToString(const int error_number) { return ret_info.str(); } } // namespace mindspore -#endif // MINDSPORE_CCSRC_DEBUG_COMMON_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_COMMON_H_ diff --git a/mindspore/ccsrc/debug/draw.h b/mindspore/ccsrc/include/common/debug/draw.h similarity index 90% rename from mindspore/ccsrc/debug/draw.h rename to mindspore/ccsrc/include/common/debug/draw.h index f886f84cceb..d5e8a118fdc 100644 --- a/mindspore/ccsrc/debug/draw.h +++ b/mindspore/ccsrc/include/common/debug/draw.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_DRAW_H_ -#define MINDSPORE_CCSRC_DEBUG_DRAW_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_DRAW_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_DRAW_H_ #include #include @@ -22,7 +22,7 @@ #include #include "ir/anf.h" #include "utils/any.h" -#include "debug/common.h" +#include "include/common/debug/common.h" namespace mindspore { namespace draw { @@ -94,8 +94,8 @@ class ModelDigraph : public BaseDigraph { }; // API to draw -void Draw(const std::string &filename, const FuncGraphPtr &func_graph); -void DrawUserFuncGraph(const std::string &filename, const FuncGraphPtr &func_graph); +COMMON_EXPORT void Draw(const std::string &filename, const FuncGraphPtr &func_graph); +COMMON_EXPORT void DrawUserFuncGraph(const std::string &filename, const FuncGraphPtr &func_graph); } // namespace draw } // namespace mindspore diff --git a/mindspore/ccsrc/debug/dump_proto.h b/mindspore/ccsrc/include/common/debug/dump_proto.h similarity index 66% rename from mindspore/ccsrc/debug/dump_proto.h rename to mindspore/ccsrc/include/common/debug/dump_proto.h index 8f6c1c9ea82..a25d5444573 100644 --- a/mindspore/ccsrc/debug/dump_proto.h +++ b/mindspore/ccsrc/include/common/debug/dump_proto.h @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_DUMP_PROTO_H_ -#define MINDSPORE_CCSRC_DEBUG_DUMP_PROTO_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_DUMP_PROTO_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_DUMP_PROTO_H_ #include #include #include "ir/func_graph.h" #include "proto/mind_ir.pb.h" -#include "debug/common.h" +#include "include/common/debug/common.h" +#include "include/common/visible.h" #include "proto/anf_ir.pb.h" namespace mindspore { -using ModelProtoPtr = std::shared_ptr; -std::string GetFuncGraphProtoString(const FuncGraphPtr &func_graph); +COMMON_EXPORT std::string GetFuncGraphProtoString(const FuncGraphPtr &func_graph); std::string GetOnnxProtoString(const FuncGraphPtr &func_graph); @@ -35,9 +35,9 @@ std::string GetBinaryProtoString(const FuncGraphPtr &func_graph); bool DumpBinaryProto(const FuncGraphPtr &func_graph, const std::string &file_path, const FuncGraphPtr ¶m_layout_fg = nullptr); -void DumpIRProto(const FuncGraphPtr &func_graph, const std::string &suffix); +COMMON_EXPORT void DumpIRProto(const FuncGraphPtr &func_graph, const std::string &suffix); -void GetFuncGraphProto(const FuncGraphPtr &func_graph, irpb::GraphProto *graph_proto); +COMMON_EXPORT void GetFuncGraphProto(const FuncGraphPtr &func_graph, irpb::GraphProto *graph_proto); } // namespace mindspore -#endif // MINDSPORE_CCSRC_DEBUG_DUMP_PROTO_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_DUMP_PROTO_H_ diff --git a/mindspore/ccsrc/debug/env_config_parser.h b/mindspore/ccsrc/include/common/debug/env_config_parser.h similarity index 88% rename from mindspore/ccsrc/debug/env_config_parser.h rename to mindspore/ccsrc/include/common/debug/env_config_parser.h index d71be23db17..97217bdcb14 100644 --- a/mindspore/ccsrc/debug/env_config_parser.h +++ b/mindspore/ccsrc/include/common/debug/env_config_parser.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_ENV_CONFIG_PARSER_H_ -#define MINDSPORE_CCSRC_DEBUG_ENV_CONFIG_PARSER_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ENV_CONFIG_PARSER_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ENV_CONFIG_PARSER_H_ #include #include @@ -22,16 +22,14 @@ #include #include "nlohmann/json.hpp" #include "utils/ms_utils.h" +#include "include/common/visible.h" + namespace mindspore { enum RdrModes : int { Exceptional = 1, Normal = 2 }; -class EnvConfigParser { +class COMMON_EXPORT EnvConfigParser { public: - static EnvConfigParser &GetInstance() { - static EnvConfigParser instance = EnvConfigParser(); - instance.Parse(); - return instance; - } + static EnvConfigParser &GetInstance(); void Parse(); std::string ConfigPath() const { return config_file_; } @@ -83,4 +81,4 @@ class EnvConfigParser { void ConfigToString(); }; } // namespace mindspore -#endif // MINDSPORE_CCSRC_DEBUG_ENV_CONFIG_PARSER_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_ENV_CONFIG_PARSER_H_ diff --git a/mindspore/ccsrc/debug/rdr/base_recorder.h b/mindspore/ccsrc/include/common/debug/rdr/base_recorder.h similarity index 56% rename from mindspore/ccsrc/debug/rdr/base_recorder.h rename to mindspore/ccsrc/include/common/debug/rdr/base_recorder.h index dd94befdf6e..39c6ef69012 100644 --- a/mindspore/ccsrc/debug/rdr/base_recorder.h +++ b/mindspore/ccsrc/include/common/debug/rdr/base_recorder.h @@ -13,45 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_RDR_BASE_RECORDER_H_ -#define MINDSPORE_CCSRC_DEBUG_RDR_BASE_RECORDER_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_BASE_RECORDER_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_BASE_RECORDER_H_ #include #include #include #include #include -#include "debug/common.h" -#include "debug/env_config_parser.h" -#include "mindspore/core/utils/log_adapter.h" +#include "include/common/debug/common.h" +#include "include/common/visible.h" +#include "utils/log_adapter.h" const int maxNameLength = 64; namespace mindspore { -class BaseRecorder { +class COMMON_EXPORT BaseRecorder { public: - BaseRecorder() : module_(""), name_(""), directory_(""), filename_(""), timestamp_("") {} - BaseRecorder(const std::string &module, const std::string &name) : module_(module), name_(name), filename_("") { - directory_ = mindspore::EnvConfigParser::GetInstance().RdrPath(); - - if (name.length() > maxNameLength) { - name_ = name.substr(0, maxNameLength); - MS_LOG(WARNING) << "The name length is " << name.length() << ", exceeding the limit " << maxNameLength - << ". It will be intercepted as '" << name_ << "'."; - } - - std::string err_msg = module_ + ":" + name_ + " set filename failed."; - if (!filename_.empty() && !Common::IsFilenameValid(filename_, MAX_FILENAME_LENGTH, err_msg)) { - filename_ = ""; - } - auto sys_time = GetTimeString(); - for (auto ch : sys_time) { - if (ch == '.') { - break; - } - if (ch != '-' && ch != ':') { - timestamp_.push_back(ch); - } - } - } + BaseRecorder(); + BaseRecorder(const std::string &module, const std::string &name); virtual ~BaseRecorder() {} std::string GetModule() const { return module_; } @@ -76,4 +54,4 @@ using CNodePtr = std::shared_ptr; class FuncGraph; using FuncGraphPtr = std::shared_ptr; } // namespace mindspore -#endif // MINDSPORE_CCSRC_DEBUG_RDR_BASE_RECORDER_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_BASE_RECORDER_H_ diff --git a/mindspore/ccsrc/debug/rdr/recorder_manager.h b/mindspore/ccsrc/include/common/debug/rdr/recorder_manager.h similarity index 82% rename from mindspore/ccsrc/debug/rdr/recorder_manager.h rename to mindspore/ccsrc/include/common/debug/rdr/recorder_manager.h index b87cae03b19..c349856c6b9 100644 --- a/mindspore/ccsrc/debug/rdr/recorder_manager.h +++ b/mindspore/ccsrc/include/common/debug/rdr/recorder_manager.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_RDR_RECORDER_MANAGER_H_ -#define MINDSPORE_CCSRC_DEBUG_RDR_RECORDER_MANAGER_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_RECORDER_MANAGER_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_DEBUG_RDR_RECORDER_MANAGER_H_ #include #include #include @@ -23,8 +23,9 @@ #include #include #include "utils/hash_map.h" -#include "debug/env_config_parser.h" -#include "debug/rdr/base_recorder.h" +#include "include/common/debug/rdr/base_recorder.h" +#include "include/common/debug/env_config_parser.h" +#include "include/common/visible.h" namespace mindspore { // The number is the reciprocal of the golden ratio. @@ -52,13 +53,9 @@ struct pair_hash { } }; -class RecorderManager { +class COMMON_EXPORT RecorderManager { public: - static RecorderManager &Instance() { - static RecorderManager manager; - manager.UpdateRdrEnable(); - return manager; - } + static RecorderManager &Instance(); void UpdateRdrEnable(); bool RdrEnable() const; @@ -83,5 +80,11 @@ class RecorderManager { // , BaserRecorderPtr mindspore::HashMap, BaseRecorderPtr, pair_hash> recorder_container_; }; + +namespace RDR { +COMMON_EXPORT void TriggerAll(); +COMMON_EXPORT void Snapshot(); +COMMON_EXPORT void ResetRecorder(); +} // namespace RDR } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_RDR_RECORDER_MANAGER_H_ diff --git a/mindspore/ccsrc/pybind_api/api_register.h b/mindspore/ccsrc/include/common/pybind_api/api_register.h similarity index 86% rename from mindspore/ccsrc/pybind_api/api_register.h rename to mindspore/ccsrc/include/common/pybind_api/api_register.h index 8bab751267d..d8db55c1a30 100644 --- a/mindspore/ccsrc/pybind_api/api_register.h +++ b/mindspore/ccsrc/include/common/pybind_api/api_register.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef PYBIND_API_API_REGISTER_H_ -#define PYBIND_API_API_REGISTER_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_PYBIND_API_API_REGISTER_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_PYBIND_API_API_REGISTER_H_ #include #include @@ -24,6 +24,7 @@ #include "pybind11/pybind11.h" #include "pybind11/stl.h" +#include "include/common/visible.h" namespace py = pybind11; @@ -31,7 +32,7 @@ namespace mindspore { using PybindDefineFunc = std::function; -class PybindDefineRegister { +class COMMON_EXPORT PybindDefineRegister { public: static void Register(const std::string &name, const PybindDefineFunc &fn) { return GetSingleton().RegisterFn(name, fn); @@ -67,4 +68,4 @@ class PybindDefineRegisterer { } // namespace mindspore -#endif // PYBIND_API_API_REGISTER_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_PYBIND_API_API_REGISTER_H_ diff --git a/mindspore/ccsrc/frontend/optimizer/cse.h b/mindspore/ccsrc/include/common/utils/cse.h similarity index 84% rename from mindspore/ccsrc/frontend/optimizer/cse.h rename to mindspore/ccsrc/include/common/utils/cse.h index d1c593c707f..19d86702d41 100644 --- a/mindspore/ccsrc/frontend/optimizer/cse.h +++ b/mindspore/ccsrc/include/common/utils/cse.h @@ -16,20 +16,21 @@ * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_CSE_H_ -#define MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_CSE_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CSE_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CSE_H_ #include #include #include "utils/hash_map.h" #include "ir/anf.h" #include "ir/manager.h" +#include "include/common/visible.h" namespace mindspore { /* namespace to support opt */ namespace opt { // Common subexpression elimination. -class CSE { +class COMMON_EXPORT CSE { public: CSE() = default; virtual ~CSE() = default; @@ -49,8 +50,8 @@ class CSE { mindspore::HashMap> *groups) const; }; -BasePtr AbsOf(const AnfNodePtr &node, bool ignore_fg_abs_tracking_id = false); +COMMON_EXPORT BasePtr AbsOf(const AnfNodePtr &node, bool ignore_fg_abs_tracking_id = false); } // namespace opt } // namespace mindspore -#endif // MINDSPORE_CCSRC_FRONTEND_OPTIMIZER_CSE_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_CSE_H_ diff --git a/mindspore/ccsrc/pybind_api/random_normal/philox_generator.h b/mindspore/ccsrc/include/common/utils/philox_generator.h similarity index 51% rename from mindspore/ccsrc/pybind_api/random_normal/philox_generator.h rename to mindspore/ccsrc/include/common/utils/philox_generator.h index 3af1969e1e4..105001b45ba 100644 --- a/mindspore/ccsrc/pybind_api/random_normal/philox_generator.h +++ b/mindspore/ccsrc/include/common/utils/philox_generator.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2022 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,15 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef PYBIND_API_API_IR_RANDOM_NORMAL_PHILOX_GENERATOR_H_ -#define PYBIND_API_API_IR_RANDOM_NORMAL_PHILOX_GENERATOR_H_ +#ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_PHILOX_GENERATOR_H_ +#define MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_PHILOX_GENERATOR_H_ + #include #include #include +#include "utils/log_adapter.h" +#include "include/common/visible.h" namespace mindspore { -static constexpr int gResultNum = 4; -class PhiloxGenerator { +static constexpr int kResultNum = 4; +class COMMON_EXPORT PhiloxGenerator { public: explicit PhiloxGenerator(uint64_t seed_) { key_var_[0] = static_cast(seed_); @@ -47,16 +50,39 @@ class PhiloxGenerator { void JumpStep(uint64_t step); - std::array Compute(const std::array &counter, + std::array Compute(const std::array &counter, const std::array &key_var) const; - std::array operator()(); + std::array operator()(); private: - std::array counter_; + std::array counter_; std::array key_var_; - static constexpr std::array keyConstant = {0xD2511F53, 0x9E3779B9, 0xCD9E8D57, 0xBB67AE85}; + static constexpr std::array keyConstant = {0xD2511F53, 0x9E3779B9, 0xCD9E8D57, 0xBB67AE85}; }; + +template +bool FillRandoms(PhiloxGenerator generator, float *output, int64_t vet_size, int64_t thread_Id) { + T distribution; + errno_t mem_ret; + generator.JumpStep((vet_size * thread_Id + kResultNum - 1) / kResultNum); + for (int32_t i = 0; i < vet_size; i += kResultNum) { + auto outputResult = distribution(&generator); + size_t max_length = 0; + if (vet_size - i >= kResultNum) { + max_length = kResultNum * sizeof(float); + mem_ret = memcpy_s(&output[i], max_length, &outputResult[0], max_length); + } else { + max_length = (vet_size - i) * sizeof(float); + mem_ret = memcpy_s(&output[i], max_length, &outputResult[0], max_length); + } + if (mem_ret != EOK) { + MS_LOG(ERROR) << "FillRandoms memcpy is failed"; + return false; + } + } + return true; +} } // namespace mindspore -#endif // PYBIND_API_API_IR_RANDOM_NORMAL_PHILOX_GENERATOR_H_ +#endif // MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_PHILOX_GENERATOR_H_ diff --git a/mindspore/ccsrc/include/common/utils/python_adapter.h b/mindspore/ccsrc/include/common/utils/python_adapter.h index 050dafad07e..c18b654b41c 100644 --- a/mindspore/ccsrc/include/common/utils/python_adapter.h +++ b/mindspore/ccsrc/include/common/utils/python_adapter.h @@ -23,8 +23,11 @@ #include "pybind11/embed.h" #include "pybind11/pybind11.h" #include "pybind11/stl.h" +#include "pybind11/numpy.h" #include "utils/log_adapter.h" +#include "ir/tensor.h" +#include "base/base_ref.h" #include "include/common/visible.h" namespace py = pybind11; @@ -71,6 +74,12 @@ py::object CallPyFn(const std::string &module, const std::string &name, T... arg } return py::none(); } + +class COMMON_EXPORT PyAdapterCallback { + HANDLER_DEFINE(ValuePtr, PyDataToValue, py::object); + HANDLER_DEFINE(BaseRef, RunPrimitivePyHookFunction, PrimitivePtr, VectorRef); + HANDLER_DEFINE(py::array, TensorToNumpy, tensor::Tensor); +}; } // namespace python_adapter } // namespace mindspore #endif // MINDSPORE_CCSRC_INCLUDE_COMMON_UTILS_PYTHON_ADAPTER_H_ diff --git a/mindspore/ccsrc/include/common/visible.h b/mindspore/ccsrc/include/common/visible.h index 07af2b8bf11..d11ff82d5ea 100644 --- a/mindspore/ccsrc/include/common/visible.h +++ b/mindspore/ccsrc/include/common/visible.h @@ -17,6 +17,8 @@ #ifndef MINDSPORE_CCSRC_INCLUDE_COMMON_VISIBLE_H_ #define MINDSPORE_CCSRC_INCLUDE_COMMON_VISIBLE_H_ +#include + #if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) #ifdef COMMON_DLL #define COMMON_EXPORT __declspec(dllexport) @@ -28,4 +30,19 @@ #define COMMON_EXPORT __attribute__((visibility("default"))) #define COMMON_LOCAL __attribute__((visibility("hidden"))) #endif + +#define HANDLER_DEFINE(return_type, name, args...) \ + public: \ + template \ + static return_type name(const Args &... argss) { \ + if (name##_handler_ == nullptr) { \ + return return_type(); \ + } \ + return name##_handler_(argss...); \ + } \ + using name##Handler = std::function)>; \ + static void Set##name##Handler(name##Handler handler) { name##_handler_ = std::move(handler); } \ + \ + private: \ + inline static name##Handler name##_handler_; #endif // MINDSPORE_CCSRC_INCLUDE_COMMON_VISIBLE_H_ diff --git a/mindspore/ccsrc/kernel/akg/akg_kernel_json_decoder.cc b/mindspore/ccsrc/kernel/akg/akg_kernel_json_decoder.cc index e9fd8682720..a47829599d0 100644 --- a/mindspore/ccsrc/kernel/akg/akg_kernel_json_decoder.cc +++ b/mindspore/ccsrc/kernel/akg/akg_kernel_json_decoder.cc @@ -21,7 +21,7 @@ #include "common/graph_kernel/adapter/fake_abstract_shape.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "frontend/operator/ops.h" #include "ir/anf.h" #include "ir/dtype.h" diff --git a/mindspore/ccsrc/kernel/common_utils.cc b/mindspore/ccsrc/kernel/common_utils.cc index 62350271fa2..2f69af5d005 100644 --- a/mindspore/ccsrc/kernel/common_utils.cc +++ b/mindspore/ccsrc/kernel/common_utils.cc @@ -34,7 +34,7 @@ #include "ir/graph_utils.h" #include "utils/ms_context.h" #include "utils/trace_base.h" -#include "mindspore/ccsrc/debug/common.h" +#include "mindspore/ccsrc/include/common/debug/common.h" namespace mindspore { namespace kernel { diff --git a/mindspore/ccsrc/kernel/kernel_build_info.cc b/mindspore/ccsrc/kernel/kernel_build_info.cc index 626dc67fb2c..58fc110f2fe 100644 --- a/mindspore/ccsrc/kernel/kernel_build_info.cc +++ b/mindspore/ccsrc/kernel/kernel_build_info.cc @@ -18,7 +18,8 @@ #include #include "utils/log_adapter.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_dump_utils.h" + namespace mindspore { namespace kernel { std::string KernelBuildInfo::GetInputFormat(size_t input_index) const { @@ -134,14 +135,14 @@ std::string KernelBuildInfo::ToString() const { if (index != 0) { output_buffer << ", "; } - output_buffer << "<" << ToShortString(GetInputDeviceType(index)) << "x" << GetInputFormat(index) << ">"; + output_buffer << "<" << TypeToShortString(GetInputDeviceType(index)) << "x" << GetInputFormat(index) << ">"; } output_buffer << ") -> ("; for (size_t index = 0; index < GetOutputNum(); ++index) { if (index != 0) { output_buffer << ", "; } - output_buffer << "<" << ToShortString(GetOutputDeviceType(index)) << "x" << GetOutputFormat(index) << ">"; + output_buffer << "<" << TypeToShortString(GetOutputDeviceType(index)) << "x" << GetOutputFormat(index) << ">"; } output_buffer << ")"; return output_buffer.str(); diff --git a/mindspore/ccsrc/kernel/oplib/oplib.h b/mindspore/ccsrc/kernel/oplib/oplib.h index 4237acc6484..85d30247729 100644 --- a/mindspore/ccsrc/kernel/oplib/oplib.h +++ b/mindspore/ccsrc/kernel/oplib/oplib.h @@ -23,6 +23,7 @@ #include #include "utils/ms_utils.h" #include "kernel/oplib/opinfo.h" +#include "include/backend/visible.h" namespace mindspore { namespace kernel { @@ -30,7 +31,7 @@ class OpLib { public: OpLib() = default; virtual ~OpLib() = default; - static bool RegOp(const std::string &json_string, const std::string &impl_path); + BACKEND_EXPORT static bool RegOp(const std::string &json_string, const std::string &impl_path); static std::shared_ptr FindOp(const std::string &op_name, OpImplyType imply_type, bool is_dynamic_shape = false); diff --git a/mindspore/ccsrc/minddata/dataset/engine/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/engine/CMakeLists.txt index 73e1d820e89..47d23dc4fa3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/dataset/engine/CMakeLists.txt @@ -52,8 +52,20 @@ add_dependencies(engine engine-datasetops-mapop ) +# for include pb.h +if(ENABLE_CACHE) + add_dependencies(engine-opt engine-cache-server) +else() + add_dependencies(engine-opt engine-cache-client) +endif() + if(NOT ENABLE_SECURITY) add_dependencies(engine engine-perf) + if(ENABLE_CACHE) + add_dependencies(engine-perf engine-cache-server) + else() + add_dependencies(engine-perf engine-cache-client) + endif() endif() if(ENABLE_TDTQUE) diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/engine/cache/CMakeLists.txt index 7f3e45b3f2a..7eabed124fd 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/CMakeLists.txt @@ -75,8 +75,6 @@ if(ENABLE_CACHE) engine-cache-server _c_dataengine _c_mindrecord - mindspore - proto_input mindspore_core mindspore::protobuf ${CUDNN_LIBRARY_PATH} @@ -88,7 +86,6 @@ if(ENABLE_CACHE) mindspore::grpc++) else() target_link_libraries(cache_server - mindspore engine-cache-server _c_dataengine _c_mindrecord diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc index 85e02607893..0a2f415a086 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_admin.cc @@ -45,7 +45,6 @@ int main(int argc, char **argv) { std::cerr << rc.ToString() << std::endl; return 1; } - google::InitGoogleLogging(argv[0]); #undef google #endif diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_main.cc b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_main.cc index 1aee7735597..6738fa673b1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_main.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_main.cc @@ -41,6 +41,54 @@ enum ArgIndex : uint8_t { }; } // namespace +ms::Status Fork(ds::SharedMessage *msg, int32_t port) { + if (msg == nullptr) { + return ms::Status(ms::StatusCode::kMDUnexpectedError, __LINE__, __FILE__, "msg pointer is nullptr."); + } + pid_t pid = fork(); + if (pid > 0) { + // Parent and will be responsible for remove the queue on exit. + msg->RemoveResourcesOnExit(); + // Sleep one second and we attach to the msg que + std::this_thread::sleep_for(std::chrono::seconds(1)); + ms::Status child_rc; + auto rc = msg->ReceiveStatus(&child_rc); + std::string warning_string; + if (rc.IsError()) { + return rc; + } + if (child_rc.IsError()) { + return child_rc; + } + warning_string = child_rc.ToString(); + std::cout << "Cache server startup completed successfully!\n"; + std::cout << "The cache server daemon has been created as process id " << pid << " and listening on port " << port + << ".\n"; + if (!warning_string.empty()) std::cout << "WARNING: " << warning_string; + std::cout << "\nRecommendation:\nSince the server is detached into its own daemon process, monitor the server " + "logs (under " + << ds::DefaultLogDir() << ") for any issues that may happen after startup\n"; + signal(SIGCHLD, SIG_IGN); // ignore sig child signal. + return ms::Status::OK(); + } else if (pid == 0) { + // Child process will continue from here if daemonize and parent has already exited. + // If we are running in the foreground, none of the code in block below will be run. + pid_t sid; + umask(0); + sid = setsid(); + if (sid < 0) { + std::string errMsg = "Failed to setsid(). Errno = " + std::to_string(errno); + return ms::Status(ms::StatusCode::kMDUnexpectedError, __LINE__, __FILE__, errMsg); + } + (void)close(STDIN_FILENO); + (void)close(STDOUT_FILENO); + (void)close(STDERR_FILENO); + } + // failed to fork + std::string errMsg = "Failed to fork process for cache server. Errno = " + std::to_string(errno); + return ms::Status(ms::StatusCode::kMDUnexpectedError, __LINE__, __FILE__, errMsg); +} + /// Start the server /// \param argv /// \return Status object @@ -85,56 +133,13 @@ ms::Status StartServer(int argc, char **argv) { } ms::g_ms_submodule_log_levels[SUBMODULE_ID] = static_cast(strtol(argv[ArgIndex::kLogLevel], nullptr, ds::kDecimal)); - google::InitGoogleLogging(argv[ArgIndex::kProcessName]); #undef google #endif rc = msg.Create(); if (rc.IsError()) { return rc; } - pid_t pid = fork(); - // failed to fork - if (pid < 0) { - std::string errMsg = "Failed to fork process for cache server. Errno = " + std::to_string(errno); - return ms::Status(ms::StatusCode::kMDUnexpectedError, __LINE__, __FILE__, errMsg); - } else if (pid > 0) { - // Parent and will be responsible for remove the queue on exit. - msg.RemoveResourcesOnExit(); - // Sleep one second and we attach to the msg que - std::this_thread::sleep_for(std::chrono::seconds(1)); - ms::Status child_rc; - rc = msg.ReceiveStatus(&child_rc); - std::string warning_string; - if (rc.IsError()) { - return rc; - } - if (child_rc.IsError()) { - return child_rc; - } - warning_string = child_rc.ToString(); - std::cout << "Cache server startup completed successfully!\n"; - std::cout << "The cache server daemon has been created as process id " << pid << " and listening on port " << port - << ".\n"; - if (!warning_string.empty()) std::cout << "WARNING: " << warning_string; - std::cout << "\nRecommendation:\nSince the server is detached into its own daemon process, monitor the server " - "logs (under " - << ds::DefaultLogDir() << ") for any issues that may happen after startup\n"; - signal(SIGCHLD, SIG_IGN); // ignore sig child signal. - return ms::Status::OK(); - } else { - // Child process will continue from here if daemonize and parent has already exited. - // If we are running in the foreground, none of the code in block below will be run. - pid_t sid; - umask(0); - sid = setsid(); - if (sid < 0) { - std::string errMsg = "Failed to setsid(). Errno = " + std::to_string(errno); - return ms::Status(ms::StatusCode::kMDUnexpectedError, __LINE__, __FILE__, errMsg); - } - (void)close(STDIN_FILENO); - (void)close(STDOUT_FILENO); - (void)close(STDERR_FILENO); - } + return Fork(&msg, port); } // Create the instance with some sanity checks built in diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/perf/CMakeLists.txt b/mindspore/ccsrc/minddata/dataset/engine/cache/perf/CMakeLists.txt index 1913d0af445..488134cdd36 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/perf/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/perf/CMakeLists.txt @@ -8,7 +8,6 @@ if(ENABLE_CACHE) target_link_libraries(cache_perf _c_dataengine _c_mindrecord - mindspore mindspore::protobuf ${PYTHON_LIBRARIES} pthread) @@ -21,7 +20,6 @@ if(ENABLE_CACHE) target_link_libraries(cache_pipeline _c_dataengine _c_mindrecord - mindspore mindspore::protobuf ${PYTHON_LIBRARIES} pthread) diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_perf.cc b/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_perf.cc index 631e121e0be..3987ae75672 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_perf.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_perf.cc @@ -25,7 +25,6 @@ int main(int argc, char **argv) { #define google mindspore_private FLAGS_logtostderr = false; FLAGS_log_dir = "/tmp"; - google::InitGoogleLogging(argv[0]); #undef google #endif ds::CachePerfRun cachePerfRun; diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_pipeline.cc b/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_pipeline.cc index ffca56103a6..a4c1bc4423c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_pipeline.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/perf/cache_pipeline.cc @@ -26,7 +26,6 @@ int main(int argc, char **argv) { #define google mindspore_private FLAGS_logtostderr = false; FLAGS_log_dir = "/tmp"; - google::InitGoogleLogging(argv[0]); #undef google #endif ds::CachePipelineRun cachePipelineRun; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h index 39d6c3194a1..e33b153b9a1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/device_queue_op.h @@ -28,7 +28,6 @@ #include "minddata/dataset/engine/perf/device_queue_tracing.h" #include "minddata/dataset/util/status.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" #include "minddata/dataset/util/rdr.h" #endif diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc index 666c61691a4..3c4b9c3018b 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc @@ -22,7 +22,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/engine/datasetops/source/io_block.h" #include "minddata/dataset/engine/execution_tree.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/dbpedia_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/dbpedia_op.cc index ffbf31f4baf..f4b1a764605 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/dbpedia_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/dbpedia_op.cc @@ -20,7 +20,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/engine/jagged_connector.h" #include "minddata/dataset/engine/execution_tree.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc index 516a9656d27..5f8431dcfa7 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc @@ -21,7 +21,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/core/tensor_shape.h" #include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.h b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.h index c58b79961c4..f55c3c0f9f3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.h +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.h @@ -23,7 +23,7 @@ #include "./tinyxml2.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/engine/data_schema.h" #include "minddata/dataset/engine/datasetops/parallel_op.h" #include "minddata/dataset/engine/datasetops/source/io_block.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/kitti_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/kitti_op.cc index 0e21c3e6336..f08448b5577 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/kitti_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/kitti_op.cc @@ -20,7 +20,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/core/tensor_shape.h" #include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc index 960a5f47c42..2669c6cf15c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc @@ -22,7 +22,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/engine/datasetops/source/io_block.h" #include "utils/file_utils.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc index 61595340c7e..ae58d256ab6 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/penn_treebank_op.cc @@ -22,7 +22,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/engine/datasetops/source/io_block.h" #include "minddata/dataset/engine/execution_tree.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc index 06063583528..9d9d55a19cc 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc @@ -24,7 +24,7 @@ #include "minddata/dataset/core/tensor_shape.h" #include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" #include "minddata/dataset/engine/execution_tree.h" -#include "mindspore/ccsrc/debug/common.h" +#include "mindspore/ccsrc/include/common/debug/common.h" #include "utils/file_utils.h" #include "utils/ms_utils.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc index 6c646672bd6..1e5ebd04801 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc @@ -21,7 +21,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/core/tensor_shape.h" #include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc index fe78f17b7aa..019e4ba574f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/qmnist_op.cc @@ -21,7 +21,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/core/tensor_shape.h" #include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sogou_news_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sogou_news_op.cc index 06d7b3296d9..14528bb9975 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sogou_news_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/sogou_news_op.cc @@ -22,7 +22,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc index 69a1a5d8d83..5e4c2d9eb28 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc @@ -21,7 +21,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/core/tensor_shape.h" #include "minddata/dataset/engine/datasetops/source/sampler/sequential_sampler.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/wiki_text_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/wiki_text_op.cc index 1ce9a49ea8d..9c10322fed5 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/wiki_text_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/wiki_text_op.cc @@ -22,7 +22,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/engine/datasetops/source/io_block.h" #include "minddata/dataset/engine/execution_tree.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc index 22850cbd2c8..4c02a6d29a9 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yahoo_answers_op.cc @@ -20,7 +20,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/core/config_manager.h" #include "minddata/dataset/engine/jagged_connector.h" #include "minddata/dataset/engine/execution_tree.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yelp_review_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yelp_review_op.cc index 585b03b3e7c..3aecd9da41c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yelp_review_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/yelp_review_op.cc @@ -22,7 +22,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc index 9d9f9082ab9..5b77a6670d9 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2016_node.cc @@ -23,7 +23,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/engine/datasetops/source/iwslt_op.h" #include "utils/file_utils.h" diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc index 840e1205dbc..07fd67d0c73 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/iwslt2017_node.cc @@ -23,7 +23,7 @@ #include #include -#include "debug/common.h" +#include "include/common/debug/common.h" #include "minddata/dataset/engine/datasetops/source/iwslt_op.h" namespace mindspore { diff --git a/mindspore/ccsrc/minddata/mindrecord/CMakeLists.txt b/mindspore/ccsrc/minddata/mindrecord/CMakeLists.txt index 85491083f06..e935ecf3a18 100644 --- a/mindspore/ccsrc/minddata/mindrecord/CMakeLists.txt +++ b/mindspore/ccsrc/minddata/mindrecord/CMakeLists.txt @@ -37,9 +37,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") else() target_link_libraries(_c_mindrecord PRIVATE mindspore::sqlite ${PYTHON_LIB} ${SECUREC_LIBRARY} mindspore::protobuf) - if(NOT MSLITE_ENABLE_CLOUD_MIND_DATA) - target_link_libraries(_c_mindrecord PRIVATE mindspore) - endif() endif() target_link_libraries(_c_mindrecord PRIVATE mindspore_core) if(USE_GLOG) diff --git a/mindspore/ccsrc/pipeline/jit/CMakeLists.txt b/mindspore/ccsrc/pipeline/jit/CMakeLists.txt index 1f1f4e8ded1..4ff0c3a565f 100644 --- a/mindspore/ccsrc/pipeline/jit/CMakeLists.txt +++ b/mindspore/ccsrc/pipeline/jit/CMakeLists.txt @@ -9,6 +9,7 @@ file(GLOB_RECURSE _PIPELINE_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "compile_cache_manager.cc" "parse/*.cc" "static_analysis/*.cc" + "debug/*.cc" ) @@ -21,6 +22,9 @@ set_property(SOURCE ${PARSER_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_I file(GLOB_RECURSE ANALYZER_SRC_FILES "static_analysis/*.cc") set_property(SOURCE ${ANALYZER_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_ANALYZER) +file(GLOB_RECURSE DEBUG_SRC_FILES "debug/*.cc") +set_property(SOURCE ${DEBUG_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEBUG) + if(ENABLE_D) file(GLOB_RECURSE _PIPELINE_GE_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "pipeline_ge.cc") list(APPEND _PIPELINE_SRC_FILES ${_PIPELINE_GE_SRC_FILES}) diff --git a/mindspore/ccsrc/pipeline/jit/compile_cache_manager.cc b/mindspore/ccsrc/pipeline/jit/compile_cache_manager.cc index 1c7b4ee8299..62eff647b2b 100644 --- a/mindspore/ccsrc/pipeline/jit/compile_cache_manager.cc +++ b/mindspore/ccsrc/pipeline/jit/compile_cache_manager.cc @@ -22,9 +22,9 @@ #include #include "pipeline/jit/parse/data_converter.h" #include "include/common/utils/parallel_context.h" -#include "debug/common.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" +#include "include/common/debug/common.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" #include "utils/system/sha256.h" #include "include/common/utils/utils.h" diff --git a/mindspore/ccsrc/debug/anf_ir_utils.cc b/mindspore/ccsrc/pipeline/jit/debug/anf_ir_utils.cc similarity index 97% rename from mindspore/ccsrc/debug/anf_ir_utils.cc rename to mindspore/ccsrc/pipeline/jit/debug/anf_ir_utils.cc index 25bf09217d2..4eb6bb34d3a 100644 --- a/mindspore/ccsrc/debug/anf_ir_utils.cc +++ b/mindspore/ccsrc/pipeline/jit/debug/anf_ir_utils.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "debug/anf_ir_utils.h" +#include "pipeline/jit/debug/anf_ir_utils.h" #include #include @@ -36,27 +36,30 @@ #include "utils/ordered_set.h" #include "include/common/utils/utils.h" #include "utils/shape_utils.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "utils/label.h" #include "utils/ms_context.h" #include "frontend/operator/ops.h" #include "pipeline/jit/base.h" -#include "debug/common.h" -#include "debug/anf_dump_utils.h" +#include "include/common/debug/common.h" +#include "include/common/debug/anf_dump_utils.h" using mindspore::tensor::TensorPy; namespace mindspore { -std::string GetKernelNodeName(const AnfNodePtr &anf_node) { - MS_EXCEPTION_IF_NULL(anf_node); - std::string kernel_name = anf_node->fullname_with_scope(); - if (kernel_name.empty()) { - kernel_name = anf_node->ToString(); +namespace { +struct AnfDumpHandlerRegister { + AnfDumpHandlerRegister() { + AnfDumpHandler::SetDumpDatHandler([](const std::string &realpath, const FuncGraphPtr &graph) { + AnfExporter exporter(""); + std::string realpath_dat = realpath + ".dat"; + ChangeFileMode(realpath_dat, S_IRWXU); + exporter.ExportFuncGraph(realpath_dat, graph); + ChangeFileMode(realpath_dat, S_IRUSR); + }); } - MS_LOG(DEBUG) << "Full scope kernel name is " << kernel_name << "."; - return kernel_name; -} - +} callback_register; +} // namespace // ============================================= MindSpore IR Exporter ============================================= std::string AnfExporter::GetNodeType(const AnfNodePtr &nd) { MS_EXCEPTION_IF_NULL(nd); diff --git a/mindspore/ccsrc/debug/anf_ir_utils.h b/mindspore/ccsrc/pipeline/jit/debug/anf_ir_utils.h similarity index 96% rename from mindspore/ccsrc/debug/anf_ir_utils.h rename to mindspore/ccsrc/pipeline/jit/debug/anf_ir_utils.h index 3bab837b295..f8dc4158086 100644 --- a/mindspore/ccsrc/debug/anf_ir_utils.h +++ b/mindspore/ccsrc/pipeline/jit/debug/anf_ir_utils.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_ANF_IR_UTILS_H_ -#define MINDSPORE_CCSRC_DEBUG_ANF_IR_UTILS_H_ +#ifndef MINDSPORE_CCSRC_PIPELINE_JIT_DEBUG_ANF_IR_UTILS_H_ +#define MINDSPORE_CCSRC_PIPELINE_JIT_DEBUG_ANF_IR_UTILS_H_ #include #include @@ -123,8 +123,6 @@ class AnfExporter { }; void ExportIR(const std::string &filename, const FuncGraphPtr &func_graph); - -std::string GetKernelNodeName(const AnfNodePtr &anf_node); } // namespace mindspore -#endif // MINDSPORE_CCSRC_DEBUG_ANF_IR_UTILS_H_ +#endif // MINDSPORE_CCSRC_PIPELINE_JIT_DEBUG_ANF_IR_UTILS_H_ diff --git a/mindspore/ccsrc/debug/trace.cc b/mindspore/ccsrc/pipeline/jit/debug/trace.cc similarity index 99% rename from mindspore/ccsrc/debug/trace.cc rename to mindspore/ccsrc/pipeline/jit/debug/trace.cc index e7a4920a736..fd616abd8dd 100644 --- a/mindspore/ccsrc/debug/trace.cc +++ b/mindspore/ccsrc/pipeline/jit/debug/trace.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include #include @@ -32,8 +32,8 @@ #include "ir/graph_utils.h" #include "frontend/operator/composite/composite.h" #include "ir/tensor.h" -#include "debug/anf_ir_utils.h" -#include "debug/common.h" +#include "pipeline/jit/debug/anf_ir_utils.h" +#include "include/common/debug/common.h" #include "pipeline/jit/static_analysis/evaluator.h" #include "pipeline/jit/static_analysis/async_eval_result.h" #include "pipeline/jit/base.h" diff --git a/mindspore/ccsrc/debug/trace.h b/mindspore/ccsrc/pipeline/jit/debug/trace.h similarity index 95% rename from mindspore/ccsrc/debug/trace.h rename to mindspore/ccsrc/pipeline/jit/debug/trace.h index 4cfd04a66cf..2c80341a227 100644 --- a/mindspore/ccsrc/debug/trace.h +++ b/mindspore/ccsrc/pipeline/jit/debug/trace.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef MINDSPORE_CCSRC_DEBUG_TRACE_H_ -#define MINDSPORE_CCSRC_DEBUG_TRACE_H_ +#ifndef MINDSPORE_CCSRC_PIPELINE_JIT_DEBUG_TRACE_H_ +#define MINDSPORE_CCSRC_PIPELINE_JIT_DEBUG_TRACE_H_ #include #include diff --git a/mindspore/ccsrc/pipeline/jit/init.cc b/mindspore/ccsrc/pipeline/jit/init.cc index ab3fa3e875a..be83288869e 100644 --- a/mindspore/ccsrc/pipeline/jit/init.cc +++ b/mindspore/ccsrc/pipeline/jit/init.cc @@ -20,7 +20,7 @@ #include "frontend/operator/composite/composite.h" #include "pipeline/pynative/pynative_execute.h" #include "utils/symbolic.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "include/common/utils/python_adapter.h" #ifndef ENABLE_SECURITY #include "include/common/utils/summary/event_writer.h" diff --git a/mindspore/ccsrc/pipeline/jit/parse/data_converter.cc b/mindspore/ccsrc/pipeline/jit/parse/data_converter.cc index 12b88c2cae4..7387f7affb6 100644 --- a/mindspore/ccsrc/pipeline/jit/parse/data_converter.cc +++ b/mindspore/ccsrc/pipeline/jit/parse/data_converter.cc @@ -35,6 +35,11 @@ namespace mindspore { namespace parse { +namespace { +struct PyDataToValueRegister { + PyDataToValueRegister() { python_adapter::PyAdapterCallback::SetPyDataToValueHandler(data_converter::PyDataToValue); } +} callback_register; +} // namespace using Tensor = mindspore::tensor::Tensor; using TensorPtr = mindspore::tensor::TensorPtr; using MetaTensor = mindspore::tensor::MetaTensor; diff --git a/mindspore/ccsrc/pipeline/jit/parse/function_block.cc b/mindspore/ccsrc/pipeline/jit/parse/function_block.cc index 2886f86e2e1..6a28efe1e06 100644 --- a/mindspore/ccsrc/pipeline/jit/parse/function_block.cc +++ b/mindspore/ccsrc/pipeline/jit/parse/function_block.cc @@ -28,7 +28,7 @@ #include "pipeline/jit/parse/data_converter.h" #include "frontend/operator/ops.h" #include "utils/info.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "include/common/utils/utils.h" namespace mindspore { diff --git a/mindspore/ccsrc/pipeline/jit/parse/parse.cc b/mindspore/ccsrc/pipeline/jit/parse/parse.cc index a65401fa4ee..950813be363 100644 --- a/mindspore/ccsrc/pipeline/jit/parse/parse.cc +++ b/mindspore/ccsrc/pipeline/jit/parse/parse.cc @@ -32,7 +32,7 @@ #include "frontend/operator/composite/composite.h" #include "utils/ms_context.h" #include "utils/interpret_node_recorder.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "mindspore/core/ir/cell.h" #include "include/common/utils/utils.h" diff --git a/mindspore/ccsrc/pipeline/jit/parse/resolve.cc b/mindspore/ccsrc/pipeline/jit/parse/resolve.cc index a57670c9924..8469ddf4bd4 100644 --- a/mindspore/ccsrc/pipeline/jit/parse/resolve.cc +++ b/mindspore/ccsrc/pipeline/jit/parse/resolve.cc @@ -30,9 +30,43 @@ #include "frontend/optimizer/opt.h" #include "frontend/optimizer/irpass.h" #include "frontend/optimizer/irpass/symbol_resolver.h" +#include "include/common/debug/anf_dump_utils.h" namespace mindspore { namespace parse { +namespace { +std::string ReplaceSpecialChar(const std::string &str) { + std::ostringstream oss; + for (size_t i = 0; i < str.size(); i++) { + if (str[i] == '<') { + oss << "「"; + } else if (str[i] == '>') { + oss << "」"; + } else { + oss << str[i]; + } + } + return oss.str(); +} + +struct AnfDumpHandlerRegister { + AnfDumpHandlerRegister() { + AnfDumpHandler::SetValueNodeStrHandler([](const std::shared_ptr &node) -> std::string { + if (node == nullptr) { + return ""; + } + if (IsValueNode(node)) { + return node->value()->cast()->name(); + } else if (IsValueNode(node)) { + return node->value()->cast()->name(); + } else if (IsValueNode(node)) { + return ReplaceSpecialChar(node->value()->cast()->name()); + } + return ""; + }); + } +} callback_register; +} // namespace abstract::AbstractBasePtr ClassObject::ToAbstract() { ClassPtr cls_ptr = ParseDataClass(obj()); auto abs_scalar = std::make_shared(); diff --git a/mindspore/ccsrc/pipeline/jit/pipeline.cc b/mindspore/ccsrc/pipeline/jit/pipeline.cc index 9a9e3ed2346..a4dae6fa4ce 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline.cc @@ -48,12 +48,12 @@ #include "utils/crypto.h" #include "include/common/utils/comm_manager.h" #include "utils/interpret_node_recorder.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" -#include "debug/anf_ir_utils.h" -#include "debug/trace.h" -#include "debug/draw.h" -#include "debug/common.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" +#include "pipeline/jit/debug/anf_ir_utils.h" +#include "pipeline/jit/debug/trace.h" +#include "include/common/debug/draw.h" +#include "include/common/debug/common.h" #include "load_mindir/load_model.h" #include "backend/graph_compiler/segment_runner.h" #include "backend/common/session/executor_manager.h" @@ -88,8 +88,8 @@ #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#include "debug/rdr/recorder_manager.h" +#include "debug/rdr/graph_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" #include "ir/cell.h" #endif @@ -119,10 +119,6 @@ const char IR_TYPE_MINDIR[] = "mind_ir"; GraphExecutorPyPtr GraphExecutorPy::executor_ = nullptr; std::mutex GraphExecutorPy::instance_lock_; -#ifdef ENABLE_DEBUGGER -bool GraphExecutorPy::debugger_terminate_ = false; -bool GraphExecutorPy::exit_success_ = false; -#endif std::unordered_map @@ -1149,14 +1145,10 @@ void GraphExecutorPy::ProcessVmArg(const py::tuple &args, const std::string &pha #ifdef ENABLE_DEBUGGER void GraphExecutorPy::TerminateDebugger() { - if (debugger_terminate_) { + if (Common::GetDebugTerminate()) { MS_LOG(INFO) << "Terminate debugger and clear resources!"; ClearResAtexit(); - if (exit_success_) { - exit(0); - } else { - exit(1); - } + exit(static_cast(!Common::GetDebugExitSuccess())); } } #endif diff --git a/mindspore/ccsrc/pipeline/jit/pipeline.h b/mindspore/ccsrc/pipeline/jit/pipeline.h index d5dbe400023..ee5fd824709 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline.h +++ b/mindspore/ccsrc/pipeline/jit/pipeline.h @@ -123,11 +123,6 @@ class GraphExecutorPy : public std::enable_shared_from_this { } void set_weights_values(const py::dict &weights) { weights_ = weights; } #ifdef ENABLE_DEBUGGER - static bool GetDebugTerminate() { return debugger_terminate_; } - static void DebugTerminate(bool val, bool exit_success) { - debugger_terminate_ = val; - exit_success_ = exit_success; - } void TerminateDebugger(); #endif @@ -153,10 +148,6 @@ class GraphExecutorPy : public std::enable_shared_from_this { std::map info_; static std::shared_ptr executor_; static std::mutex instance_lock_; -#ifdef ENABLE_DEBUGGER - static bool debugger_terminate_; - static bool exit_success_; -#endif std::map stra_dict_; std::string phase_ = ""; std::map jit_config_; diff --git a/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc b/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc index 22f63d4d0a8..0c9dad73aa7 100644 --- a/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc +++ b/mindspore/ccsrc/pipeline/jit/pipeline_ge.cc @@ -22,13 +22,13 @@ #include #include "utils/hash_map.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "ir/tensor.h" #include "include/transform/graph_ir/convert.h" #include "include/transform/graph_ir/df_graph_manager.h" #include "include/transform/graph_ir/graph_builder.h" #include "include/transform/graph_ir/graph_runner.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "abstract/abstract_value.h" #include "include/common/utils/convert_utils_py.h" #include "include/common/utils/utils.h" diff --git a/mindspore/ccsrc/pipeline/jit/remove_value_node_dup.cc b/mindspore/ccsrc/pipeline/jit/remove_value_node_dup.cc index 3e5e7f80300..93eafb2b743 100644 --- a/mindspore/ccsrc/pipeline/jit/remove_value_node_dup.cc +++ b/mindspore/ccsrc/pipeline/jit/remove_value_node_dup.cc @@ -20,7 +20,7 @@ #include "ir/func_graph.h" #include "ir/tensor.h" #include "ir/manager.h" -#include "frontend/optimizer/cse.h" +#include "include/common/utils/cse.h" #include "utils/log_adapter.h" #include "utils/hashing.h" #include "include/common/utils/convert_utils.h" diff --git a/mindspore/ccsrc/pipeline/jit/resource.cc b/mindspore/ccsrc/pipeline/jit/resource.cc index e527fdaf306..25defb0a898 100644 --- a/mindspore/ccsrc/pipeline/jit/resource.cc +++ b/mindspore/ccsrc/pipeline/jit/resource.cc @@ -18,7 +18,7 @@ #include "pipeline/jit/resource.h" #include "pipeline/jit/static_analysis/static_analysis.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "ir/dtype.h" #include "pipeline/jit/parse/data_converter.h" #include "frontend/operator/ops.h" diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc index e17366f6f0a..2a41aaef748 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/async_eval_result.cc @@ -15,9 +15,9 @@ */ #include "pipeline/jit/static_analysis/async_eval_result.h" -#include +#include "pipeline/jit/debug/trace.h" #include "utils/symbolic.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "pipeline/jit/base.h" #include "include/common/utils/utils.h" diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/evaluator.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/evaluator.cc index 1867a3e0e33..ced9f424487 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/evaluator.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/evaluator.cc @@ -22,7 +22,7 @@ #include "utils/hash_set.h" #include "ir/func_graph_cloner.h" #include "abstract/utils.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "utils/ms_context.h" #include "pipeline/jit/static_analysis/stack_frame.h" #include "pipeline/jit/static_analysis/async_eval_result.h" diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc index 47abe21bd0b..608601556a8 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc @@ -28,7 +28,7 @@ #include "include/common/utils/utils.h" #include "ir/graph_utils.h" #include "utils/log_adapter.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" namespace mindspore { namespace abstract { diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/stack_frame.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/stack_frame.cc index 576f6b5cc39..26b73f95aa8 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/stack_frame.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/stack_frame.cc @@ -15,7 +15,7 @@ */ #include "pipeline/jit/static_analysis/stack_frame.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" #include "pipeline/jit/static_analysis/async_eval_result.h" namespace mindspore { diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/static_analysis.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/static_analysis.cc index 23ee087b60e..11a6cfcbf79 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/static_analysis.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/static_analysis.cc @@ -28,8 +28,8 @@ #include "ir/func_graph_cloner.h" #include "pipeline/jit/parse/data_converter.h" #include "pipeline/jit/static_analysis/evaluator.h" -#include "debug/trace.h" -#include "debug/anf_ir_dump.h" +#include "pipeline/jit/debug/trace.h" +#include "include/common/debug/anf_ir_dump.h" #include "pipeline/jit/static_analysis/async_eval_result.h" namespace mindspore { diff --git a/mindspore/ccsrc/pipeline/jit/validator.cc b/mindspore/ccsrc/pipeline/jit/validator.cc index 8f5b81e4074..660540a9e0e 100644 --- a/mindspore/ccsrc/pipeline/jit/validator.cc +++ b/mindspore/ccsrc/pipeline/jit/validator.cc @@ -25,7 +25,7 @@ #include "ir/dtype.h" #include "pipeline/jit/static_analysis/prim.h" #include "pipeline/jit/parse/resolve.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" namespace mindspore { namespace validator { diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index d08dad423ff..59b02a08423 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -24,9 +24,9 @@ #include "utils/hash_map.h" #include "utils/hash_set.h" -#include "debug/trace.h" -#include "debug/anf_ir_dump.h" -#include "pybind_api/api_register.h" +#include "pipeline/jit/debug/trace.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/pybind_api/api_register.h" #include "pybind_api/pybind_patch.h" #include "pybind_api/ir/tensor_py.h" #include "ir/param_info.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc index 7e2ea0ee0d1..cdbd4862814 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_kernel_runtime.cc @@ -51,13 +51,13 @@ #include "utils/trace_base.h" #include "graphengine/inc/external/acl/error_codes/rt_error_codes.h" #include "common/util/error_manager/error_manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/parallel_context.h" #include "include/common/utils/comm_manager.h" #include "include/common/utils/runtime_error_codes.h" #ifdef MEM_REUSE_DEBUG #include "common/mem_reuse/mem_reuse_checker.h" -#include "debug/env_config_parser.h" +#include "include/common/debug/env_config_parser.h" #endif #include "plugin/device/ascend/hal/device/executor/hccl_dynamic_kernel.h" #include "include/common/utils/config_manager.h" @@ -67,7 +67,7 @@ using mindspore::dataset::TdtHandle; #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" #endif #include "backend/common/session/pynative_task_manager.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_launch_atomic_clean.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_launch_atomic_clean.cc index bbcfad40ec8..45d99e58cca 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_launch_atomic_clean.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_launch_atomic_clean.cc @@ -19,7 +19,7 @@ #include "backend/common/session/single_kernel_graph.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore::device::ascend { void AscendLaunchAtomicClean::FreeDeviceMem(void *addr) { AscendLaunchKernel::FreeDeviceMem(addr); } diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_stream_assign.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_stream_assign.cc index 1a059f27537..9a4a9e915a5 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_stream_assign.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_stream_assign.cc @@ -32,7 +32,7 @@ #include "include/common/utils/utils.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "debug/rdr/stream_exec_order_recorder.h" #endif namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/distribute/ascend_collective.h b/mindspore/ccsrc/plugin/device/ascend/hal/device/distribute/ascend_collective.h index 75d653b0f8f..75e47fb6c65 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/distribute/ascend_collective.h +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/distribute/ascend_collective.h @@ -24,6 +24,8 @@ #include "hccl/hccl_types.h" #include "include/common/utils/utils.h" #include "utils/dlopen_macro.h" +#include "include/backend/visible.h" + namespace mindspore { namespace device { namespace ascend { @@ -38,7 +40,7 @@ ORIGIN_METHOD(GetDeviceId, int); ORIGIN_METHOD(CreateCommForGroup, bool, const std::string &, const std::vector &); ORIGIN_METHOD(DestroyHcclComm, void); -class HcclCollectiveGroup { +class BACKEND_EXPORT HcclCollectiveGroup { public: HcclCollectiveGroup(HcclCollectiveGroup const &) = delete; HcclCollectiveGroup &operator=(const HcclCollectiveGroup &) = delete; diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/runtime_model.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/runtime_model.cc index 8c17e882b75..7eaff394936 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/runtime_model.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/ge_runtime/runtime_model.cc @@ -24,7 +24,7 @@ #include "plugin/device/ascend/hal/device/ge_runtime/task/task_factory.h" #include "mindspore/core/utils/log_adapter.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" #endif namespace mindspore::ge::model_runner { diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/kernel_select_ascend.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/kernel_select_ascend.cc index c5b40e6eb72..902fd9c8dfb 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/kernel_select_ascend.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/kernel_select_ascend.cc @@ -33,7 +33,7 @@ #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "runtime/device/ms_device_shape_transfer.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "frontend/operator/ops.h" #include "utils/ms_context.h" #include "utils/ms_utils.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/device/tasksink/task_generator.cc b/mindspore/ccsrc/plugin/device/ascend/hal/device/tasksink/task_generator.cc index def8287f2c5..dd2ee8b5593 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/device/tasksink/task_generator.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/device/tasksink/task_generator.cc @@ -27,7 +27,7 @@ #include "plugin/device/ascend/hal/device/profiling/profiling_manager.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "debug/rdr/task_debug_info_recorder.h" #endif namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc index 4c5d58babed..a92da52d9bf 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_device_context.cc @@ -41,8 +41,8 @@ #include "debug/data_dump/dump_json_parser.h" #include "toolchain/adx_datadump_server.h" #include "toolchain/adx_datadump_callback.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" #include "debug/data_dump/e2e_dump.h" #include "debug/debugger/debugger_utils.h" #endif @@ -53,8 +53,7 @@ #include "debug/debugger/proto_exporter_stub.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#include "debug/rdr/recorder_manager.h" +#include "include/common/debug/rdr/recorder_manager.h" #include "debug/rdr/graph_recorder.h" #endif diff --git a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc index 1f7207158c1..9c3dca51592 100644 --- a/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc +++ b/mindspore/ccsrc/plugin/device/ascend/hal/hardware/ascend_graph_optimization.cc @@ -26,8 +26,8 @@ #include "runtime/device/kernel_adjust.h" #ifndef ENABLE_SECURITY -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" #endif namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_compile.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_compile.cc index 8516f6fe782..cf144a82b19 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_compile.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_compile.cc @@ -36,7 +36,7 @@ #include "include/common/utils/anfalgo.h" #include "backend/common/session/kernel_build_client.h" #include "common/util/error_manager/error_manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "frontend/operator/ops.h" #include "utils/ms_context.h" #include "utils/ms_utils.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc index 8cd2683a5a7..0f62ff877e1 100644 --- a/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc +++ b/mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_utils.cc @@ -39,7 +39,7 @@ #include "plugin/device/ascend/kernel/tbe/tbe_json/single_tbe_json_creator.h" #include "securec/include/securec.h" #include "include/common/utils/json_operation_utils.h" -#include "mindspore/ccsrc/debug/common.h" +#include "mindspore/ccsrc/include/common/debug/common.h" #include "kernel/common_utils.h" namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ascend_backend_optimization.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ascend_backend_optimization.cc index d825f4925bd..c0f782538c0 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ascend_backend_optimization.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ascend_backend_optimization.cc @@ -162,12 +162,10 @@ #include "utils/ms_context.h" #include "include/common/utils/config_manager.h" #include "include/common/utils/context/graph_kernel_flags.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" -#include "debug/draw.h" -#ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#endif +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" +#include "include/common/debug/draw.h" + namespace mindspore { namespace opt { namespace { diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_dropoutdomaskv3_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_dropoutdomaskv3_fusion_pass.cc index ade0f782ce6..397103d8015 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_dropoutdomaskv3_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_dropoutdomaskv3_fusion_pass.cc @@ -15,7 +15,7 @@ */ #include "plugin/device/ascend/optimizer/buffer_fusion/batchmatmul_dropoutdomaskv3_fusion_pass.h" #include "kernel/kernel_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "base/core_ops.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc index f6e195f83ed..451e89cc964 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc @@ -16,7 +16,7 @@ #include "plugin/device/ascend/optimizer/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.h" #include "utils/hash_set.h" #include "kernel/kernel_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "base/core_ops.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv_single_in_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv_single_in_fusion_pass.cc index c08497817a0..017ae59cd90 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv_single_in_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/conv_single_in_fusion_pass.cc @@ -16,7 +16,7 @@ #include "plugin/device/ascend/optimizer/buffer_fusion/conv_single_in_fusion_pass.h" #include "utils/hash_set.h" #include "kernel/kernel_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "base/core_ops.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_dropoutdomaskv3_add_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_dropoutdomaskv3_add_fusion_pass.cc index 75fb2a0de7e..b1efefa8c69 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_dropoutdomaskv3_add_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/matmul_dropoutdomaskv3_add_fusion_pass.cc @@ -15,7 +15,7 @@ */ #include "plugin/device/ascend/optimizer/buffer_fusion/matmul_dropoutdomaskv3_add_fusion_pass.h" #include "kernel/kernel_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "base/core_ops.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/reduce_eltwise_fusion_pass.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/reduce_eltwise_fusion_pass.cc index d1efb6e6a49..e1c1e98412b 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/reduce_eltwise_fusion_pass.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/reduce_eltwise_fusion_pass.cc @@ -16,7 +16,7 @@ #include "plugin/device/ascend/optimizer/buffer_fusion/reduce_eltwise_fusion_pass.h" #include #include "kernel/kernel_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" #include "base/core_ops.h" diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/ub_pattern_fusion.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/ub_pattern_fusion.cc index 719ded2c0f2..f0136bdf5f0 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/ub_pattern_fusion.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/ub_pattern_fusion.cc @@ -25,7 +25,7 @@ #include "kernel/common_utils.h" #include "plugin/device/ascend/kernel/tbe/tbe_kernel_compile.h" #include "plugin/device/ascend/kernel/tbe/tbe_utils.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/optimizer/helper.h" namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/enhancer/add_placeholder_for_dynamic_rnn.h b/mindspore/ccsrc/plugin/device/ascend/optimizer/enhancer/add_placeholder_for_dynamic_rnn.h index a0ac119d3d5..3636adfcce1 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/enhancer/add_placeholder_for_dynamic_rnn.h +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/enhancer/add_placeholder_for_dynamic_rnn.h @@ -23,7 +23,7 @@ namespace mindspore { namespace opt { -class InsertPlaceholderForDynamicRNN : public PatternProcessPass { +class BACKEND_EXPORT InsertPlaceholderForDynamicRNN : public PatternProcessPass { public: explicit InsertPlaceholderForDynamicRNN(bool multigraph = true) : PatternProcessPass("add_placeholder_for_dynamic_rnn", multigraph) {} diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/transdata_split.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/transdata_split.cc index 6cd4c729c6b..2e5e533ea05 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/transdata_split.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fission/transdata_split.cc @@ -15,7 +15,7 @@ */ #include "plugin/device/ascend/optimizer/ir_fission/transdata_split.h" #include -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/transposed_update_fusion.cc b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/transposed_update_fusion.cc index 932bde94600..ee1df9a064c 100644 --- a/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/transposed_update_fusion.cc +++ b/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/transposed_update_fusion.cc @@ -19,7 +19,7 @@ #include "plugin/device/ascend/optimizer/ascend_helper.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "utils/trace_base.h" namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/cpu/hal/device/cpu_kernel_runtime.cc b/mindspore/ccsrc/plugin/device/cpu/hal/device/cpu_kernel_runtime.cc index bb787fe2398..dec1612b66d 100644 --- a/mindspore/ccsrc/plugin/device/cpu/hal/device/cpu_kernel_runtime.cc +++ b/mindspore/ccsrc/plugin/device/cpu/hal/device/cpu_kernel_runtime.cc @@ -36,13 +36,12 @@ #include "utils/profile.h" #include "utils/trace_base.h" #include "debug/data_dump/cpu_e2e_dump.h" -#include "debug/env_config_parser.h" +#include "include/common/debug/env_config_parser.h" #ifdef MEM_REUSE_DEBUG #include "common/mem_reuse/mem_reuse_checker.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#include "debug/rdr/recorder_manager.h" +#include "include/common/debug/rdr/recorder_manager.h" #include "debug/rdr/mem_address_recorder.h" #endif diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/akg/akg_cpu_kernel_mod.cc b/mindspore/ccsrc/plugin/device/cpu/kernel/akg/akg_cpu_kernel_mod.cc index 19343cf1dd6..7d71b7b6908 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/akg/akg_cpu_kernel_mod.cc +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/akg/akg_cpu_kernel_mod.cc @@ -26,7 +26,7 @@ #include "kernel/common_utils.h" #include "include/common/thread_pool.h" #include "utils/ms_utils.h" -#include "mindspore/ccsrc/debug/common.h" +#include "mindspore/ccsrc/include/common/debug/common.h" namespace mindspore { namespace kernel { diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/apply_momentum_cpu_kernel.h b/mindspore/ccsrc/plugin/device/cpu/kernel/apply_momentum_cpu_kernel.h index 5cd41077e79..6469882bbdc 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/apply_momentum_cpu_kernel.h +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/apply_momentum_cpu_kernel.h @@ -25,7 +25,7 @@ namespace mindspore { namespace kernel { -class ApplyMomentumCpuKernelMod : public NativeCpuKernelMod { +class BACKEND_EXPORT ApplyMomentumCpuKernelMod : public NativeCpuKernelMod { public: ApplyMomentumCpuKernelMod() = default; ~ApplyMomentumCpuKernelMod() override = default; diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/cpu_kernel.h b/mindspore/ccsrc/plugin/device/cpu/kernel/cpu_kernel.h index aeefc35e724..a4fddd8bc27 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/cpu_kernel.h +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/cpu_kernel.h @@ -35,6 +35,7 @@ #include "ir/anf.h" #include "actor/actormgr.h" #include "include/common/thread_pool.h" +#include "include/backend/visible.h" using mindspore::kernel::Address; using mindspore::kernel::AddressPtr; @@ -127,7 +128,7 @@ struct ParallelSearchInfo { size_t search_count{0}; }; -class NativeCpuKernelMod : public CpuKernelMod { +class BACKEND_EXPORT NativeCpuKernelMod : public CpuKernelMod { public: NativeCpuKernelMod() = default; ~NativeCpuKernelMod() override = default; diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/embedding_look_up_cpu_kernel.h b/mindspore/ccsrc/plugin/device/cpu/kernel/embedding_look_up_cpu_kernel.h index 3e5a509b8f5..acfa3ef326f 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/embedding_look_up_cpu_kernel.h +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/embedding_look_up_cpu_kernel.h @@ -25,7 +25,7 @@ namespace mindspore { namespace kernel { -class EmbeddingLookUpCpuKernelMod : public NativeCpuKernelMod { +class BACKEND_EXPORT EmbeddingLookUpCpuKernelMod : public NativeCpuKernelMod { public: EmbeddingLookUpCpuKernelMod() {} ~EmbeddingLookUpCpuKernelMod() override {} diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/pyfunc/py_func_cpu_kernel.cc b/mindspore/ccsrc/plugin/device/cpu/kernel/pyfunc/py_func_cpu_kernel.cc index d37c1d50f4f..aadf3d1cd8b 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/pyfunc/py_func_cpu_kernel.cc +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/pyfunc/py_func_cpu_kernel.cc @@ -22,7 +22,7 @@ #include "Eigen/src/Core/arch/CUDA/Half.h" #include "abstract/utils.h" #include "plugin/device/cpu/hal/device/cpu_common.h" -#include "pybind_api/ir/tensor_py.h" +#include "include/common/utils/python_adapter.h" #include "plugin/factory/ms_factory.h" namespace mindspore { @@ -181,7 +181,7 @@ py::tuple RawMemoryToPyObjects(const std::vector &inputs, const PyFu const tensor::TensorPtr &tensor = input_tensors[i]; CHECK_RET_WITH_EXCEPT(memcpy_s(tensor->data_c(), tensor->Size(), inputs[i]->addr, inputs[i]->size), EOK, "memcpy failed."); - result[i] = tensor::TensorPy::AsNumpy(*tensor); + result[i] = python_adapter::PyAdapterCallback::TensorToNumpy(*tensor); break; } default: diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_adam_cpu_kernel.h b/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_adam_cpu_kernel.h index ffee10a0bb3..532aef8f397 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_adam_cpu_kernel.h +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_adam_cpu_kernel.h @@ -22,7 +22,7 @@ namespace mindspore { namespace kernel { -class SparseApplyAdamCpuKernelMod : public SparseOptimizerCpuKernelMod { +class BACKEND_EXPORT SparseApplyAdamCpuKernelMod : public SparseOptimizerCpuKernelMod { public: SparseApplyAdamCpuKernelMod() = default; ~SparseApplyAdamCpuKernelMod() override = default; diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_ftrl_cpu_kernel.h b/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_ftrl_cpu_kernel.h index d338c14e921..024505e35fd 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_ftrl_cpu_kernel.h +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_ftrl_cpu_kernel.h @@ -22,7 +22,7 @@ namespace mindspore { namespace kernel { -class SparseApplyFtrlCpuKernelMod : public SparseOptimizerCpuKernelMod { +class BACKEND_EXPORT SparseApplyFtrlCpuKernelMod : public SparseOptimizerCpuKernelMod { public: SparseApplyFtrlCpuKernelMod() = default; ~SparseApplyFtrlCpuKernelMod() override = default; diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_lazy_adam_cpu_kernel.h b/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_lazy_adam_cpu_kernel.h index a9c21d751b2..1201dc5a050 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_lazy_adam_cpu_kernel.h +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/sparse_apply_lazy_adam_cpu_kernel.h @@ -22,7 +22,7 @@ namespace mindspore { namespace kernel { -class SparseApplyLazyAdamCpuKernelMod : public SparseOptimizerCpuKernelMod { +class BACKEND_EXPORT SparseApplyLazyAdamCpuKernelMod : public SparseOptimizerCpuKernelMod { public: SparseApplyLazyAdamCpuKernelMod() = default; ~SparseApplyLazyAdamCpuKernelMod() override = default; diff --git a/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_fake_init.h b/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_fake_init.h index 52f1e1f6f40..54c344aad4f 100644 --- a/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_fake_init.h +++ b/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_fake_init.h @@ -17,12 +17,13 @@ #ifndef MINDSPORE_CCSRC_RUNTIME_DEVICE_GPU_DISTRIBUTION_COLLECTIVE_FAKE_INIT_H_ #define MINDSPORE_CCSRC_RUNTIME_DEVICE_GPU_DISTRIBUTION_COLLECTIVE_FAKE_INIT_H_ -#include "string" +#include +#include "include/backend/visible.h" namespace mindspore { namespace device { namespace gpu { -class CollectiveFakeInitializer { +class BACKEND_EXPORT CollectiveFakeInitializer { public: CollectiveFakeInitializer() = default; ~CollectiveFakeInitializer() = default; diff --git a/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_init.h b/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_init.h index 93d6fada53a..76f6d1d7686 100644 --- a/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_init.h +++ b/mindspore/ccsrc/plugin/device/gpu/hal/device/distribution/collective_init.h @@ -20,6 +20,7 @@ #include #include #include +#include "include/backend/visible.h" namespace mindspore { namespace device { @@ -32,7 +33,7 @@ using GetRankIDByGroupFunc = int (*)(const std::string &); using GetGroupSizeFunc = int (*)(const std::string &); using DestroyGroupFunc = bool (*)(const std::string &); -class CollectiveInitializer { +class BACKEND_EXPORT CollectiveInitializer { public: CollectiveInitializer(CollectiveInitializer const &) = delete; CollectiveInitializer &operator=(const CollectiveInitializer &) = delete; diff --git a/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_device_address.cc b/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_device_address.cc index 0310aa31dfe..9830ec50dfa 100644 --- a/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_device_address.cc +++ b/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_device_address.cc @@ -29,7 +29,7 @@ #include "debug/debugger/debugger.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" #endif namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_kernel_runtime.cc b/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_kernel_runtime.cc index 332cb23279b..cababbb3764 100644 --- a/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_kernel_runtime.cc +++ b/mindspore/ccsrc/plugin/device/gpu/hal/device/gpu_kernel_runtime.cc @@ -16,7 +16,7 @@ #include "plugin/device/gpu/hal/device/gpu_kernel_runtime.h" #include #include -#include "debug/anf_ir_utils.h" +#include "include/common/debug/anf_dump_utils.h" #include "plugin/device/gpu/hal/device/gpu_device_address.h" #include "plugin/device/gpu/hal/device/cuda_driver.h" #include "plugin/device/gpu/hal/device/gpu_event.h" @@ -48,8 +48,7 @@ #include "debug/debug_services.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" -#include "debug/rdr/recorder_manager.h" +#include "include/common/debug/rdr/recorder_manager.h" #include "debug/rdr/mem_address_recorder.h" #endif diff --git a/mindspore/ccsrc/plugin/device/gpu/hal/hardware/gpu_device_context.cc b/mindspore/ccsrc/plugin/device/gpu/hal/hardware/gpu_device_context.cc index fee1568949b..89afefd2558 100644 --- a/mindspore/ccsrc/plugin/device/gpu/hal/hardware/gpu_device_context.cc +++ b/mindspore/ccsrc/plugin/device/gpu/hal/hardware/gpu_device_context.cc @@ -38,7 +38,8 @@ #include "backend/common/session/kernel_graph.h" #include "plugin/device/gpu/kernel/gpu_kernel.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" +#include "debug/rdr/mem_address_recorder.h" #endif #include "include/common/utils/comm_manager.h" #ifdef ENABLE_DEBUGGER diff --git a/mindspore/ccsrc/plugin/device/gpu/kernel/data/dataset_iterator_kernel.cc b/mindspore/ccsrc/plugin/device/gpu/kernel/data/dataset_iterator_kernel.cc index 890237be68b..31e16003110 100644 --- a/mindspore/ccsrc/plugin/device/gpu/kernel/data/dataset_iterator_kernel.cc +++ b/mindspore/ccsrc/plugin/device/gpu/kernel/data/dataset_iterator_kernel.cc @@ -29,7 +29,7 @@ #include "plugin/device/gpu/hal/device/gpu_buffer_mgr.h" #include "plugin/device/gpu/hal/device/gpu_common.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" #endif namespace mindspore { diff --git a/mindspore/ccsrc/plugin/device/gpu/optimizer/trt_pass/graph_partitioner.cc b/mindspore/ccsrc/plugin/device/gpu/optimizer/trt_pass/graph_partitioner.cc index 7f62e82de75..c2e674e186a 100644 --- a/mindspore/ccsrc/plugin/device/gpu/optimizer/trt_pass/graph_partitioner.cc +++ b/mindspore/ccsrc/plugin/device/gpu/optimizer/trt_pass/graph_partitioner.cc @@ -30,7 +30,7 @@ #include "include/common/utils/anfalgo.h" #include "plugin/device/gpu/optimizer/trt_pass/trt_op_factory.h" #include "backend/graph_compiler/segment_runner.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/mindspore/ccsrc/profiler/device/ascend/ascend_profiling.cc b/mindspore/ccsrc/profiler/device/ascend/ascend_profiling.cc index b0d685490bc..0d267f32077 100644 --- a/mindspore/ccsrc/profiler/device/ascend/ascend_profiling.cc +++ b/mindspore/ccsrc/profiler/device/ascend/ascend_profiling.cc @@ -17,7 +17,7 @@ #include #include #include "common/util/error_manager/error_manager.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "utils/log_adapter.h" #include "include/common/utils/utils.h" #include "profiler/device/ascend/memory_profiling.h" diff --git a/mindspore/ccsrc/profiler/device/ascend/options.cc b/mindspore/ccsrc/profiler/device/ascend/options.cc index 8357da2b1aa..697fe3e6173 100644 --- a/mindspore/ccsrc/profiler/device/ascend/options.cc +++ b/mindspore/ccsrc/profiler/device/ascend/options.cc @@ -17,7 +17,7 @@ #include #include "profiler/device/ascend/options.h" #include "utils/ms_context.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "profiler/device/ascend/ascend_profiling.h" constexpr char kOutputPath[] = "output"; diff --git a/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.cc b/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.cc index fd6daefd658..681ba721593 100644 --- a/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.cc +++ b/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.cc @@ -18,9 +18,8 @@ #include #include "sys/stat.h" -#include "debug/dump_proto.h" +#include "include/common/debug/dump_proto.h" #include "include/common/utils/parallel_context.h" -#include "frontend/parallel/device_manager.h" #include "profiler/device/ascend/options.h" #include "profiler/device/ascend/ascend_profiling.h" #include "proto/profiling_parallel.pb.h" @@ -84,24 +83,34 @@ irpb::ProfilingParallel GetProfilingParallel(const FuncGraphPtr &func_graph) { GetFuncGraphProto(func_graph, graph_proto); // set parallel model - std::string parallel_mode = parallel::ParallelContext::GetInstance()->parallel_mode(); + auto parallel_context = parallel::ParallelContext::GetInstance(); + MS_EXCEPTION_IF_NULL(parallel_context); + std::string parallel_mode = parallel_context->parallel_mode(); irpb::Config *config = profiling_parallel.mutable_config(); MS_EXCEPTION_IF_NULL(config); config->set_parallel_type(parallel_mode); - // Note: Only parallel mode is AUTO_PARALLEL or SEMI_AUTO_PARALLEL, the - // g_device_manager is not nullptr; - if (parallel::g_device_manager != nullptr) { - auto rank_id = parallel::g_device_manager->global_rank(); - auto stage_id = parallel::g_device_manager->stage_id(); + if (parallel_context->parallel_mode() == parallel::kAutoParallel || + parallel_context->parallel_mode() == parallel::kSemiAutoParallel) { + uint32_t rank_id = CommManager::GetInstance().GetRank(); + uint32_t rank_size = 0; + bool ret = CommManager::GetInstance().GetRankSize(kHcclWorldGroup, &rank_size); + if (!ret) { + MS_LOG(EXCEPTION) << "Get rank size failed."; + } + int64_t stage_num = parallel_context->pipeline_stage_split_num(); + if (static_cast(rank_size) % stage_num != 0) { + MS_LOG(EXCEPTION) << "Invalid stage num " << stage_num << " is not divisible by rank size " << rank_size; + } + int64_t device_per_stage = static_cast(rank_size) / stage_num; + int64_t stage_id = static_cast(rank_id) / device_per_stage; config->set_rank_id(rank_id); - config->set_stage_id(stage_id); - - // set stage_devices - for (std::vector devices : parallel::g_device_manager->stage_devices()) { + config->set_stage_id(IntToUint(LongToInt(stage_id))); + int64_t device = 0; + for (int64_t i = 0; i < stage_num; ++i) { irpb::TensorShapeProto *stage_devices = config->add_stage_devices(); MS_EXCEPTION_IF_NULL(stage_devices); - for (int64_t device : devices) { + for (int64_t j = 0; j < device_per_stage && device < static_cast(rank_size); ++j, ++device) { stage_devices->add_dim()->set_size(device); } } diff --git a/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.h b/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.h index 5f1bdbba7d7..22fec083fae 100644 --- a/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.h +++ b/mindspore/ccsrc/profiler/device/ascend/parallel_strategy_profiling.h @@ -20,11 +20,12 @@ #include "ir/func_graph.h" #include "base/base.h" +#include "include/backend/visible.h" namespace mindspore { namespace profiler { namespace ascend { -void DumpProfileParallelStrategy(const FuncGraphPtr &func_graph); +BACKEND_EXPORT void DumpProfileParallelStrategy(const FuncGraphPtr &func_graph); void SaveParallelStrategyToFile(); } // namespace ascend } // namespace profiler diff --git a/mindspore/ccsrc/profiler/device/ascend/pynative_profiling.cc b/mindspore/ccsrc/profiler/device/ascend/pynative_profiling.cc index 54ce6efa1f0..cf2701b8b96 100644 --- a/mindspore/ccsrc/profiler/device/ascend/pynative_profiling.cc +++ b/mindspore/ccsrc/profiler/device/ascend/pynative_profiling.cc @@ -22,7 +22,7 @@ #include "include/common/utils/utils.h" #include "profiler/device/profiling.h" #include "profiler/device/ascend/pynative_profiling.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { namespace profiler { diff --git a/mindspore/ccsrc/profiler/device/cpu/cpu_profiling.cc b/mindspore/ccsrc/profiler/device/cpu/cpu_profiling.cc index f8d8353388e..3c15a39adc2 100644 --- a/mindspore/ccsrc/profiler/device/cpu/cpu_profiling.cc +++ b/mindspore/ccsrc/profiler/device/cpu/cpu_profiling.cc @@ -20,7 +20,7 @@ #include #include #include "profiler/device/cpu/cpu_data_saver.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "utils/log_adapter.h" #include "include/common/utils/utils.h" #include "utils/ms_context.h" diff --git a/mindspore/ccsrc/profiler/device/gpu/gpu_profiling.cc b/mindspore/ccsrc/profiler/device/gpu/gpu_profiling.cc index 7b1a3393efc..ff491212e23 100644 --- a/mindspore/ccsrc/profiler/device/gpu/gpu_profiling.cc +++ b/mindspore/ccsrc/profiler/device/gpu/gpu_profiling.cc @@ -22,7 +22,7 @@ #include #include "profiler/device/gpu/cupti_interface.h" #include "profiler/device/gpu/gpu_data_saver.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "utils/log_adapter.h" #include "include/common/utils/utils.h" #include "utils/profile.h" diff --git a/mindspore/ccsrc/profiler/device/profiling.cc b/mindspore/ccsrc/profiler/device/profiling.cc index f791419c047..93ce6dfb190 100644 --- a/mindspore/ccsrc/profiler/device/profiling.cc +++ b/mindspore/ccsrc/profiler/device/profiling.cc @@ -19,7 +19,7 @@ #include #include #include -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "utils/log_adapter.h" #include "include/common/utils/utils.h" #if ENABLE_GPU diff --git a/mindspore/ccsrc/ps/core/abstract_node.h b/mindspore/ccsrc/ps/core/abstract_node.h index bc4d1db16c0..95bf95fdf14 100644 --- a/mindspore/ccsrc/ps/core/abstract_node.h +++ b/mindspore/ccsrc/ps/core/abstract_node.h @@ -34,12 +34,13 @@ #include "ps/core/recovery_base.h" #include "ps/core/communicator/task_executor.h" #include "ps/core/communicator/communicator_base.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { namespace core { class FollowerScaler; -class AbstractNode : public Node { +class BACKEND_EXPORT AbstractNode : public Node { public: AbstractNode() : heart_beat_thread_(nullptr), diff --git a/mindspore/ccsrc/ps/core/file_configuration.h b/mindspore/ccsrc/ps/core/file_configuration.h index 5a328d5b0ce..876540ab2aa 100644 --- a/mindspore/ccsrc/ps/core/file_configuration.h +++ b/mindspore/ccsrc/ps/core/file_configuration.h @@ -33,6 +33,7 @@ #include "utils/log_adapter.h" #include "ps/core/comm_util.h" #include "ps/core/configuration.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { @@ -46,7 +47,7 @@ namespace core { // "server_num": 16, // "total_node_num": 16 //} -class FileConfiguration : public Configuration { +class BACKEND_EXPORT FileConfiguration : public Configuration { public: explicit FileConfiguration(const std::string &path) : file_path_(path), is_initialized_(false) {} ~FileConfiguration() = default; diff --git a/mindspore/ccsrc/ps/core/node.h b/mindspore/ccsrc/ps/core/node.h index 31de877ac1c..839ee85fee8 100644 --- a/mindspore/ccsrc/ps/core/node.h +++ b/mindspore/ccsrc/ps/core/node.h @@ -38,6 +38,7 @@ #include "ps/core/communicator/tcp_client.h" #include "ps/core/communicator/tcp_server.h" #include "ps/core/file_configuration.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { @@ -45,7 +46,7 @@ namespace core { constexpr int kTimeoutInSeconds = 30; constexpr int kCommTimeoutInSeconds = 10; constexpr int kCommTimeoutInThreeSeconds = 3; -class Node { +class BACKEND_EXPORT Node { public: Node() : is_ready_(false), diff --git a/mindspore/ccsrc/ps/core/ps_scheduler_node.h b/mindspore/ccsrc/ps/core/ps_scheduler_node.h index 2632ab04f62..27a96f4f413 100644 --- a/mindspore/ccsrc/ps/core/ps_scheduler_node.h +++ b/mindspore/ccsrc/ps/core/ps_scheduler_node.h @@ -19,6 +19,7 @@ #include "ps/core/scheduler_node.h" #include "ps/core/node_info.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { @@ -26,7 +27,7 @@ namespace core { // This class is a derived class of SchedulerNode specialized for Parameter Server. It is used to rewrite the specific // logic for Parameter Server mode training in SchedulerNode. For example, the Scheduler of Parameter Server will reject // the registration request of alive nodes. -class PSSchedulerNode : public SchedulerNode { +class BACKEND_EXPORT PSSchedulerNode : public SchedulerNode { public: PSSchedulerNode() = default; ~PSSchedulerNode() override = default; diff --git a/mindspore/ccsrc/ps/core/ps_worker_node.h b/mindspore/ccsrc/ps/core/ps_worker_node.h index 1d1a6ab7324..23ddf2c5077 100644 --- a/mindspore/ccsrc/ps/core/ps_worker_node.h +++ b/mindspore/ccsrc/ps/core/ps_worker_node.h @@ -19,6 +19,7 @@ #include #include "ps/core/abstract_ps_node.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { @@ -26,7 +27,7 @@ namespace core { // This class is a derived class of WorkerNode specialized for Parameter Server. It is used to rewrite the logic // specific to Parameter Server mode training in WorkerNode. For example, the registration of Parameter Server's Worker // node is synchronous. -class PSWorkerNode : public AbstractPSNode { +class BACKEND_EXPORT PSWorkerNode : public AbstractPSNode { public: PSWorkerNode() = default; ~PSWorkerNode() override = default; diff --git a/mindspore/ccsrc/ps/core/scheduler_node.h b/mindspore/ccsrc/ps/core/scheduler_node.h index 6de737c6ece..123cd4f5714 100644 --- a/mindspore/ccsrc/ps/core/scheduler_node.h +++ b/mindspore/ccsrc/ps/core/scheduler_node.h @@ -43,12 +43,13 @@ #include "ps/core/recovery_base.h" #include "ps/core/instance_manager.h" #include "distributed/cluster/actor_route_table_service.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { namespace core { using distributed::cluster::ActorRouteTableService; -class SchedulerNode : public Node { +class BACKEND_EXPORT SchedulerNode : public Node { public: SchedulerNode() : server_(nullptr), diff --git a/mindspore/ccsrc/ps/core/worker_node.h b/mindspore/ccsrc/ps/core/worker_node.h index 0789a380670..d3f4ef1227a 100644 --- a/mindspore/ccsrc/ps/core/worker_node.h +++ b/mindspore/ccsrc/ps/core/worker_node.h @@ -28,11 +28,12 @@ #include "ps/core/communicator/tcp_client.h" #include "ps/core/communicator/tcp_server.h" #include "ps/core/abstract_node.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { namespace core { -class WorkerNode : public AbstractNode { +class BACKEND_EXPORT WorkerNode : public AbstractNode { public: WorkerNode() = default; ~WorkerNode() override = default; diff --git a/mindspore/ccsrc/ps/parameter_server.cc b/mindspore/ccsrc/ps/parameter_server.cc index e9ff896d4c1..a10d9c68c6c 100644 --- a/mindspore/ccsrc/ps/parameter_server.cc +++ b/mindspore/ccsrc/ps/parameter_server.cc @@ -26,6 +26,11 @@ namespace ps { static const uint32_t kMaxThreadNum = 16; static const uint32_t kCPUCoreNum = std::thread::hardware_concurrency(); +ParameterServer &ParameterServer::GetInstance() { + static ParameterServer instance{}; + return instance; +} + void ParameterServer::Run(const FuncGraphPtr &func_graph) { MS_EXCEPTION_IF_NULL(func_graph); MS_LOG(INFO) << "PServer starts connecting to scheduler and workers..."; diff --git a/mindspore/ccsrc/ps/parameter_server.h b/mindspore/ccsrc/ps/parameter_server.h index db5b2cffa8b..d8a348670c8 100644 --- a/mindspore/ccsrc/ps/parameter_server.h +++ b/mindspore/ccsrc/ps/parameter_server.h @@ -63,16 +63,13 @@ #include "proto/ps.pb.h" #include "ps/core/ps_server_node.h" #include "ps/core/node.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { -class ParameterServer { +class BACKEND_EXPORT ParameterServer { public: - static ParameterServer &GetInstance() { - static ParameterServer instance; - return instance; - } - + static ParameterServer &GetInstance(); void Run(const FuncGraphPtr &func_graph); private: diff --git a/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.cc b/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.cc index 45aeb8dc564..c8659a9aaf9 100644 --- a/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.cc +++ b/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.cc @@ -144,6 +144,11 @@ const size_t &PsCacheManager::QueryHashTableSize(const std::string ¶m_name) return iter->second.cache_vocab_size; } +PsCacheManager &PsCacheManager::GetInstance() { + static PsCacheManager instance{}; + return instance; +} + void PsCacheManager::Initialize() { MS_LOG(INFO) << "PS cache initialize."; if (!Worker::GetInstance().running()) { diff --git a/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.h b/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.h index 3a33b0129d1..ee1841c6d36 100644 --- a/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.h +++ b/mindspore/ccsrc/ps/ps_cache/ps_cache_manager.h @@ -35,6 +35,7 @@ #include "ps/ps_cache/ps_data/ps_data_prefetch.h" #include "ps/ps_cache/embedding_hash_map.h" #include "ps/ps_cache/ps_cache_factory.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { @@ -108,12 +109,9 @@ struct PsCacheStatisticsInfo { size_t mem_cache_hit_count_{0}; }; -class PsCacheManager { +class BACKEND_EXPORT PsCacheManager { public: - static PsCacheManager &GetInstance() { - static PsCacheManager instance; - return instance; - } + static PsCacheManager &GetInstance(); void Initialize(); void InsertHashTableSize(const std::string ¶m_name, size_t cache_vocab_size, size_t embedding_size, size_t vocab_size); diff --git a/mindspore/ccsrc/ps/ps_context.h b/mindspore/ccsrc/ps/ps_context.h index 4746953ed0f..bdc590e1dec 100644 --- a/mindspore/ccsrc/ps/ps_context.h +++ b/mindspore/ccsrc/ps/ps_context.h @@ -23,6 +23,7 @@ #include "ps/constants.h" #include "ps/core/cluster_metadata.h" #include "ps/core/cluster_config.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { @@ -54,7 +55,7 @@ const std::map kServerContextToResetRoundMap = {{0b0010 {0b1100, ResetterRound::kPushMetrics}, {0b0100, ResetterRound::kPushMetrics}}; -class PSContext { +class BACKEND_EXPORT PSContext { public: ~PSContext() = default; PSContext(PSContext const &) = delete; diff --git a/mindspore/ccsrc/ps/scheduler.cc b/mindspore/ccsrc/ps/scheduler.cc index fa952ee3584..086da46515e 100755 --- a/mindspore/ccsrc/ps/scheduler.cc +++ b/mindspore/ccsrc/ps/scheduler.cc @@ -18,6 +18,11 @@ namespace mindspore { namespace ps { +Scheduler &Scheduler::GetInstance() { + static Scheduler instance{}; + return instance; +} + void Scheduler::Run() { MS_LOG(INFO) << "Start scheduler."; PSContext::instance()->cluster_config().scheduler_host = PSContext::instance()->scheduler_host(); diff --git a/mindspore/ccsrc/ps/scheduler.h b/mindspore/ccsrc/ps/scheduler.h index 5f274241217..adda3be695c 100755 --- a/mindspore/ccsrc/ps/scheduler.h +++ b/mindspore/ccsrc/ps/scheduler.h @@ -22,15 +22,13 @@ #include "ps/core/ps_scheduler_node.h" #include "ps/util.h" #include "ps/ps_context.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { -class Scheduler { +class BACKEND_EXPORT Scheduler { public: - static Scheduler &GetInstance() { - static Scheduler instance; - return instance; - } + static Scheduler &GetInstance(); void Run(); diff --git a/mindspore/ccsrc/ps/util.h b/mindspore/ccsrc/ps/util.h index e3f479e5c32..ad39c6db670 100644 --- a/mindspore/ccsrc/ps/util.h +++ b/mindspore/ccsrc/ps/util.h @@ -28,6 +28,7 @@ #include "include/common/utils/anfalgo.h" #include "kernel/common_utils.h" #include "plugin/device/cpu/kernel/sparse_optimizer_cpu_kernel.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { @@ -44,7 +45,7 @@ struct ParamInitInfo { constexpr size_t kNodeInputWeightNameOffset = 1; constexpr size_t kNodeInputWeightIndexOffset = 2; -class Util { +class BACKEND_EXPORT Util { public: static bool IsRoleOfPServer(); static bool IsRoleOfScheduler(); diff --git a/mindspore/ccsrc/ps/worker.cc b/mindspore/ccsrc/ps/worker.cc index 0619e6c8402..f086b90ab59 100644 --- a/mindspore/ccsrc/ps/worker.cc +++ b/mindspore/ccsrc/ps/worker.cc @@ -23,6 +23,11 @@ namespace { constexpr int kRetryDuration = 2000; } // namespace +Worker &Worker::GetInstance() { + static Worker instance{}; + return instance; +} + void Worker::Run() { std::lock_guard lock(running_mutex_); diff --git a/mindspore/ccsrc/ps/worker.h b/mindspore/ccsrc/ps/worker.h index 7b9b7553e32..ef996788953 100644 --- a/mindspore/ccsrc/ps/worker.h +++ b/mindspore/ccsrc/ps/worker.h @@ -40,15 +40,13 @@ #include "proto/comm.pb.h" #include "proto/ps.pb.h" #include "ps/ps_context.h" +#include "include/backend/visible.h" namespace mindspore { namespace ps { -class Worker { +class BACKEND_EXPORT Worker { public: - static Worker &GetInstance() { - static Worker instance; - return instance; - } + static Worker &GetInstance(); using Callback = std::function; using PartitionEmbeddingMessages = std::vector>; using PartitionKVMessages = std::vector>; diff --git a/mindspore/ccsrc/pybind_api/ir/anf_py.cc b/mindspore/ccsrc/pybind_api/ir/anf_py.cc index 6311b3e717e..5e2fb17b0ee 100644 --- a/mindspore/ccsrc/pybind_api/ir/anf_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/anf_py.cc @@ -16,7 +16,7 @@ #include #include "ir/anf.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // Define python 'RefKey' class. diff --git a/mindspore/ccsrc/pybind_api/ir/cell_py.cc b/mindspore/ccsrc/pybind_api/ir/cell_py.cc index d901a9ca5be..3b352679c84 100644 --- a/mindspore/ccsrc/pybind_api/ir/cell_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/cell_py.cc @@ -17,7 +17,7 @@ #include "pybind_api/ir/cell_py.h" #include -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "abstract/abstract_value.h" #include "pipeline/jit/parse/data_converter.h" diff --git a/mindspore/ccsrc/pybind_api/ir/dtype_py.cc b/mindspore/ccsrc/pybind_api/ir/dtype_py.cc index dadd75c9c6e..6a07e6e490c 100644 --- a/mindspore/ccsrc/pybind_api/ir/dtype_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/dtype_py.cc @@ -17,7 +17,7 @@ #include "ir/dtype.h" #include "utils/log_adapter.h" #include "abstract/abstract_value.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // Define python wrapper to handle data types. diff --git a/mindspore/ccsrc/pybind_api/ir/func_graph_py.cc b/mindspore/ccsrc/pybind_api/ir/func_graph_py.cc index 54a126e8704..0323a8e3cc4 100644 --- a/mindspore/ccsrc/pybind_api/ir/func_graph_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/func_graph_py.cc @@ -17,7 +17,7 @@ #include "ir/meta_func_graph.h" #include "ir/func_graph.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { py::dict UpdateFuncGraphHyperParams(const FuncGraphPtr &func_graph, const py::dict ¶ms_init) { diff --git a/mindspore/ccsrc/pybind_api/ir/param_info_py.cc b/mindspore/ccsrc/pybind_api/ir/param_info_py.cc index 498a454f3b2..66996706483 100644 --- a/mindspore/ccsrc/pybind_api/ir/param_info_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/param_info_py.cc @@ -15,7 +15,7 @@ */ #include "ir/param_info.h" #include "pybind11/pybind11.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { namespace py = pybind11; diff --git a/mindspore/ccsrc/pybind_api/ir/primitive_py.cc b/mindspore/ccsrc/pybind_api/ir/primitive_py.cc index 829f6906231..d900bd6fd37 100644 --- a/mindspore/ccsrc/pybind_api/ir/primitive_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/primitive_py.cc @@ -23,7 +23,7 @@ #include "pipeline/jit/parse/data_converter.h" #include "include/common/utils/python_adapter.h" #include "pybind11/pytypes.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "pybind_api/export_flags.h" #include "pybind_api/ir/base_ref_py.h" #include "utils/convert_utils_base.h" @@ -102,6 +102,17 @@ py::tuple ConstructCellHookFnArgs(const std::string &cell_id, const py::object & } return hook_fn_args; } + +struct RunPrimitivePyHookFunctionRegister { + RunPrimitivePyHookFunctionRegister() { + python_adapter::PyAdapterCallback::SetRunPrimitivePyHookFunctionHandler( + [](const PrimitivePtr &prim, const VectorRef &args) -> BaseRef { + auto py_prim = prim->cast(); + MS_EXCEPTION_IF_NULL(py_prim); + return py_prim->RunHookFunction(args); + }); + } +} callback_register; } // namespace std::map PrimitivePy::hook_grad_; diff --git a/mindspore/ccsrc/pybind_api/ir/signature_py.cc b/mindspore/ccsrc/pybind_api/ir/signature_py.cc index 33f4db626f5..eb17be25d0f 100644 --- a/mindspore/ccsrc/pybind_api/ir/signature_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/signature_py.cc @@ -16,7 +16,7 @@ #include "ir/signature.h" #include "pybind11/operators.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "pipeline/jit/parse/data_converter.h" namespace py = pybind11; diff --git a/mindspore/ccsrc/pybind_api/ir/tensor_py.cc b/mindspore/ccsrc/pybind_api/ir/tensor_py.cc index 15a5db728d0..92fab4d7946 100644 --- a/mindspore/ccsrc/pybind_api/ir/tensor_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/tensor_py.cc @@ -18,13 +18,19 @@ #include -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "abstract/abstract_value.h" #include "utils/shape_utils.h" #include "utils/cache_embedding_hashmap_struct.h" +#include "include/common/utils/python_adapter.h" namespace mindspore { namespace tensor { +namespace { +struct TensorToNumpyRegister { + TensorToNumpyRegister() { python_adapter::PyAdapterCallback::SetTensorToNumpyHandler(tensor::TensorPy::AsNumpy); } +} callback_register; +} // namespace constexpr ssize_t kPyBufItemSize1 = 1; constexpr ssize_t kPyBufItemSize2 = 2; constexpr ssize_t kPyBufItemSize4 = 4; diff --git a/mindspore/ccsrc/pybind_api/ir/value_py.cc b/mindspore/ccsrc/pybind_api/ir/value_py.cc index e0d49e77194..e5906686b7f 100644 --- a/mindspore/ccsrc/pybind_api/ir/value_py.cc +++ b/mindspore/ccsrc/pybind_api/ir/value_py.cc @@ -17,7 +17,7 @@ #include "ir/value.h" #include -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "abstract/abstract_value.h" namespace mindspore { diff --git a/mindspore/ccsrc/pybind_api/random_normal/random_cpu_kernel.h b/mindspore/ccsrc/pybind_api/random_normal/random_cpu_kernel.h index e4e0d12a31d..9deb348675b 100644 --- a/mindspore/ccsrc/pybind_api/random_normal/random_cpu_kernel.h +++ b/mindspore/ccsrc/pybind_api/random_normal/random_cpu_kernel.h @@ -16,9 +16,9 @@ #ifndef PYBIND_API_API_IR_RANDOM_NORMAL_RANDOM_CPU_KERNEL_H_ #define PYBIND_API_API_IR_RANDOM_NORMAL_RANDOM_CPU_KERNEL_H_ #include -#include "pybind_api/random_normal/philox_generator.h" +#include "include/common/utils/philox_generator.h" #include "pybind11/pybind11.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" #include "utils/log_adapter.h" namespace py = pybind11; @@ -42,10 +42,10 @@ class NormalDistribution { return true; } - std::array operator()(T *generator) { + std::array operator()(T *generator) { std::array generate_value = (*generator)(); const float PI = 3.14; - for (uint32_t i = 0; i < gResultNum; i += 2) { + for (uint32_t i = 0; i < kResultNum; i += 2) { float temp[2]; UInt32ToFloat32(generate_value[i], &temp[0]); UInt32ToFloat32(generate_value[i + 1], &temp[1]); @@ -59,31 +59,9 @@ class NormalDistribution { } private: - std::array result_; + std::array result_; }; -template -bool FillRandoms(PhiloxGenerator generator, float *output, int64_t vet_size, int64_t thread_Id) { - T distribution; - errno_t mem_ret; - generator.JumpStep((vet_size * thread_Id + gResultNum - 1) / gResultNum); - for (int32_t i = 0; i < vet_size; i += gResultNum) { - auto outputResult = distribution(&generator); - size_t max_length = 0; - if (vet_size - i >= gResultNum) { - max_length = gResultNum * sizeof(float); - mem_ret = memcpy_s(&output[i], max_length, &outputResult[0], max_length); - } else { - max_length = (vet_size - i) * sizeof(float); - mem_ret = memcpy_s(&output[i], max_length, &outputResult[0], max_length); - } - if (mem_ret != EOK) { - MS_LOG(ERROR) << "FillRandoms memcpy is failed"; - return false; - } - } - return true; -} bool InitRandomNormal(std::vector out_shape, int64_t seed, int64_t seed2, const py::object &output_tensor); } // namespace mindspore diff --git a/mindspore/ccsrc/pybind_api/utils/ms_context_py.cc b/mindspore/ccsrc/pybind_api/utils/ms_context_py.cc index d9e4b8fca17..175f2d8cf8e 100644 --- a/mindspore/ccsrc/pybind_api/utils/ms_context_py.cc +++ b/mindspore/ccsrc/pybind_api/utils/ms_context_py.cc @@ -18,7 +18,7 @@ #include #include "utils/ms_context.h" #include "utils/log_adapter.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { namespace { diff --git a/mindspore/ccsrc/pybind_api/utils/security_py.cc b/mindspore/ccsrc/pybind_api/utils/security_py.cc index 53b5c198fd5..692e4fb900d 100644 --- a/mindspore/ccsrc/pybind_api/utils/security_py.cc +++ b/mindspore/ccsrc/pybind_api/utils/security_py.cc @@ -15,7 +15,7 @@ */ #include "include/common/utils/utils.h" -#include "pybind_api/api_register.h" +#include "include/common/pybind_api/api_register.h" namespace mindspore { // Get whether security is enable diff --git a/mindspore/ccsrc/runtime/device/context_extends.h b/mindspore/ccsrc/runtime/device/context_extends.h index f2c188e85e1..555697af566 100644 --- a/mindspore/ccsrc/runtime/device/context_extends.h +++ b/mindspore/ccsrc/runtime/device/context_extends.h @@ -22,19 +22,22 @@ #include #include "utils/ms_context.h" #include "include/common/utils/tensorprint_utils.h" +#include "include/backend/visible.h" namespace mindspore { namespace context { -bool OpenTsd(const std::shared_ptr &ms_context_ptr); -bool CloseTsd(const std::shared_ptr &ms_context_ptr, bool force = false); -void SetHcclOptions(const std::shared_ptr &inst_context, std::map *ge_options); -void GetGeOptions(const std::shared_ptr &inst_context, std::map *ge_options); -void SetDisableReuseMemoryFlag(std::map *ge_options); -bool InitGe(const std::shared_ptr &inst_context); -bool FinalizeGe(const std::shared_ptr &inst_context, bool force = false); -bool PynativeInitGe(const std::shared_ptr &inst_context); -bool IsTsdOpened(const std::shared_ptr &inst_context); -bool IsGeInited(const std::shared_ptr &inst_context); +BACKEND_EXPORT bool OpenTsd(const std::shared_ptr &ms_context_ptr); +BACKEND_EXPORT bool CloseTsd(const std::shared_ptr &ms_context_ptr, bool force = false); +BACKEND_EXPORT void SetHcclOptions(const std::shared_ptr &inst_context, + std::map *ge_options); +BACKEND_EXPORT void GetGeOptions(const std::shared_ptr &inst_context, + std::map *ge_options); +BACKEND_EXPORT void SetDisableReuseMemoryFlag(std::map *ge_options); +BACKEND_EXPORT bool InitGe(const std::shared_ptr &inst_context); +BACKEND_EXPORT bool FinalizeGe(const std::shared_ptr &inst_context, bool force = false); +BACKEND_EXPORT bool PynativeInitGe(const std::shared_ptr &inst_context); +BACKEND_EXPORT bool IsTsdOpened(const std::shared_ptr &inst_context); +BACKEND_EXPORT bool IsGeInited(const std::shared_ptr &inst_context); } // namespace context } // namespace mindspore diff --git a/mindspore/ccsrc/runtime/device/kernel_runtime.cc b/mindspore/ccsrc/runtime/device/kernel_runtime.cc index e37e5ffee42..28d357df025 100644 --- a/mindspore/ccsrc/runtime/device/kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/kernel_runtime.cc @@ -33,7 +33,7 @@ #include "utils/shape_utils.h" #include "include/common/utils/utils.h" #include "include/common/utils/parallel_context.h" -#include "debug/env_config_parser.h" +#include "include/common/debug/env_config_parser.h" #if ((defined ENABLE_CPU) && (!defined _WIN32)) #include "ps/ps_cache/ps_cache_manager.h" #endif diff --git a/mindspore/ccsrc/runtime/device/kernel_runtime.h b/mindspore/ccsrc/runtime/device/kernel_runtime.h index 5caadcd05c3..4a5926bf84e 100644 --- a/mindspore/ccsrc/runtime/device/kernel_runtime.h +++ b/mindspore/ccsrc/runtime/device/kernel_runtime.h @@ -37,6 +37,7 @@ #include "runtime/device/memory_scheduler.h" #include "runtime/device/executor/dynamic_kernel.h" #include "ir/device_event.h" +#include "include/backend/visible.h" using mindspore::tensor::Tensor; using std::vector; @@ -64,8 +65,8 @@ class KernelRuntime { void RunOpClearMemory(const session::KernelGraph &graph) const; void RunOpMallocPre(const session::KernelGraph &graph, const std::vector &input_tensors); #ifdef ENABLE_DEBUGGER - static bool DumpDataEnabled(); - static bool DumpDataEnabledIteration(); + BACKEND_EXPORT static bool DumpDataEnabled(); + BACKEND_EXPORT static bool DumpDataEnabledIteration(); #endif virtual bool LoadData(const session::KernelGraph &graph); virtual bool Load(const session::KernelGraph &graph, bool is_task_sink); diff --git a/mindspore/ccsrc/runtime/device/kernel_runtime_manager.h b/mindspore/ccsrc/runtime/device/kernel_runtime_manager.h index 9f68c4a119f..99dc0bc9f93 100644 --- a/mindspore/ccsrc/runtime/device/kernel_runtime_manager.h +++ b/mindspore/ccsrc/runtime/device/kernel_runtime_manager.h @@ -26,11 +26,13 @@ #include #include "utils/ms_utils.h" #include "runtime/device/kernel_runtime.h" +#include "include/backend/visible.h" + namespace mindspore { namespace device { using KernelRuntimeCreator = std::function()>; -class KernelRuntimeManager { +class BACKEND_EXPORT KernelRuntimeManager { public: static KernelRuntimeManager &Instance(); void Register(const std::string &device_name, KernelRuntimeCreator &&runtime_creator); diff --git a/mindspore/ccsrc/runtime/device/memory_manager.cc b/mindspore/ccsrc/runtime/device/memory_manager.cc index cc1b4e8971e..b8c327ee3bf 100644 --- a/mindspore/ccsrc/runtime/device/memory_manager.cc +++ b/mindspore/ccsrc/runtime/device/memory_manager.cc @@ -18,9 +18,9 @@ #include #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #ifdef ENABLE_DUMP_IR -#include "debug/rdr/running_data_recorder.h" +#include "debug/rdr/string_recorder.h" #endif #include "utils/ms_context.h" diff --git a/mindspore/ccsrc/runtime/device/ms_device_shape_transfer.h b/mindspore/ccsrc/runtime/device/ms_device_shape_transfer.h index ee93570cae0..a15c72caef2 100644 --- a/mindspore/ccsrc/runtime/device/ms_device_shape_transfer.h +++ b/mindspore/ccsrc/runtime/device/ms_device_shape_transfer.h @@ -38,6 +38,7 @@ #include "include/common/utils/convert_utils.h" #include "utils/log_adapter.h" #include "include/common/utils/utils.h" +#include "include/backend/visible.h" namespace mindspore { namespace trans { @@ -300,7 +301,7 @@ bool TransFormat(const FormatArgs &args, void *result, const AnfNodePtr &node, s /** * Interface of data format trans from host to device * */ -bool TransFormatFromDeviceToHost(const FormatArgs &args, void *result, int64_t groups = 1); +BACKEND_EXPORT bool TransFormatFromDeviceToHost(const FormatArgs &args, void *result, int64_t groups = 1); /** * Interface of data format trans from device to host @@ -320,7 +321,7 @@ void StringToAxisVector5D(const std::string &reshape_type_str, std::vector #include #ifdef ENABLE_DUMP_IR -#include "debug/rdr/recorder_manager.h" -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" +#include "debug/rdr/mem_address_recorder.h" #endif #include "utils/log_adapter.h" diff --git a/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc b/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc index d87e3580107..e926cd41595 100644 --- a/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc +++ b/mindspore/ccsrc/runtime/graph_scheduler/graph_compiler.cc @@ -30,13 +30,12 @@ #include "ir/tensor.h" #include "backend/common/optimizer/helper.h" #include "base/base_ref_utils.h" -#include "debug/dump_proto.h" +#include "include/common/debug/dump_proto.h" #ifdef ENABLE_DEBUGGER #include "debug/debugger/debugger.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/anf_ir_dump.h" -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/anf_ir_dump.h" #endif #ifndef ENABLE_SECURITY #include "debug/data_dump/dump_json_parser.h" diff --git a/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.cc b/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.cc index 38ca1f58327..9c5f7ff791e 100644 --- a/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.cc +++ b/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.cc @@ -38,14 +38,13 @@ #include "debug/data_dump/dump_json_parser.h" #endif #ifdef ENABLE_DUMP_IR -#include "debug/rdr/recorder_manager.h" -#include "debug/rdr/running_data_recorder.h" +#include "include/common/debug/rdr/recorder_manager.h" #endif #ifdef ENABLE_DEBUGGER #include "debug/debugger/debugger.h" #endif #include "profiler/device/profiling.h" -#include "debug/common.h" +#include "include/common/debug/common.h" #include "runtime/recovery/recovery_context.h" namespace mindspore { @@ -184,6 +183,11 @@ void IntHandler(int, siginfo_t *, void *) { #endif } // namespace +GraphScheduler &GraphScheduler::GetInstance() noexcept { + static GraphScheduler instance{}; + return instance; +} + void GraphScheduler::Clear(const ActorInfo &actor_info, const std::vector &graphs, const std::vector &root_graph_parameters, const ControlNodeParserPtr &parser) noexcept { diff --git a/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.h b/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.h index c6ee760b378..930dfa3b355 100644 --- a/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.h +++ b/mindspore/ccsrc/runtime/graph_scheduler/graph_scheduler.h @@ -36,6 +36,7 @@ #ifdef ENABLE_RPC_ACTOR #include "runtime/graph_scheduler/rpc_node_scheduler.h" #endif +#include "include/backend/visible.h" namespace mindspore { namespace runtime { @@ -47,12 +48,9 @@ using mindspore::session::KernelWithIndex; // output node. using GraphOutputPair = std::pair; -class GraphScheduler { +class BACKEND_EXPORT GraphScheduler { public: - static GraphScheduler &GetInstance() noexcept { - static GraphScheduler instance; - return instance; - } + static GraphScheduler &GetInstance() noexcept; // 1. Thread pool creating. // 2. The global actors creating and scheduling. diff --git a/mindspore/ccsrc/runtime/hardware/device_context_manager.cc b/mindspore/ccsrc/runtime/hardware/device_context_manager.cc index cfcc75a1ef2..a7f1f4cac7a 100644 --- a/mindspore/ccsrc/runtime/hardware/device_context_manager.cc +++ b/mindspore/ccsrc/runtime/hardware/device_context_manager.cc @@ -18,6 +18,11 @@ namespace mindspore { namespace device { +DeviceContextManager &DeviceContextManager::GetInstance() { + static DeviceContextManager instance{}; + return instance; +} + void DeviceContextManager::Register(const std::string &device_name, DeviceContextCreator &&device_context_creator) { if (device_context_creators_.find(device_name) == device_context_creators_.end()) { (void)device_context_creators_.emplace(device_name, device_context_creator); diff --git a/mindspore/ccsrc/runtime/hardware/device_context_manager.h b/mindspore/ccsrc/runtime/hardware/device_context_manager.h index 1558e38d4d4..fc5b431495f 100644 --- a/mindspore/ccsrc/runtime/hardware/device_context_manager.h +++ b/mindspore/ccsrc/runtime/hardware/device_context_manager.h @@ -25,16 +25,15 @@ #include #include #include "runtime/hardware/device_context.h" +#include "include/backend/visible.h" + namespace mindspore { namespace device { using DeviceContextCreator = std::function(const DeviceContextKey &)>; -class DeviceContextManager { +class BACKEND_EXPORT DeviceContextManager { public: - static DeviceContextManager &GetInstance() { - static DeviceContextManager instance; - return instance; - } + static DeviceContextManager &GetInstance(); void Register(const std::string &device_name, DeviceContextCreator &&device_context_creator); DeviceContext *GetOrCreateDeviceContext(const DeviceContextKey &device_context_key); void UpdateDeviceContextKey(const DeviceContextKey &old_key, const DeviceContextKey &new_key); diff --git a/mindspore/ccsrc/runtime/pynative/op_executor.h b/mindspore/ccsrc/runtime/pynative/op_executor.h index c62725116a2..b2af3eec33b 100644 --- a/mindspore/ccsrc/runtime/pynative/op_executor.h +++ b/mindspore/ccsrc/runtime/pynative/op_executor.h @@ -30,9 +30,10 @@ #include "runtime/hardware/device_context.h" #include "runtime/graph_scheduler/graph_scheduler.h" #include "runtime/pynative/op_task.h" +#include "include/backend/visible.h" namespace mindspore::runtime { -class OpExecutor { +class BACKEND_EXPORT OpExecutor { public: static OpExecutor &GetInstance(); diff --git a/mindspore/ccsrc/runtime/recovery/recovery_context.h b/mindspore/ccsrc/runtime/recovery/recovery_context.h index a0551754aa2..e94d6585e1b 100644 --- a/mindspore/ccsrc/runtime/recovery/recovery_context.h +++ b/mindspore/ccsrc/runtime/recovery/recovery_context.h @@ -24,6 +24,7 @@ #include "distributed/persistent/storage/file_io_utils.h" #include "distributed/persistent/storage/json_utils.h" #include "runtime/collective/collective_communication_lib.h" +#include "include/backend/visible.h" namespace mindspore { namespace runtime { @@ -35,15 +36,14 @@ enum class RecoveryErrCode { kUnKnownError, kAllGatherHostNameFailed, kBroadcast // Used to save disaster recovery-related state quantities and provide disaster recovery-related // functions, such as reinitializing collective communication, etc. -class RecoveryContext { +class BACKEND_EXPORT RecoveryContext { public: static std::shared_ptr &GetInstance() { - static std::shared_ptr instance = nullptr; - if (instance == nullptr) { - instance.reset(new (std::nothrow) RecoveryContext()); - instance->Initialize(); + if (instance_ == nullptr) { + instance_.reset(new (std::nothrow) RecoveryContext()); + instance_->Initialize(); } - return instance; + return instance_; } ~RecoveryContext() = default; @@ -105,6 +105,8 @@ class RecoveryContext { bool need_reinit_collective() const { return need_reinit_collective_.load(); } private: + inline static std::shared_ptr instance_{}; + RecoveryContext() = default; DISABLE_COPY_AND_ASSIGN(RecoveryContext); diff --git a/mindspore/ccsrc/transform/express_ir/mindir_exporter.cc b/mindspore/ccsrc/transform/express_ir/mindir_exporter.cc index 25d7a001352..d4852ddea67 100644 --- a/mindspore/ccsrc/transform/express_ir/mindir_exporter.cc +++ b/mindspore/ccsrc/transform/express_ir/mindir_exporter.cc @@ -28,7 +28,7 @@ #include "base/core_ops.h" #include "proto/mind_ir.pb.h" #include "utils/check_convert_utils.h" -#include "debug/dump_proto.h" +#include "include/common/debug/dump_proto.h" #include "utils/ms_utils.h" #include "include/common/utils/utils.h" #include "frontend/parallel/tensor_layout/tensor_layout.h" @@ -38,6 +38,8 @@ namespace mindspore { using FloatPtr = std::shared_ptr; using IntPtr = std::shared_ptr; using UIntPtr = std::shared_ptr; +using ModelProtoPtr = std::shared_ptr; + // anf type to mindir type map static mindspore::HashMap g_data_type_map = { {kNumberTypeBool, mind_ir::TensorProto_DataType_BOOL}, diff --git a/mindspore/ccsrc/frontend/optimizer/cse.cc b/mindspore/ccsrc/utils/cse.cc similarity index 99% rename from mindspore/ccsrc/frontend/optimizer/cse.cc rename to mindspore/ccsrc/utils/cse.cc index f2aff457ced..89ee0b4e52c 100644 --- a/mindspore/ccsrc/frontend/optimizer/cse.cc +++ b/mindspore/ccsrc/utils/cse.cc @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "frontend/optimizer/cse.h" +#include "include/common/utils/cse.h" #include #include diff --git a/mindspore/ccsrc/pybind_api/random_normal/philox_generator.cc b/mindspore/ccsrc/utils/philox_generator.cc similarity index 84% rename from mindspore/ccsrc/pybind_api/random_normal/philox_generator.cc rename to mindspore/ccsrc/utils/philox_generator.cc index 066d058999b..a6ac2e1ea24 100644 --- a/mindspore/ccsrc/pybind_api/random_normal/philox_generator.cc +++ b/mindspore/ccsrc/utils/philox_generator.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "pybind_api/random_normal/philox_generator.h" +#include "include/common/utils/philox_generator.h" namespace mindspore { static constexpr uint64_t kShiftNum = 32; @@ -43,16 +43,16 @@ void PhiloxGenerator::JumpStep(uint64_t step) { counter_[3] = static_cast(max_counter >> kShiftNum); } -std::array PhiloxGenerator::Compute(const std::array &counter, +std::array PhiloxGenerator::Compute(const std::array &counter, const std::array &key_var) const { - std::array min_value; - std::array max_value; - for (size_t i = 0; i < gResultNum; i += 2) { + std::array min_value; + std::array max_value; + for (size_t i = 0; i < kResultNum; i += 2) { uint64_t temp = static_cast(keyConstant[i]) * counter[i]; min_value[i] = static_cast(temp); max_value[i] = static_cast(temp >> kShiftNum); } - std::array result; + std::array result; result[0] = (max_value[2] ^ counter[1] ^ key_var[0]); result[1] = min_value[2]; result[2] = (max_value[0] ^ counter[3] ^ key_var[0]); @@ -60,7 +60,7 @@ std::array PhiloxGenerator::Compute(const std::array PhiloxGenerator::operator()() { +std::array PhiloxGenerator::operator()() { for (size_t i = 0; i < kGenerateNum; i++) { counter_ = Compute(counter_, key_var_); key_var_[0] += keyConstant[1]; diff --git a/mindspore/core/utils/log_adapter.cc b/mindspore/core/utils/log_adapter.cc index abc92ed5041..0d7b1114042 100644 --- a/mindspore/core/utils/log_adapter.cc +++ b/mindspore/core/utils/log_adapter.cc @@ -127,12 +127,10 @@ void LogWriter::set_exception_handler(const ExceptionHandler &exception_handler) } void LogWriter::set_trace_provider(const TraceProvider &trace_provider) { - // todo: delete has_set flag - static bool has_set = false; - if (!has_set) { - MS_LOG(INFO) << "trace provider has been set, skip."; + if (trace_provider_ == nullptr) { trace_provider_ = trace_provider; - has_set = true; + } else { + MS_LOG(INFO) << "trace provider has been set, skip."; } } diff --git a/mindspore/core/utils/system/file_system.h b/mindspore/core/utils/system/file_system.h index 7f18f047feb..938d1802ed3 100644 --- a/mindspore/core/utils/system/file_system.h +++ b/mindspore/core/utils/system/file_system.h @@ -28,7 +28,7 @@ #include #include "utils/system/base.h" #include "utils/log_adapter.h" -#include "debug/common.h" +#include "include/common/debug/common.h" namespace mindspore { namespace system { diff --git a/mindspore/lite/tools/converter/CMakeLists.txt b/mindspore/lite/tools/converter/CMakeLists.txt index 19a72dd600e..99018b43e33 100644 --- a/mindspore/lite/tools/converter/CMakeLists.txt +++ b/mindspore/lite/tools/converter/CMakeLists.txt @@ -208,6 +208,8 @@ add_dependencies(converter_src_mid fbs_src fbs_inner_src) add_library(ccsrc_src_mid OBJECT ${CCSRC_SRC}) add_dependencies(ccsrc_src_mid fbs_src fbs_inner_src) +target_compile_definitions(ccsrc_src_mid PRIVATE BACKEND_DLL) +target_compile_definitions(converter_src_mid PRIVATE BACKEND_DLL) add_executable(converter_lite main.cc diff --git a/tests/ut/cpp/CMakeLists.txt b/tests/ut/cpp/CMakeLists.txt index 05237869f58..36e3ca564cd 100644 --- a/tests/ut/cpp/CMakeLists.txt +++ b/tests/ut/cpp/CMakeLists.txt @@ -285,4 +285,23 @@ if(USE_GLOG) target_link_libraries(ut_tests PRIVATE mindspore::glog) endif() -target_link_libraries(ut_tests PRIVATE mindspore securec) +add_library(backend_static STATIC + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $) +target_link_libraries(ut_tests PRIVATE mindspore securec -Wl,--start-group proto_input mindspore::protobuf + mindspore_debug backend_static -Wl,--end-group) \ No newline at end of file diff --git a/tests/ut/cpp/common/backend_common_test.cc b/tests/ut/cpp/common/backend_common_test.cc index d55aea2a189..8d14d6d42d7 100644 --- a/tests/ut/cpp/common/backend_common_test.cc +++ b/tests/ut/cpp/common/backend_common_test.cc @@ -21,7 +21,7 @@ #include "utils/log_adapter.h" #include "frontend/operator/ops.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/ascend_session.h" #include "pipeline/jit/resource.h" #include "pipeline/jit/action.h" diff --git a/tests/ut/cpp/ir/clone_test.cc b/tests/ut/cpp/ir/clone_test.cc index 933ed9d4b38..1238b203682 100644 --- a/tests/ut/cpp/ir/clone_test.cc +++ b/tests/ut/cpp/ir/clone_test.cc @@ -23,7 +23,7 @@ #include "ir/func_graph_cloner.h" #include "pipeline/jit/parse/parse.h" #include "ir/graph_utils.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "base/core_ops.h" namespace mindspore { diff --git a/tests/ut/cpp/ir/manager_test.cc b/tests/ut/cpp/ir/manager_test.cc index 9297f42d124..718687f8695 100644 --- a/tests/ut/cpp/ir/manager_test.cc +++ b/tests/ut/cpp/ir/manager_test.cc @@ -21,7 +21,7 @@ #include "pipeline/jit/parse/parse.h" #include "frontend/operator/ops.h" #include "utils/log_adapter.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "utils/label.h" namespace mindspore { diff --git a/tests/ut/cpp/operator/composite_test.cc b/tests/ut/cpp/operator/composite_test.cc index 8ddbc738200..1cfb39940a3 100644 --- a/tests/ut/cpp/operator/composite_test.cc +++ b/tests/ut/cpp/operator/composite_test.cc @@ -22,7 +22,7 @@ #include "frontend/operator/ops.h" #include "pipeline/jit/static_analysis/prim.h" #include "abstract/abstract_function.h" -#include "debug/trace.h" +#include "pipeline/jit/debug/trace.h" namespace mindspore { using Shape = abstract::Shape; diff --git a/tests/ut/cpp/operator/grad_implementations_test.cc b/tests/ut/cpp/operator/grad_implementations_test.cc index 74fd7327acf..01d023b883c 100644 --- a/tests/ut/cpp/operator/grad_implementations_test.cc +++ b/tests/ut/cpp/operator/grad_implementations_test.cc @@ -21,7 +21,7 @@ #include "ir/manager.h" #include "common/common_test.h" #include "frontend/optimizer/ad/dfunctor.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "common/py_func_graph_fetcher.h" #include "include/common/utils/convert_utils.h" diff --git a/tests/ut/cpp/optimizer/ad/ad_test.cc b/tests/ut/cpp/optimizer/ad/ad_test.cc index 6d75631b75e..ffc212a8b24 100644 --- a/tests/ut/cpp/optimizer/ad/ad_test.cc +++ b/tests/ut/cpp/optimizer/ad/ad_test.cc @@ -26,7 +26,7 @@ #include "ir/graph_utils.h" #include "pipeline/jit/resource.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "frontend/operator/ops.h" #include "frontend/optimizer/optimizer.h" diff --git a/tests/ut/cpp/optimizer/ad/kpynative_test.cc b/tests/ut/cpp/optimizer/ad/kpynative_test.cc index 8d31cdec32f..44c7f3bc111 100644 --- a/tests/ut/cpp/optimizer/ad/kpynative_test.cc +++ b/tests/ut/cpp/optimizer/ad/kpynative_test.cc @@ -26,7 +26,7 @@ #include "ir/graph_utils.h" #include "pipeline/jit/resource.h" #include "pipeline/jit/parse/parse.h" -#include "debug/anf_ir_utils.h" +#include "pipeline/jit/debug/anf_ir_utils.h" #include "frontend/operator/ops.h" namespace mindspore { diff --git a/tests/ut/cpp/optimizer/cconv_test.cc b/tests/ut/cpp/optimizer/cconv_test.cc index c0044090580..06e7d6982c6 100644 --- a/tests/ut/cpp/optimizer/cconv_test.cc +++ b/tests/ut/cpp/optimizer/cconv_test.cc @@ -21,7 +21,7 @@ #include "ir/func_graph_cloner.h" #include "utils/log_adapter.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { void CheckNoFreeVariables(FuncGraphPtr root) { diff --git a/tests/ut/cpp/optimizer/clean_test.cc b/tests/ut/cpp/optimizer/clean_test.cc index 02e35db5290..06b2b5b2a1d 100644 --- a/tests/ut/cpp/optimizer/clean_test.cc +++ b/tests/ut/cpp/optimizer/clean_test.cc @@ -20,7 +20,7 @@ #include "utils/log_adapter.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "frontend/optimizer/clean.h" namespace mindspore { diff --git a/tests/ut/cpp/optimizer/lib_test.cc b/tests/ut/cpp/optimizer/lib_test.cc index 7a2089eec3e..f3eb51b683c 100644 --- a/tests/ut/cpp/optimizer/lib_test.cc +++ b/tests/ut/cpp/optimizer/lib_test.cc @@ -27,7 +27,7 @@ #include "frontend/operator/ops.h" #include "frontend/optimizer/irpass.h" #include "pipeline/jit/resource.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "pipeline/jit/parse/data_converter.h" #include "include/common/utils/convert_utils.h" diff --git a/tests/ut/cpp/optimizer/opt_test.cc b/tests/ut/cpp/optimizer/opt_test.cc index ce592bdb55d..91f5cb20ae5 100644 --- a/tests/ut/cpp/optimizer/opt_test.cc +++ b/tests/ut/cpp/optimizer/opt_test.cc @@ -29,9 +29,9 @@ #include "frontend/optimizer/irpass/arithmetic_simplify.h" #include "pipeline/jit/action.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "frontend/operator/ops.h" -#include "frontend/optimizer/cse.h" +#include "include/common/utils/cse.h" #include "include/common/utils/convert_utils.h" namespace mindspore { diff --git a/tests/ut/cpp/optimizer/optimizer_test.cc b/tests/ut/cpp/optimizer/optimizer_test.cc index ead50d58095..60aa6e4eb27 100644 --- a/tests/ut/cpp/optimizer/optimizer_test.cc +++ b/tests/ut/cpp/optimizer/optimizer_test.cc @@ -25,7 +25,7 @@ #include "frontend/optimizer/optimizer.h" #include "frontend/optimizer/irpass.h" #include "frontend/optimizer/irpass/gradient_eliminate.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/parallel/step_parallel_test.cc b/tests/ut/cpp/parallel/step_parallel_test.cc index 293e73b615e..26b270d8579 100644 --- a/tests/ut/cpp/parallel/step_parallel_test.cc +++ b/tests/ut/cpp/parallel/step_parallel_test.cc @@ -17,7 +17,7 @@ #include "frontend/parallel/step_parallel.h" #include "frontend/parallel/graph_util/generate_graph.h" #include "common/py_func_graph_fetcher.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "frontend/operator/ops.h" #include "pipeline/jit/static_analysis/static_analysis.h" #include "include/common/utils/convert_utils_py.h" diff --git a/tests/ut/cpp/pipeline/parse/parser_abnormal_test.cc b/tests/ut/cpp/pipeline/parse/parser_abnormal_test.cc index 33f824ac7c9..de3665af2de 100644 --- a/tests/ut/cpp/pipeline/parse/parser_abnormal_test.cc +++ b/tests/ut/cpp/pipeline/parse/parser_abnormal_test.cc @@ -20,7 +20,7 @@ #include "utils/log_adapter.h" #include "utils/profile.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace parse { diff --git a/tests/ut/cpp/pipeline/parse/parser_class_test.cc b/tests/ut/cpp/pipeline/parse/parser_class_test.cc index 99fe9843526..cac54b39fb1 100644 --- a/tests/ut/cpp/pipeline/parse/parser_class_test.cc +++ b/tests/ut/cpp/pipeline/parse/parser_class_test.cc @@ -20,7 +20,7 @@ #include "utils/log_adapter.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace parse { diff --git a/tests/ut/cpp/pipeline/parse/parser_integrate_test.cc b/tests/ut/cpp/pipeline/parse/parser_integrate_test.cc index 8ac9c8c46ff..a720212572a 100644 --- a/tests/ut/cpp/pipeline/parse/parser_integrate_test.cc +++ b/tests/ut/cpp/pipeline/parse/parser_integrate_test.cc @@ -19,7 +19,7 @@ #include "common/py_func_graph_fetcher.h" #include "utils/log_adapter.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace parse { diff --git a/tests/ut/cpp/pipeline/parse/parser_primitive_test.cc b/tests/ut/cpp/pipeline/parse/parser_primitive_test.cc index c8d3f887e9a..510e895cb0c 100644 --- a/tests/ut/cpp/pipeline/parse/parser_primitive_test.cc +++ b/tests/ut/cpp/pipeline/parse/parser_primitive_test.cc @@ -20,7 +20,7 @@ #include "utils/log_adapter.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace parse { diff --git a/tests/ut/cpp/pipeline/parse/parser_test.cc b/tests/ut/cpp/pipeline/parse/parser_test.cc index 7629342d8d1..387c29f2767 100644 --- a/tests/ut/cpp/pipeline/parse/parser_test.cc +++ b/tests/ut/cpp/pipeline/parse/parser_test.cc @@ -20,7 +20,7 @@ #include "utils/log_adapter.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace parse { diff --git a/tests/ut/cpp/pipeline/parse/resolve_test.cc b/tests/ut/cpp/pipeline/parse/resolve_test.cc index 1eb8412d848..4b409e40334 100644 --- a/tests/ut/cpp/pipeline/parse/resolve_test.cc +++ b/tests/ut/cpp/pipeline/parse/resolve_test.cc @@ -20,7 +20,7 @@ #include "utils/log_adapter.h" #include "pipeline/jit/parse/parse.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace parse { diff --git a/tests/ut/cpp/pipeline/static_analysis/evaluator_test.cc b/tests/ut/cpp/pipeline/static_analysis/evaluator_test.cc index 6e3ae62c698..f2c32aad215 100644 --- a/tests/ut/cpp/pipeline/static_analysis/evaluator_test.cc +++ b/tests/ut/cpp/pipeline/static_analysis/evaluator_test.cc @@ -22,7 +22,7 @@ #include "pipeline/static_analysis/helper.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" namespace mindspore { namespace abstract { diff --git a/tests/ut/cpp/pipeline/static_analysis/prim_test.cc b/tests/ut/cpp/pipeline/static_analysis/prim_test.cc index 29fea0900cc..80bde2eaabc 100644 --- a/tests/ut/cpp/pipeline/static_analysis/prim_test.cc +++ b/tests/ut/cpp/pipeline/static_analysis/prim_test.cc @@ -24,7 +24,7 @@ #include "pipeline/jit/static_analysis/prim.h" #include "pipeline/static_analysis/helper.h" #include "frontend/operator/ops.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "ir/tensor.h" #include "utils/symbolic.h" #include "base/core_ops.h" diff --git a/tests/ut/cpp/pipeline/static_analysis/specialize_test.cc b/tests/ut/cpp/pipeline/static_analysis/specialize_test.cc index 542c9826767..8a7e1afda12 100644 --- a/tests/ut/cpp/pipeline/static_analysis/specialize_test.cc +++ b/tests/ut/cpp/pipeline/static_analysis/specialize_test.cc @@ -26,7 +26,7 @@ #include "utils/log_adapter.h" #include "ir/graph_utils.h" #include "utils/misc.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "base/core_ops.h" namespace mindspore { diff --git a/tests/ut/cpp/pipeline/static_analysis/static_analysis_test.cc b/tests/ut/cpp/pipeline/static_analysis/static_analysis_test.cc index b95c518712f..e7f38876e03 100644 --- a/tests/ut/cpp/pipeline/static_analysis/static_analysis_test.cc +++ b/tests/ut/cpp/pipeline/static_analysis/static_analysis_test.cc @@ -26,7 +26,7 @@ #include "pipeline/jit/parse/parse.h" #include "pipeline/jit/parse/data_converter.h" #include "pipeline/jit/resource.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "utils/log_adapter.h" #include "base/core_ops.h" diff --git a/tests/ut/cpp/pre_activate/ascend/buffer_fusion/buffer_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/buffer_fusion/buffer_fusion_test.cc index aef96348db2..0dbf6e523c3 100644 --- a/tests/ut/cpp/pre_activate/ascend/buffer_fusion/buffer_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/buffer_fusion/buffer_fusion_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "kernel/kernel.h" #include "runtime/device/kernel_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/dynamic_shape/dynamic_shape_pass_test.cc b/tests/ut/cpp/pre_activate/ascend/dynamic_shape/dynamic_shape_pass_test.cc index 06c8e55c1a0..fa6ea52fc99 100644 --- a/tests/ut/cpp/pre_activate/ascend/dynamic_shape/dynamic_shape_pass_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/dynamic_shape/dynamic_shape_pass_test.cc @@ -19,8 +19,8 @@ #include "plugin/device/ascend/optimizer/ascend_backend_optimization.h" #include "plugin/device/ascend/kernel/tbe/tbe_kernel_mod.h" #include "common/backend_common_test.h" -#include "debug/anf_ir_dump.h" -#include "debug/dump_proto.h" +#include "include/common/debug/anf_ir_dump.h" +#include "include/common/debug/dump_proto.h" #include "include/common/utils/utils.h" #include "utils/ms_utils.h" diff --git a/tests/ut/cpp/pre_activate/ascend/enhancer/getnext_tensor_move_elimination_test.cc b/tests/ut/cpp/pre_activate/ascend/enhancer/getnext_tensor_move_elimination_test.cc index c741bb4d512..d25867de7c0 100644 --- a/tests/ut/cpp/pre_activate/ascend/enhancer/getnext_tensor_move_elimination_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/enhancer/getnext_tensor_move_elimination_test.cc @@ -18,7 +18,7 @@ #include "backend/common/session/anf_runtime_algorithm.h" #include "frontend/operator/ops.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_getnext_test.cc b/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_getnext_test.cc index 21caa431780..3ee4456cc09 100644 --- a/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_getnext_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_getnext_test.cc @@ -20,7 +20,7 @@ #include "pipeline/jit/resource.h" #include "frontend/operator/ops.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_hccl_op_test.cc b/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_hccl_op_test.cc index da508296d9f..b98a3da5867 100644 --- a/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_hccl_op_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/enhancer/insert_tensor_move_for_hccl_op_test.cc @@ -18,7 +18,7 @@ #include "backend/common/session/anf_runtime_algorithm.h" #include "frontend/operator/ops.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/format_type/check_consistency_test.cc b/tests/ut/cpp/pre_activate/ascend/format_type/check_consistency_test.cc index cd425cb27cb..d58c53d8bb0 100644 --- a/tests/ut/cpp/pre_activate/ascend/format_type/check_consistency_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/format_type/check_consistency_test.cc @@ -23,7 +23,7 @@ #include "frontend/operator/ops.h" #include "ir/tensor.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/format_type/insert_cast_test.cc b/tests/ut/cpp/pre_activate/ascend/format_type/insert_cast_test.cc index b2b5459100e..5ee52ca7460 100644 --- a/tests/ut/cpp/pre_activate/ascend/format_type/insert_cast_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/format_type/insert_cast_test.cc @@ -17,7 +17,7 @@ #include "frontend/operator/ops.h" #include "ir/tensor.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/format_type/insert_trans_op_test.cc b/tests/ut/cpp/pre_activate/ascend/format_type/insert_trans_op_test.cc index bc545e2b9fc..7dfb4722652 100644 --- a/tests/ut/cpp/pre_activate/ascend/format_type/insert_trans_op_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/format_type/insert_trans_op_test.cc @@ -15,7 +15,7 @@ */ #include "common/backend_common_test.h" #include "frontend/operator/ops.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "backend/common/optimizer/pass_manager.h" diff --git a/tests/ut/cpp/pre_activate/ascend/format_type/merge_cast_to_op_test.cc b/tests/ut/cpp/pre_activate/ascend/format_type/merge_cast_to_op_test.cc index a24e548480a..bb7c4c669b7 100644 --- a/tests/ut/cpp/pre_activate/ascend/format_type/merge_cast_to_op_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/format_type/merge_cast_to_op_test.cc @@ -18,7 +18,7 @@ #include "backend/common/session/anf_runtime_algorithm.h" #include "frontend/operator/ops.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/format_type/remove_internal_output_test.cc b/tests/ut/cpp/pre_activate/ascend/format_type/remove_internal_output_test.cc index c70baa893d3..9586c47e512 100644 --- a/tests/ut/cpp/pre_activate/ascend/format_type/remove_internal_output_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/format_type/remove_internal_output_test.cc @@ -14,7 +14,7 @@ * limitations under the License. */ #include "common/backend_common_test.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "plugin/device/ascend/optimizer/format_type/remove_internal_output.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_grad_split_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_grad_split_test.cc index 4a950f2496a..dcd64a6e6b4 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_grad_split_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_grad_split_test.cc @@ -18,7 +18,7 @@ #include "backend/common/session/anf_runtime_algorithm.h" #include "frontend/operator/ops.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_split_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_split_test.cc index 4c6f53dfbc7..9450bf46fe7 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_split_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/bn_split_test.cc @@ -21,7 +21,7 @@ #include "frontend/operator/ops.h" #include "ir/tensor.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/layer_norm_grad_split_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/layer_norm_grad_split_test.cc index 624e6c200b7..6a70da0bcd3 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/layer_norm_grad_split_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/layer_norm_grad_split_test.cc @@ -18,7 +18,7 @@ #include "backend/common/session/anf_runtime_algorithm.h" #include "frontend/operator/ops.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "kernel/kernel_build_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/reduce_min_fission_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/reduce_min_fission_test.cc index 8b13a297cfb..6137bea8171 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/reduce_min_fission_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/reduce_min_fission_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #define private public #define protected public #include "plugin/device/ascend/optimizer/ir_fission/reduce_min_fission.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/single_batch_norm_fission_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/single_batch_norm_fission_test.cc index 9f05238c860..29db23cc4fa 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/single_batch_norm_fission_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/single_batch_norm_fission_test.cc @@ -17,7 +17,7 @@ #include "plugin/device/ascend/optimizer/ir_fission/single_batch_norm_fission.h" #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/tensor_scatter_update_fission_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/tensor_scatter_update_fission_test.cc index 67a6a7e5830..c9d81a5193b 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/tensor_scatter_update_fission_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/tensor_scatter_update_fission_test.cc @@ -17,7 +17,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" #include "plugin/device/ascend/optimizer/ir_fission/tensor_scatter_update_fission.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/topk_split_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/topk_split_test.cc index 42e457dc06a..96d5dda5eff 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/topk_split_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/topk_split_test.cc @@ -19,7 +19,7 @@ #include "runtime/device/kernel_info.h" #include "backend/common/optimizer/const_input_to_attr.h" #include "backend/common/pass/convert_const_input_to_attr.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/transdata_split_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/transdata_split_test.cc index 768d1d04b22..d391f9d44d5 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/transdata_split_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/transdata_split_test.cc @@ -19,7 +19,7 @@ #include "runtime/device/kernel_info.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "kernel/oplib/oplib.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "utils/ms_context.h" #include "include/common/utils/anfalgo.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fission/unsorted_segment_sum_fission_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fission/unsorted_segment_sum_fission_test.cc index 9a82245af22..46dfcb2f6e5 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fission/unsorted_segment_sum_fission_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fission/unsorted_segment_sum_fission_test.cc @@ -17,7 +17,7 @@ #include "plugin/device/ascend/optimizer/ir_fission/unsorted_segment_sum_fission.h" #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_fusion_test.cc index 23774c62716..acc832ec659 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_fusion_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" #include "plugin/device/ascend/optimizer/ir_fusion/adam_apply_one_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_with_decay_rule_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_with_decay_rule_test.cc index 655a0725116..26f7141c7d0 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_with_decay_rule_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/adam_apply_one_with_decay_rule_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/adam_apply_one_with_decay_rule.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnorm_to_bninfer_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnorm_to_bninfer_test.cc index 5917caf3d70..91948b77f24 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnorm_to_bninfer_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnorm_to_bninfer_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/batchnorm_to_bninfer.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnormgrad_to_bninfergrad_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnormgrad_to_bninfergrad_test.cc index d4d7f8f6a33..dc8298fd24f 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnormgrad_to_bninfergrad_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/batchnormgrad_to_bninfergrad_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/batchnormgrad_to_bninfergrad.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_norm_no_div_square_sum_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_norm_no_div_square_sum_fusion_test.cc index 343efa1d8bc..2d35768b7d8 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_norm_no_div_square_sum_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_norm_no_div_square_sum_fusion_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/clip_by_norm_no_div_square_sum_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_value_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_value_fusion_test.cc index 7137cacbabd..f7ea82331be 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_value_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/clip_by_value_fusion_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/clip_by_value_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_mul_grad_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_mul_grad_fusion_test.cc index c79804d7673..4368b1e8a3a 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_mul_grad_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_mul_grad_fusion_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/confusion_mul_grad_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_softmax_grad_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_softmax_grad_test.cc index 3bce7d393bd..c70e2dc094c 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_softmax_grad_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/confusion_softmax_grad_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/confusion_softmax_grad_rule.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/derelu_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/derelu_fusion_test.cc index 770d5696613..f80e4dbb0f7 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/derelu_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/derelu_fusion_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/derelu_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_rule_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_rule_test.cc index e1a74ff7c56..bf67b2e1f41 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_rule_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_rule_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "plugin/device/ascend/optimizer/ir_fusion/lamb_next_mv_rule.h" namespace mindspore { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_with_decay_rule_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_with_decay_rule_test.cc index afd51d3bc63..ab0dc7f81f9 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_with_decay_rule_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_next_mv_with_decay_rule_test.cc @@ -17,7 +17,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" #include "plugin/device/ascend/optimizer/ir_fusion/lamb_next_mv_with_decay_rule.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_rule_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_rule_fusion_test.cc index ae6f64a15eb..1cb97bb8aef 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_rule_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_rule_fusion_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/lamb_update_with_lr_rule_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_v2_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_v2_test.cc index 3fd39d25edb..b769575f7c7 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_v2_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/lamb_update_with_lr_v2_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "plugin/device/ascend/optimizer/ir_fusion/lamb_update_with_lr_v2.h" namespace mindspore { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/layer_norm_beta_gamma_backprop_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/layer_norm_beta_gamma_backprop_fusion_test.cc index 510f1dc56e7..76c22bec262 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/layer_norm_beta_gamma_backprop_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/layer_norm_beta_gamma_backprop_fusion_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" #include "runtime/device/kernel_info.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "include/common/utils/anfalgo.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_add_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_add_fusion_test.cc index 624417bb183..2a2fe40a984 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_add_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_add_fusion_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" #include "plugin/device/ascend/optimizer/ir_fusion/mul_add_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_addn_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_addn_fusion_test.cc index ff5b7fc5eec..311fbac1ff1 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_addn_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/mul_addn_fusion_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" #include "plugin/device/ascend/optimizer/ir_fusion/mul_addn_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/reshape_transpose_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/reshape_transpose_fusion_test.cc index 75c04e03ba2..6779e1ad93f 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/reshape_transpose_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/reshape_transpose_fusion_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/anfalgo.h" #include "plugin/device/ascend/optimizer/ir_fusion/reshape_transpose_fusion.h" diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/softmax_grad_ext_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/softmax_grad_ext_fusion_test.cc index 8a8dba80a00..6386a0d8bb3 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/softmax_grad_ext_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/softmax_grad_ext_fusion_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/softmax_grad_ext_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/square_sum_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/square_sum_fusion_test.cc index 6e7fe8593de..69ae815684e 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/square_sum_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/square_sum_fusion_test.cc @@ -17,7 +17,7 @@ #include "common/py_func_graph_fetcher.h" #include "backend/common/optimizer/optimizer.h" #include "plugin/device/ascend/optimizer/ir_fusion/square_sum_fusion.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" namespace mindspore { namespace opt { diff --git a/tests/ut/cpp/pre_activate/ascend/ir_fusion/transpose_reshape_fusion_test.cc b/tests/ut/cpp/pre_activate/ascend/ir_fusion/transpose_reshape_fusion_test.cc index 1ad2f419e9c..964d9e46c14 100644 --- a/tests/ut/cpp/pre_activate/ascend/ir_fusion/transpose_reshape_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/ir_fusion/transpose_reshape_fusion_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/anfalgo.h" #include "plugin/device/ascend/optimizer/ir_fusion/transpose_reshape_fusion.h" diff --git a/tests/ut/cpp/pre_activate/ascend/mindir/all_to_all_unify_mindir_test.cc b/tests/ut/cpp/pre_activate/ascend/mindir/all_to_all_unify_mindir_test.cc index f31b4dd266a..faa851a62bb 100644 --- a/tests/ut/cpp/pre_activate/ascend/mindir/all_to_all_unify_mindir_test.cc +++ b/tests/ut/cpp/pre_activate/ascend/mindir/all_to_all_unify_mindir_test.cc @@ -15,7 +15,7 @@ */ #include "common/backend_common_test.h" #include "frontend/operator/ops.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/pass/allreduce_fusion_test.cc b/tests/ut/cpp/pre_activate/pass/allreduce_fusion_test.cc index 925442a8f6a..428d31ad8e9 100644 --- a/tests/ut/cpp/pre_activate/pass/allreduce_fusion_test.cc +++ b/tests/ut/cpp/pre_activate/pass/allreduce_fusion_test.cc @@ -18,7 +18,7 @@ #include "frontend/operator/ops.h" #include "ir/tensor.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/pass/communication_op_fusion.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/pass/common_subexpression_elimination_test.cc b/tests/ut/cpp/pre_activate/pass/common_subexpression_elimination_test.cc index fad991fdac9..d863ff02b78 100644 --- a/tests/ut/cpp/pre_activate/pass/common_subexpression_elimination_test.cc +++ b/tests/ut/cpp/pre_activate/pass/common_subexpression_elimination_test.cc @@ -17,7 +17,7 @@ #include "frontend/operator/ops.h" #include "ir/tensor.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/pass/convert_const_input_to_attr_test.cc b/tests/ut/cpp/pre_activate/pass/convert_const_input_to_attr_test.cc index 29e05b96b8b..932e984ef41 100644 --- a/tests/ut/cpp/pre_activate/pass/convert_const_input_to_attr_test.cc +++ b/tests/ut/cpp/pre_activate/pass/convert_const_input_to_attr_test.cc @@ -15,7 +15,7 @@ */ #include "common/backend_common_test.h" #include "frontend/operator/ops.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/pass/convert_const_input_to_tensor_input_test.cc b/tests/ut/cpp/pre_activate/pass/convert_const_input_to_tensor_input_test.cc index c2c113dadb9..760a0c51c77 100644 --- a/tests/ut/cpp/pre_activate/pass/convert_const_input_to_tensor_input_test.cc +++ b/tests/ut/cpp/pre_activate/pass/convert_const_input_to_tensor_input_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "ir/anf.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/pass/convert_tuple_input_to_dynamic_input_test.cc b/tests/ut/cpp/pre_activate/pass/convert_tuple_input_to_dynamic_input_test.cc index 9de674fbfee..590293888a4 100644 --- a/tests/ut/cpp/pre_activate/pass/convert_tuple_input_to_dynamic_input_test.cc +++ b/tests/ut/cpp/pre_activate/pass/convert_tuple_input_to_dynamic_input_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "ir/anf.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/pass/convert_tuple_output_to_maketuple_test.cc b/tests/ut/cpp/pre_activate/pass/convert_tuple_output_to_maketuple_test.cc index ef6cad9f0a4..7bd4971c749 100644 --- a/tests/ut/cpp/pre_activate/pass/convert_tuple_output_to_maketuple_test.cc +++ b/tests/ut/cpp/pre_activate/pass/convert_tuple_output_to_maketuple_test.cc @@ -16,7 +16,7 @@ #include "common/backend_common_test.h" #include "ir/anf.h" #include "ir/tensor.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" #include "backend/common/session/anf_runtime_algorithm.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/pre_activate/pass/eliminate_redundant_op_test.cc b/tests/ut/cpp/pre_activate/pass/eliminate_redundant_op_test.cc index f049b70f987..a3caa09ac77 100644 --- a/tests/ut/cpp/pre_activate/pass/eliminate_redundant_op_test.cc +++ b/tests/ut/cpp/pre_activate/pass/eliminate_redundant_op_test.cc @@ -19,7 +19,7 @@ #include "frontend/operator/ops.h" #include "ir/tensor.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "common/py_func_graph_fetcher.h" // #include "runtime/device/optimizer/pass/insert_trans_op.h" #include "plugin/device/ascend/optimizer/format_type/insert_cast.h" diff --git a/tests/ut/cpp/pre_activate/pass/getitem_tuple_test.cc b/tests/ut/cpp/pre_activate/pass/getitem_tuple_test.cc index d96c93156c5..b583fb3cb88 100644 --- a/tests/ut/cpp/pre_activate/pass/getitem_tuple_test.cc +++ b/tests/ut/cpp/pre_activate/pass/getitem_tuple_test.cc @@ -19,7 +19,7 @@ #include "pipeline/jit/resource.h" #include "frontend/operator/ops.h" #include "ir/manager.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "include/common/utils/utils.h" #include "backend/common/optimizer/optimizer.h" #include "backend/common/pass/getitem_tuple.h" diff --git a/tests/ut/cpp/stub/anf_ir/dump_proto_stub.cc b/tests/ut/cpp/stub/anf_ir/dump_proto_stub.cc index c3ba9e16047..1cd770cb6cc 100644 --- a/tests/ut/cpp/stub/anf_ir/dump_proto_stub.cc +++ b/tests/ut/cpp/stub/anf_ir/dump_proto_stub.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "debug/dump_proto.h" +#include "include/common/debug/dump_proto.h" #include "proto/mind_ir.pb.h" namespace mindspore { diff --git a/tests/ut/cpp/tbe/tbe_json_creator_test.cc b/tests/ut/cpp/tbe/tbe_json_creator_test.cc index 2ccabf38ffd..0a83a2994d6 100644 --- a/tests/ut/cpp/tbe/tbe_json_creator_test.cc +++ b/tests/ut/cpp/tbe/tbe_json_creator_test.cc @@ -17,7 +17,7 @@ #include "utils/ms_context.h" #include "common/backend_common_test.h" #include "common/py_func_graph_fetcher.h" -#include "debug/anf_ir_dump.h" +#include "include/common/debug/anf_ir_dump.h" #include "kernel/kernel.h" #include "runtime/device/kernel_info.h" #include "backend/common/optimizer/optimizer.h" diff --git a/tests/ut/cpp/utils/callback_test.cc b/tests/ut/cpp/utils/callback_test.cc index 88813e4150b..8a711f09b7f 100644 --- a/tests/ut/cpp/utils/callback_test.cc +++ b/tests/ut/cpp/utils/callback_test.cc @@ -21,7 +21,7 @@ #include "pipeline/jit/pipeline.h" #include "include/common/utils/python_adapter.h" #include "include/transform/graph_ir/df_graph_manager.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #ifdef ENABLE_D #include "include/common/utils/callbacks_ge.h" #endif diff --git a/tests/ut/cpp/utils/ir_import_test.cc b/tests/ut/cpp/utils/ir_import_test.cc index 374c36b4e87..b1401f09392 100644 --- a/tests/ut/cpp/utils/ir_import_test.cc +++ b/tests/ut/cpp/utils/ir_import_test.cc @@ -18,7 +18,7 @@ #include "common/common_test.h" #include "utils/log_adapter.h" -#include "debug/anf_ir_utils.h" +#include "pipeline/jit/debug/anf_ir_utils.h" #include "pipeline/jit/parse/parse.h" #include "ir/manager.h" #include "pipeline/jit/static_analysis/prim.h" diff --git a/tests/ut/cpp/vm/segment_runner_test.cc b/tests/ut/cpp/vm/segment_runner_test.cc index 96768be0acc..170a4381ccc 100644 --- a/tests/ut/cpp/vm/segment_runner_test.cc +++ b/tests/ut/cpp/vm/segment_runner_test.cc @@ -23,7 +23,7 @@ #include "pipeline/jit/parse/parse.h" #include "ir/graph_utils.h" #include "pipeline/jit/resource.h" -#include "debug/draw.h" +#include "include/common/debug/draw.h" #include "frontend/operator/ops.h" #include "backend/graph_compiler/segment_runner.h" #include "backend/graph_compiler/transform.h"