From: @hwjiaorui Reviewed-by: @jjfeing,@zhoufeng54 Signed-off-by: @zhoufeng54pull/14565/MERGE
| @@ -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."; | ||||
| @@ -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); | ||||
| @@ -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."; | ||||
| @@ -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; | ||||
| } | } | ||||
| @@ -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)) { | ||||