diff --git a/mindspore/ccsrc/backend/kernel_compiler/kernel_fusion.cc b/mindspore/ccsrc/backend/kernel_compiler/kernel_fusion.cc index 0c357660d7..d5095db92f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/kernel_fusion.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/kernel_fusion.cc @@ -17,6 +17,7 @@ #include "backend/kernel_compiler/kernel_fusion.h" #include +#include #include #include #include "backend/kernel_compiler/tbe/tbe_kernel_build.h" diff --git a/mindspore/ccsrc/backend/optimizer/pass/optimize_dependence.cc b/mindspore/ccsrc/backend/optimizer/pass/optimize_dependence.cc index d032e77a39..daa4df3b7f 100644 --- a/mindspore/ccsrc/backend/optimizer/pass/optimize_dependence.cc +++ b/mindspore/ccsrc/backend/optimizer/pass/optimize_dependence.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include "backend/optimizer/common/helper.h" #include "base/core_ops.h" #include "utils/utils.h" diff --git a/mindspore/ccsrc/backend/session/ascend_auto_monad.cc b/mindspore/ccsrc/backend/session/ascend_auto_monad.cc index 5d4ae3f58c..181941e610 100644 --- a/mindspore/ccsrc/backend/session/ascend_auto_monad.cc +++ b/mindspore/ccsrc/backend/session/ascend_auto_monad.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/mindspore/ccsrc/cxx_api/serialization.cc b/mindspore/ccsrc/cxx_api/serialization.cc index 4f3e3c7204..e5c83f8574 100644 --- a/mindspore/ccsrc/cxx_api/serialization.cc +++ b/mindspore/ccsrc/cxx_api/serialization.cc @@ -34,7 +34,6 @@ static Buffer ReadFile(const std::string &file) { #else real_path_ret = realpath(common::SafeCStr(file), real_path_mem); #endif - if (real_path_ret == nullptr) { MS_LOG(ERROR) << "File: " << file << " is not exist."; return buffer; diff --git a/mindspore/ccsrc/runtime/device/ascend/ascend_launch_atomic_clean.cc b/mindspore/ccsrc/runtime/device/ascend/ascend_launch_atomic_clean.cc index 6abec78828..9b02f71387 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ascend_launch_atomic_clean.cc +++ b/mindspore/ccsrc/runtime/device/ascend/ascend_launch_atomic_clean.cc @@ -82,6 +82,9 @@ std::shared_ptr AscendLaunchAtomicClean::ObtainAtomicClean std::vector output_dtypes = {}; // obtain input & output shapes size_t dtype_size = abstract::TypeIdSize(dtype_); + if (dtype_size == 0) { + MS_LOG(EXCEPTION) << "Divide by zero."; + } int64_t shape = total_size_ / dtype_size; std::vector> input_shapes = {{shape}}; std::vector> output_shapes = {}; diff --git a/mindspore/ccsrc/runtime/device/bucket.cc b/mindspore/ccsrc/runtime/device/bucket.cc index 7c9fef7a03..cbaa9239b5 100644 --- a/mindspore/ccsrc/runtime/device/bucket.cc +++ b/mindspore/ccsrc/runtime/device/bucket.cc @@ -64,8 +64,6 @@ void Bucket::Launch() { MS_LOG(INFO) << "Bucket launch cost:" << (GetTime() - start) * 1e6 << " us"; } -// TODO(caifubi): float16 grad cast to float32 grad - void Bucket::UpdateTensorAddr() { if (grad_tensor_list_.size() != bucket_size_ || new_tensor_output_addrs_.size() != bucket_size_) { MS_LOG(EXCEPTION) << "grad_tensor_list size:" << grad_tensor_list_.size() @@ -80,7 +78,6 @@ void Bucket::UpdateTensorAddr() { // release old addr and manage addr by this Bucket. MS_EXCEPTION_IF_NULL(device_address); auto origin_dev_ptr = device_address->GetMutablePtr(); - // FreeDeviceMem(origin_dev_ptr); tensor_old_addr_list_.emplace_back(origin_dev_ptr); device_address->from_mem_pool_ = false; device_address->set_ptr(new_tensor_output_addrs_[i]); diff --git a/mindspore/ccsrc/runtime/device/launch_mul.cc b/mindspore/ccsrc/runtime/device/launch_mul.cc index 8ae1e536b8..c11f1f135e 100644 --- a/mindspore/ccsrc/runtime/device/launch_mul.cc +++ b/mindspore/ccsrc/runtime/device/launch_mul.cc @@ -29,6 +29,9 @@ std::shared_ptr LaunchMul::ObtainMulKernelGraph() { // obtain input & output shapes size_t dtype_size = abstract::TypeIdSize(dtype_); int64_t shape = total_size_ / dtype_size; + if (dtype_size == 0) { + MS_LOG(EXCEPTION) << "Divide by zero."; + } std::vector> input_shapes = {{shape}, {1}}; std::vector> output_shapes = {{static_cast(shape)}}; auto mul_graph = session::SingleKernelGraph::ConstructKernelGraphBasedOnSingleOp(