fix codecheck for debugger and summary

This commit is contained in:
maning202007 2021-06-02 14:59:18 +08:00
parent 475386e338
commit c12c0d9a71
4 changed files with 10 additions and 14 deletions

View File

@ -49,7 +49,7 @@ void E2eDump::DumpGPUMemToFile(const std::string &file_path, const std::string &
auto ret = debugger->DumpTensorToFile(original_kernel_name, trans_flag, file_path, format, int_shapes, host_type,
device_type, addr->format(), slot);
if (!ret) {
MS_LOG(ERROR) << "DumpTensorToFile Failed: flag:" << std::to_string(trans_flag) << ", path:" << file_path
MS_LOG(ERROR) << "DumpTensorToFile Failed: flag:" << trans_flag << ", path:" << file_path
<< ", host_format:" << format;
}
#endif

View File

@ -1050,13 +1050,7 @@ void Debugger::SetStepNum(int32_t cur_num_step) {
int32_t Debugger::step_num() const { return num_step_; }
uint64_t BytestoUInt64(const std::vector<char> &buffer) {
uint64_t ret = (uint64_t)buffer[0];
const int SHIFT = 8;
const int MAX_INDEX = 8;
for (int i = 1; i < MAX_INDEX; i++) {
ret = ((uint64_t)buffer[i] << (i * SHIFT)) | ret;
}
return ret;
return le64toh(*reinterpret_cast<const uint64_t *>(buffer.data()));
}
std::vector<std::string> Debugger::CheckOpOverflow() {
@ -1094,7 +1088,7 @@ std::vector<std::string> Debugger::CheckOpOverflow() {
std::vector<char> buffer;
const size_t buf_size = 256;
buffer.resize(buf_size);
infile.read(buffer.data(), buf_size);
(void)infile.read(buffer.data(), buf_size);
const uint8_t stream_id_offset = 16;
const uint8_t task_id_offset = 24;
// The stream_id and task_id in the dump file are 8 byte fields for extensibility purpose, but only hold 4

View File

@ -692,9 +692,9 @@ bool AscendDeviceAddress::DumpMemToFile(const std::string &filepath, const std::
}
#ifdef ENABLE_DEBUGGER
bool AscendDeviceAddress::LoadMemToHost(const std::string &tensor_name, int execution_order,
const std::string &host_fmt, const ShapeVector &host_shape, TypeId host_type,
size_t slot, bool keep_prev) const {
bool AscendDeviceAddress::LoadMemToHost(const std::string &tensor_name, int execution_order, const std::string &,
const ShapeVector &host_shape, TypeId host_type, size_t slot,
bool keep_prev) const {
bool ret = false;
if (Debugger::GetInstance()->TensorExistsInCurrent(tensor_name)) {
MS_LOG(INFO) << tensor_name << " already loaded for this step so not loading it again.";

View File

@ -285,14 +285,16 @@ class SummaryCollector(Callback):
return custom_lineage_data
def _check_custom_lineage_type(self, param_name, custom_lineage):
@staticmethod
def _check_custom_lineage_type(param_name, custom_lineage):
"""Check custom lineage type."""
check_value_type(param_name, custom_lineage, [dict, type(None)])
for key, value in custom_lineage.items():
check_value_type(f'{param_name} -> {key}', key, str)
check_value_type(f'the value of {param_name} -> {key}', value, (int, str, float))
def _collect_optimizer_custom_lineage_data(self):
@staticmethod
def _collect_optimizer_custom_lineage_data():
"""Collect custom lineage data if mindoptimizer has set the hyper config"""
auto_custom_lineage_data = {}