Browse Source

!14565 clean code

From: @hwjiaorui
Reviewed-by: @jjfeing,@zhoufeng54
Signed-off-by: @zhoufeng54
pull/14565/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
0af32e3422
5 changed files with 16 additions and 3 deletions
  1. +2
    -1
      mindspore/ccsrc/backend/kernel_compiler/kash/kernel_pack.cc
  2. +4
    -0
      mindspore/ccsrc/backend/kernel_compiler/oplib/oplib.cc
  3. +6
    -1
      mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_build.cc
  4. +3
    -0
      mindspore/ccsrc/backend/optimizer/ascend/ir_fission/splitv_fission.cc
  5. +1
    -1
      mindspore/ccsrc/runtime/device/ascend/ascend_stream_assign.cc

+ 2
- 1
mindspore/ccsrc/backend/kernel_compiler/kash/kernel_pack.cc View File

@@ -16,6 +16,7 @@


#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
#include <thread>
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#include "securec/include/securec.h" #include "securec/include/securec.h"
#include "utils/log_adapter.h" #include "utils/log_adapter.h"
@@ -212,7 +213,7 @@ bool KernelPack::LoadKernelMeta(const std::string &json_f, const std::string &pr
} catch (std::exception &e) { } catch (std::exception &e) {
MS_LOG(WARNING) << "Parse json file error: " << json_f << ", sleep 500ms and retry again."; MS_LOG(WARNING) << "Parse json file error: " << json_f << ", sleep 500ms and retry again.";
kernel_json.close(); kernel_json.close();
usleep(500000);
std::this_thread::sleep_for(std::chrono::microseconds(500000));
std::ifstream retry_tmp(json_f); std::ifstream retry_tmp(json_f);
if (!retry_tmp.is_open()) { if (!retry_tmp.is_open()) {
MS_LOG(INFO) << "Open json file: " << json_f << " error, please check kernel_meta."; MS_LOG(INFO) << "Open json file: " << json_f << " error, please check kernel_meta.";


+ 4
- 0
mindspore/ccsrc/backend/kernel_compiler/oplib/oplib.cc View File

@@ -164,6 +164,10 @@ bool OpLib::RegOpFromLocalInfo() {
MS_LOG(ERROR) << "Op info path is invalid: " << dir; MS_LOG(ERROR) << "Op info path is invalid: " << dir;
return false; return false;
} }
if (strlen(real_path) >= PATH_MAX) {
MS_LOG(ERROR) << "Op info path is invalid, the absolute path length is greater than PATH_MAX";
return false;
}
#endif #endif
MS_LOG(INFO) << "Start to read op info from local file."; MS_LOG(INFO) << "Start to read op info from local file.";
std::ifstream file(real_path); std::ifstream file(real_path);


+ 6
- 1
mindspore/ccsrc/backend/kernel_compiler/tbe/tbe_kernel_build.cc View File

@@ -29,6 +29,7 @@
#include "utils/ms_context.h" #include "utils/ms_context.h"
#include "runtime/dev.h" #include "runtime/dev.h"
#include "utils/trace_base.h" #include "utils/trace_base.h"
#include "utils/ms_utils.h"


namespace mindspore { namespace mindspore {
namespace kernel { namespace kernel {
@@ -523,7 +524,11 @@ string TbeKernelJsonCreator::GetSocVersion() {
MS_LOG(EXCEPTION) << "GetSocVersion failed."; MS_LOG(EXCEPTION) << "GetSocVersion failed.";
} }
// Get soc version from env value. // Get soc version from env value.
const char *soc_version_env = getenv(kSOC_VERSION);
const char *soc_version_env = nullptr;
std::string str_soc_version_env = common::GetEnv(kSOC_VERSION);
if (!str_soc_version_env.empty()) {
soc_version_env = common::SafeCStr(str_soc_version_env);
}
if (soc_version_env != nullptr) { if (soc_version_env != nullptr) {
if (std::strcmp(soc_version, soc_version_env) != 0) { if (std::strcmp(soc_version, soc_version_env) != 0) {
MS_LOG(WARNING) << "SocVerison will be change."; MS_LOG(WARNING) << "SocVerison will be change.";


+ 3
- 0
mindspore/ccsrc/backend/optimizer/ascend/ir_fission/splitv_fission.cc View File

@@ -51,6 +51,9 @@ size_t GetSmallSplitSize(const AnfNodePtr &split_node, int64_t split_dim, int64_
if (LongToSize(split_dim) >= input_shape.size()) { if (LongToSize(split_dim) >= input_shape.size()) {
MS_LOG(EXCEPTION) << "The split_dim value should be less than the shape size of input 0"; MS_LOG(EXCEPTION) << "The split_dim value should be less than the shape size of input 0";
} }
if (num_split == 0) {
MS_LOG(EXCEPTION) << "Divisor 'num_split' should not be 0.";
}
return input_shape[split_dim] / num_split; return input_shape[split_dim] / num_split;
} }




+ 1
- 1
mindspore/ccsrc/runtime/device/ascend/ascend_stream_assign.cc View File

@@ -1379,7 +1379,7 @@ vector<CNodePtr> AscendStreamAssign::GetLastInputCnode(const NotNull<KernelGraph
} }


vector<CNodePtr> final_inputs; vector<CNodePtr> final_inputs;
uint32_t max = 0;
const uint32_t max = 0;
CNodePtr max_common_cnode = nullptr; CNodePtr max_common_cnode = nullptr;
for (const auto &item : result) { for (const auto &item : result) {
if (IsHcom(item.second.first)) { if (IsHcom(item.second.first)) {


Loading…
Cancel
Save