diff --git a/mindspore/ccsrc/debug/data_dump/e2e_dump_util.cc b/mindspore/ccsrc/debug/data_dump/e2e_dump_util.cc index fc3682b670..09f305b431 100644 --- a/mindspore/ccsrc/debug/data_dump/e2e_dump_util.cc +++ b/mindspore/ccsrc/debug/data_dump/e2e_dump_util.cc @@ -121,8 +121,8 @@ void E2eDumpUtil::DumpOutput(const session::KernelGraph *graph, const std::strin auto type = AnfAlgo::GetOutputInferDataType(node, j); std::string file_path = dump_path + '/' + kernel_name + '_' + "output_" + std::to_string(j); if (IsDeviceTargetGPU()) { - DumpGPUMemToFile(file_path, node->fullname_with_scope() + "_output", NOT_NULL(addr), trans_flag, int_shapes, - type, j, debugger); + DumpGPUMemToFile(file_path, node->fullname_with_scope(), NOT_NULL(addr), trans_flag, int_shapes, type, j, + debugger); } else { DumpMemToFile(file_path, NOT_NULL(addr), trans_flag, int_shapes, type); } @@ -155,13 +155,24 @@ void E2eDumpUtil::DumpInput(const session::KernelGraph *graph, const std::string auto index = kernel_with_index.second; auto addr = AnfAlgo::GetOutputAddr(input, index); + std::string tensor_name; + size_t slot; + if (IsDeviceTargetGPU()) { + auto input_kernel = node->input(j + 1); + std::string input_kernel_name = input_kernel->fullname_with_scope(); + tensor_name = input_kernel_name; + slot = 0; + } else { + tensor_name = node->fullname_with_scope(); + slot = j; + } + ShapeVector int_shapes; GetDumpIntShape(input, index, trans_flag, NOT_NULL(&int_shapes)); auto type = AnfAlgo::GetOutputInferDataType(input, index); std::string file_path = dump_path + '/' + kernel_name + '_' + "input_" + std::to_string(j); if (IsDeviceTargetGPU()) { - DumpGPUMemToFile(file_path, node->fullname_with_scope() + "_input", NOT_NULL(addr), trans_flag, int_shapes, - type, j, debugger); + DumpGPUMemToFile(file_path, tensor_name, NOT_NULL(addr), trans_flag, int_shapes, type, slot, debugger); } else { DumpMemToFile(file_path, NOT_NULL(addr), trans_flag, int_shapes, type); } @@ -249,7 +260,7 @@ void E2eDumpUtil::DumpSingleAnfnode(const AnfNodePtr &anf_node, const size_t out std::string file_path = dump_path + '/' + dump_name + '_' + "output_0"; if (IsDeviceTargetGPU()) { - DumpGPUMemToFile(file_path, node_name + "_output", NOT_NULL(addr), trans_flag, int_shapes, type, 0, debugger); + DumpGPUMemToFile(file_path, node_name, NOT_NULL(addr), trans_flag, int_shapes, type, 0, debugger); } else { DumpMemToFile(file_path, NOT_NULL(addr), trans_flag, int_shapes, type); } diff --git a/mindspore/ccsrc/debug/debugger/debugger.cc b/mindspore/ccsrc/debug/debugger/debugger.cc index 2d67d62fc5..72ef147496 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.cc +++ b/mindspore/ccsrc/debug/debugger/debugger.cc @@ -909,7 +909,7 @@ void Debugger::LoadSingleAnfnode(const AnfNodePtr &anf_node, const size_t output MS_EXCEPTION_IF_NULL(addr); auto type = AnfAlgo::GetOutputInferDataType(anf_node, output_index); auto format = kOpFormat_DEFAULT; - string tensor_name = node_name + "_output:" + "0"; + string tensor_name = node_name + ':' + "0"; ShapeVector int_shapes; auto shape = AnfAlgo::GetOutputDeviceShape(anf_node, output_index); (void)std::transform(shape.begin(), shape.end(), std::back_inserter(int_shapes), diff --git a/mindspore/ccsrc/runtime/device/gpu/gpu_kernel_runtime.cc b/mindspore/ccsrc/runtime/device/gpu/gpu_kernel_runtime.cc index 4cfeb00a75..216ecb0eee 100644 --- a/mindspore/ccsrc/runtime/device/gpu/gpu_kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/gpu/gpu_kernel_runtime.cc @@ -119,27 +119,22 @@ void LoadKernelData(Debugger *debugger, const CNodePtr &kernel, return; } - if (dump_json_parser.InputNeedDump()) { + if (debugger->debugger_enabled() || dump_json_parser.InputNeedDump()) { // get inputs auto input_size = AnfAlgo::GetInputTensorNum(kernel); for (size_t j = 0; j < input_size; ++j) { - auto kernel_with_index = AnfAlgo::GetPrevNodeOutput(kernel, j); - auto input_kernel = kernel_with_index.first; - auto index = kernel_with_index.second; - + auto input_kernel = kernel->input(j + 1); std::string input_kernel_name = input_kernel->fullname_with_scope(); auto addr = kernel_inputs[j]; auto type = AnfAlgo::GetOutputInferDataType(input_kernel, PARAMETER_OUTPUT_INDEX); auto format = kOpFormat_DEFAULT; auto gpu_addr = std::make_unique(addr->addr, addr->size, format, type); - string input_tensor_name = input_kernel_name + "_output:" + std::to_string(index); + string input_tensor_name = input_kernel_name + ':' + "0"; ShapeVector int_shapes; auto shape = AnfAlgo::GetOutputDeviceShape(input_kernel, PARAMETER_OUTPUT_INDEX); (void)std::transform(shape.begin(), shape.end(), std::back_inserter(int_shapes), [](size_t inner_item) { return SizeToInt(inner_item); }); - auto cur_node_name = kernel->fullname_with_scope(); - auto ret = gpu_addr->LoadMemToHost(cur_node_name + "_input:" + std::to_string(j), exec_order, format, int_shapes, - type, 0, true); + auto ret = gpu_addr->LoadMemToHost(input_tensor_name, exec_order, format, int_shapes, type, 0, true); if (!ret) { MS_LOG(ERROR) << "LoadMemToHost:" << ", tensor_name:" << input_tensor_name << ", host_format:" << format << ".!"; @@ -147,7 +142,7 @@ void LoadKernelData(Debugger *debugger, const CNodePtr &kernel, } } - if (dump_json_parser.OutputNeedDump()) { + if (debugger->debugger_enabled() || dump_json_parser.OutputNeedDump()) { // get outputs auto output_size = AnfAlgo::GetOutputTensorNum(kernel); auto node_name = AnfAlgo::GetCNodeName(kernel); @@ -161,7 +156,7 @@ void LoadKernelData(Debugger *debugger, const CNodePtr &kernel, auto type = AnfAlgo::GetOutputInferDataType(kernel, j); auto format = kOpFormat_DEFAULT; auto gpu_addr = std::make_unique(addr->addr, addr->size, format, type); - string tensor_name = kernel_name + "_output:" + "0"; + string tensor_name = kernel_name + ':' + std::to_string(j); ShapeVector int_shapes; auto shape = AnfAlgo::GetOutputDeviceShape(kernel, j); (void)std::transform(shape.begin(), shape.end(), std::back_inserter(int_shapes),