提交 998ff039 编写于 作者: H huanghui

clear codex and reviewbot warning

上级 2060edb0
......@@ -93,9 +93,9 @@ void ScatterNdUpdateCPUKernel::LaunchKernel(const std::vector<AddressPtr> &input
output_unit_offsets_[i] = offset;
}
auto mem_size = inputs[0]->size;
for (int i = 0; i < num_units_; i++) {
auto ret =
memcpy_s(x + output_unit_offsets_[i], unit_size_ * sizeof(T), updates + unit_size_ * i, unit_size_ * sizeof(T));
auto ret = memcpy_s(x + output_unit_offsets_[i], mem_size, updates + unit_size_ * i, unit_size_ * sizeof(T));
if (ret != 0) {
MS_LOG(EXCEPTION) << "memcpy_s error, errorno" << ret;
}
......
......@@ -39,10 +39,10 @@ class ScatterNdUpdateCPUKernel : public CPUKernel {
private:
void Check(const CNodePtr &kernel_node);
TypeId dtype_;
int unit_size_;
int num_units_;
int indices_unit_rank_;
TypeId dtype_{kTypeUnknown};
int unit_size_{0};
int num_units_{0};
int indices_unit_rank_{0};
std::vector<size_t> shape_;
std::vector<int> output_unit_offsets_;
std::vector<int> out_strides_;
......
......@@ -39,8 +39,8 @@ class UniqueCPUKernel : public CPUKernel {
private:
void CheckParam(const CNodePtr &kernel_node);
size_t n_;
TypeId dtype_;
size_t n_{0};
TypeId dtype_{kTypeUnknown};
};
MS_REG_CPU_KERNEL(
......@@ -57,5 +57,4 @@ MS_REG_CPU_KERNEL(
UniqueCPUKernel);
} // namespace kernel
} // namespace mindspore
#endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_UNIQUE_CPU_KERNEL_H_
......@@ -40,7 +40,7 @@ class UniqueWithPadCPUKernel : public CPUKernel {
private:
void CheckParam(const CNodePtr &kernel_node);
int64_t n_{0};
TypeId dtype_{0};
TypeId dtype_{kTypeUnknown};
};
MS_REG_CPU_KERNEL(UniqueWithPad,
......@@ -58,8 +58,6 @@ MS_REG_CPU_KERNEL(UniqueWithPad,
.AddOutputAttr(kNumberTypeInt64)
.AddOutputAttr(kNumberTypeInt64),
UniqueWithPadCPUKernel);
} // namespace kernel
} // namespace mindspore
#endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_UNIQUE_WITH_PAD_CPU_KERNEL_H_
......@@ -195,8 +195,7 @@ const AnfNodePtr LambNextMVWithDecayV1Rule::Process(const FuncGraphPtr &func_gra
std::vector<AnfNodePtr> fusion_node_outputs;
CreateMultipleOutputsOfAnfNode(func_graph, fusion_node, kLambNextMVWithDecayV1OutputNum, &fusion_node_outputs);
if (fusion_node_outputs.size() != kLambNextMVWithDecayV1OutputNum) {
MS_LOG(ERROR) << "create multiple outputs for fusion node fail!";
return nullptr;
MS_LOG(EXCEPTION) << "create multiple outputs for fusion node fail!";
}
(void)manager->Replace(add0, fusion_node_outputs[1]);
......
......@@ -97,6 +97,25 @@ void CheckInputs(const std::vector<AnfNodePtr> &fusion_inputs) {
MS_LOG(EXCEPTION) << "Different communication op in one segment cannot share the same input";
}
}
bool CheckSegments(size_t segments, size_t communication_op_node_size, std::vector<size_t> *segment_index) {
MS_EXCEPTION_IF_NULL(segment_index);
if (segments >= communication_op_node_size) {
MS_LOG(INFO) << "fusion not changed: segment_num=" << segments
<< ", communication_op_node_size=" << communication_op_node_size;
return false;
}
if (segment_index->at(segments - 1) != communication_op_node_size - 1) {
MS_LOG(EXCEPTION) << "the last segment index is invalid.";
}
for (size_t i = 0; i < segments - 1; ++i) {
if (segment_index->at(i) > segment_index->at(i + 1)) {
MS_LOG(EXCEPTION) << "illegal split: segment_index[" << i << "]=" << segment_index->at(i) << ", segment_index[ "
<< i + 1 << "]=" << segment_index->at(i + 1);
}
}
return true;
}
} // namespace
bool CommunicationOpFusion::GetSplitSegments(const CommunicationOpInfo &communication_op_info, size_t *segment_num,
......@@ -137,22 +156,8 @@ bool CommunicationOpFusion::GetSplitSegments(const CommunicationOpInfo &communic
segment_index->push_back(communication_op_node_size - 1);
}
if (segments >= communication_op_node_size) {
MS_LOG(INFO) << "fusion not changed: segment_num=" << segments
<< ", communication_op_node_size=" << communication_op_node_size;
return false;
}
if (segment_index->at(segments - 1) != communication_op_node_size - 1) {
MS_LOG(EXCEPTION) << "the last segment index is invalid.";
}
for (size_t i = 0; i < segments - 1; ++i) {
if (segment_index->at(i) > segment_index->at(i + 1)) {
MS_LOG(EXCEPTION) << "illegal split: segment_index[" << i << "]=" << segment_index->at(i) << ", segment_index[ "
<< i + 1 << "]=" << segment_index->at(i + 1);
}
}
*segment_num = segments;
return true;
return CheckSegments(segments, communication_op_node_size, segment_index);
}
AnfNodePtr CommunicationOpFusion::CreateFusedCommunicationOp(const FuncGraphPtr &func_graph,
......
......@@ -28,7 +28,6 @@
namespace mindspore {
namespace opt {
namespace {
AnfNodePtr CreateTensorInput(const AnfNodePtr &node, const KernelGraphPtr &kernel_graph, const AnfNodePtr &input_node) {
MS_EXCEPTION_IF_NULL(input_node);
auto value_node = input_node->cast<ValueNodePtr>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册