Browse Source

add origin_shape for dump

pull/14204/head
caifubi 4 years ago
parent
commit
dc96d61eca
2 changed files with 20 additions and 12 deletions
  1. +14
    -8
      mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc
  2. +6
    -4
      mindspore/ccsrc/runtime/device/ascend/dump/proto/op_mapping_info.proto

+ 14
- 8
mindspore/ccsrc/runtime/device/ascend/dump/data_dumper.cc View File

@@ -355,6 +355,12 @@ void DataDumper::RtLoadDumpData(const aicpu::dump::OpMappingInfo &dump_info, voi
}
}

void SetDumpShape(const std::vector<size_t> &ms_shape, NotNull<aicpu::dump::Shape *> dump_shape) {
for (auto &dim : ms_shape) {
dump_shape->add_dim(dim);
}
}

void DataDumper::DumpKernelOutput(const CNodePtr &kernel, void *args, NotNull<aicpu::dump::Task *> task) {
if (!DumpJsonParser::GetInstance().OutputNeedDump()) {
MS_LOG(INFO) << "Skip dump output";
@@ -368,14 +374,14 @@ void DataDumper::DumpKernelOutput(const CNodePtr &kernel, void *args, NotNull<ai
auto data_type = AnfAlgo::GetOutputDeviceDataType(kernel, i);
auto output_format = AnfAlgo::GetOutputFormat(kernel, i);
auto output_shape = AnfAlgo::GetOutputDeviceShape(kernel, i);
auto output_origin_shape = AnfAlgo::GetOutputInferShape(kernel, i);

aicpu::dump::Output output;
output.set_data_type(GeTypesConvert::GetGeDataType(data_type));
output.set_format(GeTypesConvert::GetGeFormat(output_format, output_shape.size()));
MS_EXCEPTION_IF_NULL(output.mutable_shape());
for (auto dim : output_shape) {
output.mutable_shape()->add_dim(dim);
}
SetDumpShape(output_shape, NOT_NULL(output.mutable_shape()));
SetDumpShape(output_origin_shape, NOT_NULL(output.mutable_origin_shape()));

output.set_original_output_format(GeTypesConvert::GetGeFormat(output_format, output_shape.size()));
output.set_address(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(args)) + offset);
// device address data size
@@ -409,13 +415,13 @@ void DataDumper::DumpKernelInput(const CNodePtr &kernel, void *args, NotNull<aic
output_type = AnfAlgo::GetOutputInferDataType(input_node, input_index);
}
auto output_shape = AnfAlgo::GetOutputDeviceShape(input_node, input_index);
auto output_origin_shape = AnfAlgo::GetOutputInferShape(input_node, input_index);

input.set_data_type(GeTypesConvert::GetGeDataType(output_type));
input.set_format(GeTypesConvert::GetGeFormat(output_format, output_shape.size()));
MS_EXCEPTION_IF_NULL(input.mutable_shape());
for (auto dim : output_shape) {
input.mutable_shape()->add_dim(dim);
}
SetDumpShape(output_shape, NOT_NULL(input.mutable_shape()));
SetDumpShape(output_origin_shape, NOT_NULL(input.mutable_origin_shape()));

input.set_address(static_cast<uint64_t>(reinterpret_cast<uintptr_t>(args)) + offset);
// device address data size
auto address = AnfAlgo::GetPrevNodeOutputAddr(kernel, i);


+ 6
- 4
mindspore/ccsrc/runtime/device/ascend/dump/proto/op_mapping_info.proto View File

@@ -31,7 +31,8 @@ message Output {
int32 original_output_data_type = 7;
int32 original_output_format = 8;
uint64 size = 9;
};
Shape origin_shape = 10;
}

message Input {
int32 data_type = 1;
@@ -39,12 +40,13 @@ message Input {
Shape shape = 3;
uint64 address = 4;
uint64 size = 5;
Shape origin_shape = 6;
}

message Op {
string op_name = 1;
string op_type = 2;
};
}

message Task {
uint32 task_id = 1;
@@ -53,7 +55,7 @@ message Task {
repeated Output output = 4;
bool end_graph = 5;
repeated Input input = 6;
};
}

message OpMappingInfo {
string dump_path = 1;
@@ -75,4 +77,4 @@ message OpMappingInfo {
uint32 flag = 7; // 0x01 load, 0x00 unload
repeated Task task = 8;
string dump_step = 9;
};
}

Loading…
Cancel
Save