!49101 Fix the error log 'Incorrect parameter' for dump on CPU and Ascend

Merge pull request !49101 from maning202007/master
This commit is contained in:
i-robot 2023-02-27 12:01:21 +00:00 committed by Gitee
commit 54941c310e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 0 deletions

View File

@ -184,6 +184,10 @@ bool AscendAsyncDump::ConvertFormatForOneTensor(dump_data_t *dump_tensor_info) {
MS_LOG(ERROR) << "Trans format failed.";
}
}
} else {
MS_LOG(INFO) << "The host_format and device_format are same, no need to convert format for file: "
<< dump_tensor_info->dump_file_path;
return true;
}
if (trans_success) {
dump_tensor_info->format = host_format;
@ -274,6 +278,9 @@ bool AscendAsyncDump::DumpTensorDataIfNeeded(const dump_data_t &dump_tensor_info
if (trans_buf) {
dump_succ = DumpJsonParser::DumpToFile(dump_path_slot, trans_buf->data_c(), trans_buf->Size(),
dump_tensor_info.host_shape, dump_tensor_info.data_type);
} else if (dump_tensor_info.data_size == 0) {
MS_LOG(INFO) << "Data size is 0 for file: " << dump_tensor_info.dump_file_path << " no need to dump.";
return true;
} else {
dump_succ = DumpJsonParser::DumpToFile(dump_path_slot, dump_tensor_info.data_ptr, dump_tensor_info.data_size,
dump_tensor_info.host_shape, dump_tensor_info.data_type);

View File

@ -117,6 +117,10 @@ bool CPUDeviceAddress::DumpMemToFile(const std::string &filepath, const std::str
}
std::string path = filepath + '.' + format_;
MS_LOG(DEBUG) << "E2E Dump path is " << path;
if (size_ == 0) {
MS_LOG(INFO) << "Data size is 0 for file: " << path << ", no need to dump.";
return true;
}
ret = DumpJsonParser::DumpToFile(path, ptr_, size_, host_shape, host_type);
#endif
return ret;