提交 d0fcc568 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!2265 fix rts code checking issue

Merge pull request !2265 from dengwentao/code_check
......@@ -37,6 +37,9 @@ bool RecvKernel::Init(const AnfNodePtr &anf_node) {
MS_EXCEPTION_IF_NULL(anf_node);
auto primitive = AnfAlgo::GetCNodePrimitive(anf_node);
MS_EXCEPTION_IF_NULL(primitive);
if (!AnfAlgo::HasNodeAttr(kAttrEventId, anf_node->cast<CNodePtr>())) {
MS_LOG(EXCEPTION) << "RecvKernel has no attr kAttrEventId";
}
event_id_ = GetValue<uint32_t>(primitive->GetAttr(kAttrEventId));
MS_LOG(INFO) << "recv op event_id_:" << event_id_;
return true;
......
......@@ -34,6 +34,9 @@ bool SendKernel::Init(const AnfNodePtr &anf_node) {
MS_EXCEPTION_IF_NULL(anf_node);
auto primitive = AnfAlgo::GetCNodePrimitive(anf_node);
MS_EXCEPTION_IF_NULL(primitive);
if (!AnfAlgo::HasNodeAttr(kAttrEventId, anf_node->cast<CNodePtr>())) {
MS_LOG(EXCEPTION) << "SendKernel has no attr kAttrEventId";
}
event_id_ = GetValue<uint32_t>(primitive->GetAttr(kAttrEventId));
MS_LOG(INFO) << "send op event id:" << event_id_;
return true;
......
......@@ -36,6 +36,9 @@ bool StreamActiveKernel::Init(const AnfNodePtr &anf_node) {
MS_LOG(INFO) << "stream active op init start";
auto primitive = AnfAlgo::GetCNodePrimitive(anf_node);
MS_EXCEPTION_IF_NULL(primitive);
if (!AnfAlgo::HasNodeAttr(kAttrActiveStreamList, anf_node->cast<CNodePtr>())) {
MS_LOG(EXCEPTION) << "StreamActiveKernel has no attr kAttrActiveStreamList";
}
active_streams_index_ = GetValue<std::vector<uint32_t>>(primitive->GetAttr(kAttrActiveStreamList));
return true;
}
......
......@@ -42,8 +42,17 @@ bool StreamSwitchKernel::Init(const AnfNodePtr &anf_node) {
MS_LOG(INFO) << "stream switch op init start";
auto primitive = AnfAlgo::GetCNodePrimitive(anf_node);
MS_EXCEPTION_IF_NULL(primitive);
if (!AnfAlgo::HasNodeAttr(kAttrSwitchCondition, anf_node->cast<CNodePtr>())) {
MS_LOG(EXCEPTION) << "StreamSwitchKernel has no attr kAttrSwitchCondition";
}
cond_ = tagRtCondition(GetValue<int>(primitive->GetAttr(kAttrSwitchCondition)));
if (!AnfAlgo::HasNodeAttr(kAttrTrueBranchStream, anf_node->cast<CNodePtr>())) {
MS_LOG(EXCEPTION) << "StreamSwitchKernel has no attr kAttrTrueBranchStream";
}
true_stream_index_ = GetValue<uint32_t>(primitive->GetAttr(kAttrTrueBranchStream));
if (!AnfAlgo::HasNodeAttr(kAttrDataType, anf_node->cast<CNodePtr>())) {
MS_LOG(EXCEPTION) << "StreamSwitchKernel has no attr kAttrDataType";
}
data_type_ = tagRtSwitchDataType(GetValue<int>(primitive->GetAttr(kAttrDataType)));
MS_LOG(INFO) << "cond_:" << static_cast<int>(cond_) << ", true_stream_index_:" << true_stream_index_
<< ", data_type_:" << static_cast<int>(data_type_);
......@@ -54,7 +63,7 @@ bool StreamSwitchKernel::Launch(const std::vector<AddressPtr> &inputs, const std
const std::vector<AddressPtr> &outputs, void *stream_ptr) {
MS_LOG(INFO) << "stream switch op launch start";
if (inputs.size() != 2) {
MS_LOG(ERROR) << "Stream switch inputs size is " << inputs.size() << ", only support 2";
MS_LOG(EXCEPTION) << "Stream switch inputs size is " << inputs.size() << ", only support 2";
}
void *loop_cnt = inputs[0]->addr;
......@@ -73,7 +82,7 @@ std::vector<TaskInfoPtr> StreamSwitchKernel::GenTask(const std::vector<AddressPt
uint32_t stream_id) {
MS_LOG(INFO) << "StreamSwitchKernel GenTask start";
if (inputs.size() != 2) {
MS_LOG(ERROR) << "stream switch inputs size is " << inputs.size() << ", is not two";
MS_LOG(EXCEPTION) << "stream switch inputs size is " << inputs.size() << ", is not two";
}
stream_id_ = stream_id;
MS_EXCEPTION_IF_NULL(inputs[0]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册