fix compile win in cpu&gpu

This commit is contained in:
jjfeing 2022-11-23 15:54:57 +08:00
parent 4d460ccc45
commit 144d1af171
4 changed files with 19 additions and 3 deletions

View File

@ -37,10 +37,17 @@ constexpr auto kVersion910APath =
"/usr/local/Ascend/latest/opp/op_impl/built-in/ai_core/tbe/config/ascend910/aic-ascend910-ops-info.json";
constexpr auto kVersion920APath =
"/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/config/ascend920/aic-ascend920-ops-info.json";
constexpr auto kVersion910ATPath =
"/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/config/ascend910/"
"aic-ascend910-ops-info.json";
static const std::map<std::string, std::string> kVersionPathMap = {{kVersion910A, kVersion910APath},
{kVersion910ProA, kVersion910APath},
{kVersion910PremiumA, kVersion910APath},
{kVersion920A, kVersion920APath}};
static const std::map<std::string, std::string> kVersionPathTMap = {
{kVersion910A, kVersion910ATPath}, {kVersion910ProA, kVersion910ATPath}, {kVersion910PremiumA, kVersion910ATPath}};
static const std::map<std::string, OpPattern> kPatternMap = {
{kFormatAgnostic, kFormatAgnosticPattern},
{kBroadcast, kBroadcastPattern},
@ -66,7 +73,7 @@ bool OpInfoUtils::GenerateOpInfos(const std::string &version) {
const std::string &op_name = item.key();
// hard code
if (SuperBar::IsSkipNode(op_name)) {
MS_LOG(WARNING) << "Skip node: " << op_name;
MS_LOG(INFO) << "Note: Skip node: " << op_name;
continue;
}
// Step2. Parse common item
@ -111,6 +118,7 @@ bool OpInfoUtils::GenerateOpInfos(const std::string &version) {
bool OpInfoUtils::LoadOpInfoJson(const std::string &version, nlohmann::json *js_) {
std::string dir = common::GetEnv("MINDSPORE_OP_INFO_JSON_PATH");
if (dir.empty()) {
// normal path
auto iter = kVersionPathMap.find(version);
if (iter != kVersionPathMap.end()) {
dir = iter->second;
@ -120,6 +128,13 @@ bool OpInfoUtils::LoadOpInfoJson(const std::string &version, nlohmann::json *js_
}
}
auto real_path = FileUtils::GetRealPath(dir.c_str());
if (!real_path.has_value()) {
// ascend tool path
auto iter = kVersionPathTMap.find(version);
if (iter != kVersionPathTMap.end()) {
real_path = FileUtils::GetRealPath(iter->second.c_str());
}
}
if (!real_path.has_value()) {
MS_LOG(ERROR) << "Invalid environment variable 'MINDSPORE_OP_INFO_JSON_PATH', the path is: " << dir
<< ". Please check (1) whether the path exists, (2) whether the path has the access permission, "

View File

@ -84,11 +84,11 @@ bool OpLib::RegOp(const std::string &json_string, const std::string &impl_path)
}
}
auto op_info = DecodeOpInfo(op_json, imply_type, impl_path);
op_info->set_processor(key_suffix);
if (op_info == nullptr) {
MS_LOG(ERROR) << "RegOp failed: op_name: " << op_name << " imply_type " << imply_type_str;
return false;
}
op_info->set_processor(key_suffix);
(void)op_infos[imply_type].insert(std::pair<std::string, OpInfoPtr>(key, op_info));
} catch (const std::exception &e) {
MS_LOG(ERROR) << "Get op json elements failed: " << e.what();

View File

@ -20,6 +20,7 @@
#include <vector>
#include <utility>
#include <string>
#include <optional>
#include <nlohmann/json.hpp>
#include "include/backend/visible.h"
namespace mindspore::kernel {

View File

@ -886,7 +886,7 @@ void TbeKernelCompileManager::LoadNotSupportOp() {
std::ifstream file_read;
file_read.open(cache_file.c_str());
if (!file_read.is_open()) {
MS_LOG(WARNING) << "File is not open. File: " << cache_file;
MS_LOG(INFO) << "Note: File is not open. File: " << cache_file;
return;
}
std::string json_name;