1 /** 2 * Copyright 2021 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_CCSRC_DEBUG_RDR_RUNNING_DATA_RECORDER_H_ 17 #define MINDSPORE_CCSRC_DEBUG_RDR_RUNNING_DATA_RECORDER_H_ 18 #include <vector> 19 #include <string> 20 #include <memory> 21 22 #include "mindspore/core/utils/log_adapter.h" 23 #include "debug/rdr/graph_recorder.h" 24 25 namespace mindspore { 26 class FuncGraph; 27 class CNode; 28 using FuncGraphPtr = std::shared_ptr<FuncGraph>; 29 using CNodePtr = std::shared_ptr<CNode>; 30 31 namespace kernel { 32 class Address; 33 struct KernelLaunchInfo; 34 using AddressPtr = std::shared_ptr<Address>; 35 } // namespace kernel 36 using AddressPtrList = std::vector<kernel::AddressPtr>; 37 struct MemInfo; 38 #ifdef ENABLE_D 39 namespace device { 40 namespace ascend { 41 namespace tasksink { 42 class TaskDebugInfo; 43 } // namespace tasksink 44 } // namespace ascend 45 } // namespace device 46 using TaskDebugInfoPtr = std::shared_ptr<device::ascend::tasksink::TaskDebugInfo>; 47 #endif // ENABLE_D 48 49 namespace RDR { 50 bool RecordAnfGraph(const SubModuleId module, const std::string &name, const FuncGraphPtr &graph, 51 const DumpGraphParams &info, const std::string &file_type = ".ir;.pb;.dat"); 52 bool RecordGraphExecOrder(const SubModuleId module, const std::string &name, 53 const std::vector<CNodePtr> &final_exec_order); 54 bool RecordString(SubModuleId module, const std::string &name, const std::string &data); 55 bool RecordStreamExecOrder(const SubModuleId module, const std::string &name, const std::vector<CNodePtr> &exec_order); 56 bool RecordMemAddressInfo(const SubModuleId module, const std::string &name); 57 bool UpdateMemAddress(const SubModuleId module, const std::string &name, const std::string &op_name, 58 const kernel::KernelLaunchInfo &mem_info); 59 #ifdef ENABLE_D 60 bool RecordTaskDebugInfo(SubModuleId module, const std::string &name, 61 const std::vector<TaskDebugInfoPtr> &task_debug_info_list); 62 #endif // ENABLE_D 63 void TriggerAll(); 64 void ResetRecorder(); 65 void ClearMemAddressInfo(); 66 } // namespace RDR 67 } // namespace mindspore 68 #endif // MINDSPORE_CCSRC_DEBUG_RDR_RUNNING_DATA_RECORDER_H_ 69