Add debug info for online debugger

This commit is contained in:
Parastoo Ashtari 2021-06-23 18:48:12 -04:00
parent 35c1f14cf3
commit 8d248cd925
3 changed files with 14 additions and 13 deletions

View File

@ -438,14 +438,14 @@ void DebuggerProtoExporter::ExportCNode(const FuncGraphPtr &func_graph, const CN
// add full_name for debugger
node_proto->set_full_name(node->fullname_with_scope());
MS_LOG(INFO) << "full_name: " << node->fullname_with_scope();
if (dump_location == kDebugWholeStack) {
std::ostringstream buffer;
auto traces = mindspore::trace::GetSourceLineList(node);
for (auto &trace : traces) {
buffer << " # " << trace;
}
node_proto->set_source_address(buffer.str());
std::ostringstream buffer;
auto traces = mindspore::trace::GetSourceLineList(node);
for (auto &trace : traces) {
buffer << " # " << trace;
}
node_proto->set_source_address(buffer.str());
// process OP inputs
for (size_t i = 1; i < inputs.size(); ++i) {
debugger::InputProto *input_proto = node_proto->add_input();

View File

@ -34,7 +34,8 @@ class DebuggerProtoExporter {
DebuggerProtoExporter() {}
~DebuggerProtoExporter() {}
std::string GetFuncGraphProtoString(const FuncGraphPtr &func_graph, LocDebugDumpMode dump_location = kDebugOff);
std::string GetFuncGraphProtoString(const FuncGraphPtr &func_graph,
LocDebugDumpMode dump_location = kDebugWholeStack);
debugger::ModelProto GetFuncGraphProto(const FuncGraphPtr &func_graph);
private:
@ -49,13 +50,13 @@ class DebuggerProtoExporter {
void SetDictionaryToProto(const ValueDictionaryPtr &val, debugger::ValueProto *value_proto);
void SetNodeOutputType(const AnfNodePtr &node, debugger::TypeProto *type_proto);
void ExportFuncGraph(const FuncGraphPtr &func_graph, debugger::GraphProto *const graph_proto,
LocDebugDumpMode dump_location = kDebugOff);
LocDebugDumpMode dump_location = kDebugWholeStack);
void ExportParameters(const FuncGraphPtr &func_graph, debugger::GraphProto *graph_proto);
void ExportCNodes(const FuncGraphPtr &func_graph, debugger::GraphProto *const graph_proto,
std::map<AnfNodePtr, size_t> *const_map_ptr, LocDebugDumpMode dump_location = kDebugOff);
std::map<AnfNodePtr, size_t> *const_map_ptr, LocDebugDumpMode dump_location = kDebugWholeStack);
void ExportCNode(const FuncGraphPtr &func_graph, const CNodePtr &node, std::map<AnfNodePtr, size_t> *apply_map_ptr,
std::map<AnfNodePtr, size_t> *const_map_ptr, debugger::GraphProto *const graph_proto,
LocDebugDumpMode dump_location = kDebugOff);
LocDebugDumpMode dump_location = kDebugWholeStack);
void ExportFuncGraphOutput(const FuncGraphPtr &func_graph, const CNodePtr &ret_node,
const std::map<AnfNodePtr, size_t> &apply_map, std::map<AnfNodePtr, size_t> *const_map_ptr,
debugger::GraphProto *graph_proto);
@ -66,6 +67,6 @@ class DebuggerProtoExporter {
debugger::ModelProto model_;
};
void DumpIRProtoWithSrcInfo(const FuncGraphPtr &func_graph, const std::string &suffix, const std::string &target_dir,
LocDebugDumpMode dump_location = kDebugOff);
LocDebugDumpMode dump_location = kDebugWholeStack);
} // namespace mindspore
#endif // MINDSPORE_CCSRC_DEBUG_DEBUGGER_MINDSPORE_PROTO_EXPORTER_H_

View File

@ -22,7 +22,7 @@
namespace mindspore {
enum LocDebugDumpMode { kDebugOff = 0, kDebugTopStack = 1, kDebugWholeStack = 2 };
void DumpIRProtoWithSrcInfo(const FuncGraphPtr &func_graph, const std::string &suffix, const std::string &target_dir,
LocDebugDumpMode dump_location = kDebugOff) {
LocDebugDumpMode dump_location = kDebugWholeStack) {
return;
}
} // namespace mindspore