Browse Source

code check clean

r1.7
liyiqi 4 years ago
parent
commit
1a45442bfb
9 changed files with 16 additions and 20 deletions
  1. +1
    -1
      mindspore/ccsrc/backend/common/optimizer/helper.cc
  2. +1
    -1
      mindspore/ccsrc/cxx_api/dlutils.h
  3. +1
    -1
      mindspore/ccsrc/kernel/common_utils.cc
  4. +4
    -4
      mindspore/ccsrc/plugin/device/ascend/hal/device/distribute/mpi_pycc.cc
  5. +2
    -2
      mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/tbe_json_creator.cc
  6. +3
    -3
      mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_compile.cc
  7. +2
    -6
      mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/ub_pattern_fusion.cc
  8. +1
    -1
      mindspore/ccsrc/plugin/device/ascend/optimizer/format_type/merge_cast_to_op.cc
  9. +1
    -1
      mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/neighbor_exchange_v2_unify_mindir.cc

+ 1
- 1
mindspore/ccsrc/backend/common/optimizer/helper.cc View File

@@ -1022,7 +1022,7 @@ void GetCustomOpAttrIndex(const PrimitivePtr &primitive, mindspore::HashSet<size
MS_LOG(EXCEPTION) << primitive->name() << " found mismatching attr name " << input_names_vec[i]
<< "in input_names and " << attr_names_vec[i - offset] << " in attr_names";
}
indexes->insert(i);
(void)indexes->insert(i);
}
}
}


+ 1
- 1
mindspore/ccsrc/cxx_api/dlutils.h View File

@@ -51,7 +51,7 @@ inline Status DLSoPath(std::string *so_path) {
}
ent = readdir(dir);
}
closedir(dir);
(void)closedir(dir);
} else {
return Status(kMEFailed, "Could not open directory: " + parent_dir);
}


+ 1
- 1
mindspore/ccsrc/kernel/common_utils.cc View File

@@ -156,7 +156,7 @@ std::string GetCompilerCachePath() {
config_path = "./";
} else {
config_path = std::string(value);
FileUtils::CreateNotExistDirs(config_path);
(void)FileUtils::CreateNotExistDirs(config_path);
if (config_path[config_path.length() - 1] != '/') {
config_path += "/";
}


+ 4
- 4
mindspore/ccsrc/plugin/device/ascend/hal/device/distribute/mpi_pycc.cc View File

@@ -37,10 +37,10 @@ void MpiPycc::CreateGroup(const std::string &group, const std::vector<unsigned i
// cppcheck-suppress syntaxError
PYBIND11_MODULE(_ascend_mpi, mpi_initializer) {
mpi_initializer.def("get_device_id", &MpiPycc::GetDeviceID, "get device id");
mpi_initializer.def("get_rank_id", &MpiPycc::GetRankId, "get rank id");
mpi_initializer.def("get_rank_size", &MpiPycc::GetRankSize, "get rank size");
mpi_initializer.def("create_group", &MpiPycc::CreateGroup, "create group");
(void)mpi_initializer.def("get_device_id", &MpiPycc::GetDeviceID, "get device id");
(void)mpi_initializer.def("get_rank_id", &MpiPycc::GetRankId, "get rank id");
(void)mpi_initializer.def("get_rank_size", &MpiPycc::GetRankSize, "get rank size");
(void)mpi_initializer.def("create_group", &MpiPycc::CreateGroup, "create group");
}
} // namespace collective
} // namespace ascend


+ 2
- 2
mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_json/tbe_json_creator.cc View File

@@ -262,10 +262,10 @@ void TbeJsonCreator::DeleteDescName(nlohmann::json *desc_jsons) {
for (auto &desc_json : (*desc_jsons)) {
if (desc_json.is_array()) {
for (auto &desc_item : desc_json) {
desc_item.erase(kJName);
(void)desc_item.erase(kJName);
}
} else {
desc_json.erase(kJName);
(void)desc_json.erase(kJName);
}
}
}


+ 3
- 3
mindspore/ccsrc/plugin/device/ascend/kernel/tbe/tbe_kernel_compile.cc View File

@@ -529,7 +529,7 @@ void TbeKernelCompileManager::Query(const std::string &type) {
if (!task_map_.empty()) {
if (query_cnt % KSleepInterval == 0) {
MS_LOG(INFO) << "Querying Parallel Compilation Job. Current Query Count: " << query_cnt;
sleep(KSleepSeconds);
(void)sleep(KSleepSeconds);
}
}
}
@@ -669,7 +669,7 @@ void TbeKernelCompileManager::DistributePreBuildTask(const std::vector<CNodePtr>
SaveTaskInfo(is_dynamic, build_json, json_name, full_name, task_id, INT64_MAX);

// save pair<task_id, node> for exception print and get node trace
(void)job_id_to_node_.insert(std::pair<int, CNodePtr>(task_id, node));
(void)job_id_to_node_.emplace(std::pair<int, CNodePtr>(task_id, node));
// start compile
auto build_result = DispatchCompileTask(build_json);
auto json_obj = TurnStrToJson(build_result);
@@ -730,7 +730,7 @@ void TbeKernelCompileManager::DistributeCompileTask(const std::vector<CNodePtr>
SaveTaskInfo(is_dynamic, build_json, json_name, full_name, task_id, INT64_MAX);

// save pair<task_id, node> for exception print and get node trace
(void)job_id_to_node_.insert(std::pair<int, CNodePtr>(task_id, node));
(void)job_id_to_node_.emplace(std::pair<int, CNodePtr>(task_id, node));
// start compile
auto build_result = DispatchCompileTask(build_json);
auto json_obj = TurnStrToJson(build_result);


+ 2
- 6
mindspore/ccsrc/plugin/device/ascend/optimizer/buffer_fusion/ub_pattern_fusion.cc View File

@@ -187,18 +187,14 @@ void ReplaceOldNode(mindspore::HashMap<int64_t, BufferFusionInfo_t> *buffer_fusi
MS_EXCEPTION_IF_NULL(manager);
auto buffer_fusion_info = (*buffer_fusion_infos)[fusion_id];
if (buffer_fusion_info.outputs_list.size() == 1) { // single output
if (kernel_graph != nullptr) {
kernel_graph->FrontBackendlMapUpdate(buffer_fusion_info.outputs_list[0], buffer_fusion_kernel);
}
kernel_graph->FrontBackendlMapUpdate(buffer_fusion_info.outputs_list[0], buffer_fusion_kernel);
(void)manager->Replace(buffer_fusion_info.outputs_list[0], buffer_fusion_kernel);
ReplaceInputNodeInOtherFusionScope(buffer_fusion_infos, fusion_id, buffer_fusion_info.outputs_list[0],
buffer_fusion_kernel);
} else { // multiple output
for (size_t index = 0; index < buffer_fusion_info.outputs_list.size(); ++index) {
auto tuple_item = CreateTupleGetItem(buffer_fusion_kernel, kernel_graph, index);
if (kernel_graph != nullptr) {
kernel_graph->FrontBackendlMapUpdate(buffer_fusion_info.outputs_list[index], tuple_item);
}
kernel_graph->FrontBackendlMapUpdate(buffer_fusion_info.outputs_list[index], tuple_item);
(void)manager->Replace(buffer_fusion_info.outputs_list[index], tuple_item);
ReplaceInputNodeInOtherFusionScope(buffer_fusion_infos, fusion_id, buffer_fusion_info.outputs_list[index],
tuple_item);


+ 1
- 1
mindspore/ccsrc/plugin/device/ascend/optimizer/format_type/merge_cast_to_op.cc View File

@@ -68,7 +68,7 @@ bool GetNextNodeAndCastIndex(const FuncGraphPtr &graph, const AnfNodePtr &node,
}
auto node_pair = output_node_list->at(0);
*next_node = node_pair.first;
*cast_index = node_pair.second - 1;
*cast_index = static_cast<size_t>(node_pair.second - 1);
return true;
}



+ 1
- 1
mindspore/ccsrc/plugin/device/ascend/optimizer/mindir/neighbor_exchange_v2_unify_mindir.cc View File

@@ -870,7 +870,7 @@ CNodePtr NeighborExchangeV2GradUnifyMindIR::CreatePadNode(
auto pad = NewCNode(pad_inputs, graph);
std::vector<std::vector<int64_t>> paddings;
for (size_t i = 0; i < shape.size(); ++i) {
(void)paddings.emplace_back(std::vector<int64_t>{begin[i], static_cast<int64_t>(shape[i]) - begin[i] - size[i]});
(void)paddings.emplace_back(std::vector<int64_t>{begin[i], (static_cast<int64_t>(shape[i]) - begin[i]) - size[i]});
}
common::AnfAlgo::SetOutputTypeAndDetailShape({dtype}, {shape_base}, pad.get());
common::AnfAlgo::SetNodeAttr(kAttrPaddings, MakeValue(paddings), pad);


Loading…
Cancel
Save