forked from huawei/mindspore2022
fix code check
This commit is contained in:
parent
d6605c5dd0
commit
79c447812e
|
|
@ -218,7 +218,6 @@ void DumpOperator(const AnfNodePtr &node, const std::shared_ptr<SubGraphIRInfo>
|
|||
auto cnode = dyn_cast<CNode>(node);
|
||||
if (cnode == nullptr) {
|
||||
MS_LOG(EXCEPTION) << "Parameter \'node\' should be a CNode";
|
||||
return;
|
||||
}
|
||||
AnfNodePtr op = cnode->input(0);
|
||||
MS_EXCEPTION_IF_NULL(op);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ namespace mindspore {
|
|||
namespace {
|
||||
API_FACTORY_REG(GraphCell::GraphImpl, AscendGraphImpl);
|
||||
|
||||
constexpr const char *kHcclEnable = "MS_ENABLE_HCCL";
|
||||
constexpr const char *kHcclGroupFile = "PARA_GROUP_FILE";
|
||||
constexpr auto kHcclEnable = "MS_ENABLE_HCCL";
|
||||
constexpr auto kHcclGroupFile = "PARA_GROUP_FILE";
|
||||
|
||||
void InitHccl() {
|
||||
auto ms_context = MsContext::GetInstance();
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ class COMMON_EXPORT Common {
|
|||
static bool FileExists(const std::string &filepath);
|
||||
static bool CommonFuncForConfigPath(const std::string &default_path, const std::string &env_path, std::string *value);
|
||||
static std::string GetCompilerCachePath();
|
||||
static std::string GetUserDefineCachePath();
|
||||
static bool GetDebugTerminate();
|
||||
static bool GetDebugExitSuccess();
|
||||
static void DebugTerminate(bool val, bool exit_success);
|
||||
|
||||
private:
|
||||
static bool IsEveryFilenameValid(const std::string &path, size_t length_limit, const std::string &error_message);
|
||||
static std::string GetUserDefineCachePath();
|
||||
|
||||
inline static bool debugger_terminate_ = false;
|
||||
inline static bool exit_success_ = false;
|
||||
|
|
|
|||
|
|
@ -146,23 +146,7 @@ FusionType GetFusionTypeByName(const std::string &name) {
|
|||
return iter->first;
|
||||
}
|
||||
|
||||
std::string GetCompilerCachePath() {
|
||||
static std::string config_path = "";
|
||||
if (config_path != "") {
|
||||
return config_path;
|
||||
}
|
||||
const char *value = ::getenv(kCOMPILER_CACHE_PATH);
|
||||
if (value == nullptr) {
|
||||
config_path = "./";
|
||||
} else {
|
||||
config_path = std::string(value);
|
||||
(void)FileUtils::CreateNotExistDirs(config_path);
|
||||
if (config_path[config_path.length() - 1] != '/') {
|
||||
config_path += "/";
|
||||
}
|
||||
}
|
||||
return config_path;
|
||||
}
|
||||
std::string GetCompilerCachePath() { return Common::GetUserDefineCachePath(); }
|
||||
|
||||
void KernelMeta::Initialize() {
|
||||
auto config_path = GetCompilerCachePath();
|
||||
|
|
@ -1003,12 +987,12 @@ size_t UnitSizeInBytes(const mindspore::TypeId &t) {
|
|||
}
|
||||
|
||||
KernelAttr &KernelAttr::AddInputAttr(const TypeId &ms_type, const std::string &format) {
|
||||
input_type_.emplace_back(ms_type, format);
|
||||
(void)input_type_.emplace_back(ms_type, format);
|
||||
return *this;
|
||||
}
|
||||
|
||||
KernelAttr &KernelAttr::AddOutputAttr(const TypeId &ms_type, const std::string &format) {
|
||||
output_type_.emplace_back(ms_type, format);
|
||||
(void)output_type_.emplace_back(ms_type, format);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -1106,10 +1090,10 @@ KernelAttr GetKernelAttrFromBuildInfo(const KernelBuildInfoPtr &build_info) {
|
|||
MS_EXCEPTION_IF_NULL(build_info);
|
||||
KernelAttr kernel_attr;
|
||||
for (size_t i = 0; i < build_info->GetInputNum(); i++) {
|
||||
kernel_attr.AddInputAttr(build_info->GetInputDeviceType(i), build_info->GetInputFormat(i));
|
||||
(void)kernel_attr.AddInputAttr(build_info->GetInputDeviceType(i), build_info->GetInputFormat(i));
|
||||
}
|
||||
for (size_t j = 0; j < build_info->GetOutputNum(); j++) {
|
||||
kernel_attr.AddOutputAttr(build_info->GetOutputDeviceType(j), build_info->GetOutputFormat(j));
|
||||
(void)kernel_attr.AddOutputAttr(build_info->GetOutputDeviceType(j), build_info->GetOutputFormat(j));
|
||||
}
|
||||
return kernel_attr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,9 @@ size_t KernelBuildInfo::GetInputNum() const { return inputs_format_.size(); }
|
|||
size_t KernelBuildInfo::GetOutputNum() const { return outputs_format_.size(); }
|
||||
|
||||
size_t KernelBuildInfo::GetOutputNumWithoutMonad() const {
|
||||
return std::count_if(outputs_device_type_.begin(), outputs_device_type_.end(),
|
||||
[](TypeId type) { return type != TypeId::kObjectTypeUMonad; });
|
||||
const auto count = std::count_if(outputs_device_type_.begin(), outputs_device_type_.end(),
|
||||
[](TypeId type) { return type != TypeId::kObjectTypeUMonad; });
|
||||
return static_cast<size_t>(count);
|
||||
}
|
||||
|
||||
std::string KernelBuildInfo::GetInputReshapeType(size_t input_index) const {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ namespace kernel {
|
|||
* @brief fuse op and return a callable mod
|
||||
*/
|
||||
struct FusionScopeInfo {
|
||||
FusionScopeInfo(int64_t id, const std::string &f_name, std::string core_type, std::vector<AnfNodePtr> in,
|
||||
FusionScopeInfo(int64_t id, std::string f_name, std::string core_type, std::vector<AnfNodePtr> in,
|
||||
std::vector<AnfNodePtr> comp, std::vector<AnfNodePtr> out)
|
||||
: scope_id(id),
|
||||
full_name(f_name),
|
||||
core_type(core_type),
|
||||
full_name(std::move(f_name)),
|
||||
core_type(std::move(core_type)),
|
||||
input_nodes(std::move(in)),
|
||||
compute_nodes(std::move(comp)),
|
||||
output_nodes(std::move(out)) {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue