clean static alarm for operator module with c++.

This commit is contained in:
wangshuide2020 2022-03-24 22:23:29 +08:00
parent 905d7f62f2
commit 4bdd9217ce
12 changed files with 5 additions and 16 deletions

View File

@ -91,7 +91,7 @@ bool AicpuOpKernelLoad::ReadBytesFromBinaryFile(const std::string &file_name, st
return true;
}
bool AicpuOpKernelLoad::GetSoNeedLoadPath(const std::string &so_name, std::string *file_path) const {
bool AicpuOpKernelLoad::GetSoNeedLoadPath(std::string *file_path) const {
MS_EXCEPTION_IF_NULL(file_path);
Dl_info dl_info;
if (dladdr(reinterpret_cast<void *>(const_cast<AicpuOpKernelLoad *>(this)), &dl_info) == 0) {
@ -106,7 +106,6 @@ bool AicpuOpKernelLoad::GetSoNeedLoadPath(const std::string &so_name, std::strin
return false;
}
auto real_cust_kernel_so_path = cust_kernel_so_path.substr(0, pos) + "/";
if (real_cust_kernel_so_path.size() > PATH_MAX) {
MS_LOG(ERROR) << "Current path [" << real_cust_kernel_so_path << "] is too long.";
return false;
@ -119,7 +118,7 @@ bool AicpuOpKernelLoad::GetSoNeedLoadPath(const std::string &so_name, std::strin
bool AicpuOpKernelLoad::PackageBinaryFile(const std::string &so_name,
std::map<std::string, OpKernelBinPtr> *so_name_with_bin_info) {
std::string bin_folder_path;
bool ret = GetSoNeedLoadPath(so_name, &bin_folder_path);
bool ret = GetSoNeedLoadPath(&bin_folder_path);
if (!ret) {
MS_LOG(ERROR) << "GetSoNeedLoadPath failed.";
return false;
@ -144,7 +143,7 @@ bool AicpuOpKernelLoad::PackageBinaryFile(const std::string &so_name,
MS_LOG(ERROR) << "Create OpKernelBin object failed.";
return false;
}
so_name_with_bin_info->insert({so_name, cust_aicpu_kernel_ptr});
so_name_with_bin_info->emplace(so_name, cust_aicpu_kernel_ptr);
return true;
}

View File

@ -62,7 +62,7 @@ class AicpuOpKernelLoad {
private:
bool GetBinaryFileName(const std::string &so_name, const std::string &bin_folder_path, std::string *bin_file_path);
bool ReadBytesFromBinaryFile(const std::string &file_name, std::vector<char> *buffer) const;
bool GetSoNeedLoadPath(const std::string &so_name, std::string *file_path) const;
bool GetSoNeedLoadPath(std::string *file_path) const;
bool PackageBinaryFile(const std::string &so_name, std::map<std::string, OpKernelBinPtr> *so_name_with_bin_info);
bool CacheBinaryFileToDevice(const uintptr_t &resource_id, std::vector<void *> *allocated_mem, void **batch_args);

View File

@ -421,6 +421,5 @@ MS_REG_GPU_KERNEL_TWO(Cast, KernelAttr().AddInputAttr(kNumberTypeComplex128).Add
CastGpuKernelMod, Complex<double>, bool)
MS_REG_GPU_KERNEL_TWO(Cast, KernelAttr().AddInputAttr(kNumberTypeComplex128).AddOutputAttr(kNumberTypeComplex64),
CastGpuKernelMod, Complex<double>, Complex<float>)
} // namespace kernel
} // namespace mindspore

View File

@ -37,6 +37,5 @@ MS_REG_GPU_KERNEL_ONE(DepthToSpace, KernelAttr().AddInputAttr(kNumberTypeUInt32)
DepthToSpaceFwdKernelMod, uint32_t)
MS_REG_GPU_KERNEL_ONE(DepthToSpace, KernelAttr().AddInputAttr(kNumberTypeUInt64).AddOutputAttr(kNumberTypeUInt64),
DepthToSpaceFwdKernelMod, uint64_t)
} // namespace kernel
} // namespace mindspore

View File

@ -90,6 +90,5 @@ MS_REG_GPU_KERNEL_TWO(
ReverseSequence,
KernelAttr().AddInputAttr(kNumberTypeBool).AddInputAttr(kNumberTypeInt64).AddOutputAttr(kNumberTypeBool),
ReverseSequenceFwdGpuKernelMod, bool, int64_t)
} // namespace kernel
} // namespace mindspore

View File

@ -18,7 +18,6 @@
namespace mindspore {
namespace kernel {
#define MS_REG_BROADCAST_COMPLEX_GPU_KERNEL(OPNAME, T0_MS_DTYPE, T1_MS_DTYPE, T0_DTYPE, T1_DTYPE) \
MS_REG_GPU_KERNEL_THREE(OPNAME, \
KernelAttr().AddInputAttr(T0_MS_DTYPE).AddInputAttr(T0_MS_DTYPE).AddOutputAttr(T0_MS_DTYPE), \

View File

@ -77,7 +77,6 @@ ValuePtr AbsInferValue(const PrimitivePtr &prim, const std::vector<AbstractBaseP
return nullptr;
}
auto x_tensor = x->cast<tensor::TensorPtr>();
if (x_tensor == nullptr) {
return nullptr;
}

View File

@ -82,7 +82,6 @@ ValuePtr ComplexInferValue(const PrimitivePtr &prim, const std::vector<AbstractB
return nullptr;
}
auto real_tensor = real->cast<tensor::TensorPtr>();
if (real_tensor == nullptr) {
return nullptr;
}
@ -92,7 +91,6 @@ ValuePtr ComplexInferValue(const PrimitivePtr &prim, const std::vector<AbstractB
return nullptr;
}
auto imag_tensor = imag->cast<tensor::TensorPtr>();
if (imag_tensor == nullptr) {
return nullptr;
}

View File

@ -32,7 +32,6 @@ std::string EinsumGrad::get_equation() const {
auto value_ptr = this->GetAttr(kEquation);
return GetValue<std::string>(value_ptr);
}
// REGISTER_PRIMITIVE_EVAL_IMPL(EinsumGrad, prim::kPrimEinsumGrad, EinsumGradInfer, nullptr, true);
REGISTER_PRIMITIVE_C(kNameEinsumGrad, EinsumGrad);
} // namespace ops
} // namespace mindspore

View File

@ -29,7 +29,7 @@ class MIND_API SliceGrad : public BaseOperator {
public:
MIND_API_BASE_MEMBER(SliceGrad);
SliceGrad() : BaseOperator(kNameSliceGrad) { InitIOName({"dy", "x", "begin", "size"}, {"output"}); }
void Init() {}
void Init() const {}
};
abstract::AbstractBasePtr SliceGradInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
const std::vector<abstract::AbstractBasePtr> &input_args);

View File

@ -80,6 +80,5 @@ AbstractBasePtr IndexAddInfer(const abstract::AnalysisEnginePtr &, const Primiti
return abstract::MakeAbstract(IndexAddInferShape(primitive, input_args), IndexAddInferType(primitive, input_args));
}
REGISTER_PRIMITIVE_EVAL_IMPL(IndexAdd, prim::kPrimIndexAdd, IndexAddInfer, nullptr, true);
} // namespace ops
} // namespace mindspore

View File

@ -74,7 +74,6 @@ ValuePtr SquareInferValue(const PrimitivePtr &prim, const std::vector<AbstractBa
return nullptr;
}
auto x_tensor = x->cast<tensor::TensorPtr>();
if (x_tensor == nullptr) {
return nullptr;
}