You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

e2e_dump.h 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_E_2_E_DUMP_H_
  17. #define MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_E_2_E_DUMP_H_
  18. #include <map>
  19. #include <string>
  20. #include "backend/session/kernel_graph.h"
  21. #include "runtime/device/device_address.h"
  22. #include "debug/data_dump/dump_json_parser.h"
  23. #include "debug/data_dump/dump_utils.h"
  24. #ifndef ENABLE_DEBUGGER
  25. class Debugger;
  26. #endif
  27. namespace mindspore {
  28. class E2eDump {
  29. public:
  30. E2eDump() = default;
  31. ~E2eDump() = default;
  32. static bool DumpData(const session::KernelGraph *graph, uint32_t device_id, const Debugger *debugger = nullptr);
  33. // Dump data when task error.
  34. static void DumpInputImpl(const CNodePtr &node, bool trans_flag, const std::string &dump_path,
  35. std::string *kernel_name, const Debugger *debugger);
  36. static void DumpOutputImpl(const CNodePtr &node, bool trans_flag, const std::string &dump_path,
  37. std::string *kernel_name, const Debugger *debugger);
  38. private:
  39. static void DumpOutput(const session::KernelGraph *graph, const std::string &dump_path, const Debugger *debugger);
  40. static void DumpInput(const session::KernelGraph *graph, const std::string &dump_path, const Debugger *debugger);
  41. static void DumpParametersAndConst(const session::KernelGraph *graph, const std::string &dump_path,
  42. const Debugger *debugger);
  43. static void DumpGPUMemToFile(const std::string &file_path, const std::string &original_kernel_name,
  44. NotNull<const device::DeviceAddress *> addr, const ShapeVector &int_shapes,
  45. const TypeId &host_type, const TypeId &device_type, bool trans_flag, size_t slot,
  46. const Debugger *debugger);
  47. static bool IsDeviceTargetGPU();
  48. static void DumpSingleAnfNode(const AnfNodePtr &anf_node, const size_t output_index, const std::string &dump_path,
  49. bool trans_flag, std::map<std::string, size_t> *const_map, const Debugger *debugger);
  50. inline static unsigned int starting_graph_id = INT32_MAX;
  51. };
  52. } // namespace mindspore
  53. #endif // MINDSPORE_MINDSPORE_CCSRC_DEBUG_DATA_DUMP_E_2_E_DUMP_UTIL_H_