Browse Source

!2265 fix rts code checking issue

Merge pull request !2265 from dengwentao/code_check
tags/v0.5.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
d0fcc568e5
4 changed files with 20 additions and 2 deletions
  1. +3
    -0
      mindspore/ccsrc/kernel/rts/recv.cc
  2. +3
    -0
      mindspore/ccsrc/kernel/rts/send.cc
  3. +3
    -0
      mindspore/ccsrc/kernel/rts/stream_active.cc
  4. +11
    -2
      mindspore/ccsrc/kernel/rts/stream_switch.cc

+ 3
- 0
mindspore/ccsrc/kernel/rts/recv.cc View File

@@ -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;


+ 3
- 0
mindspore/ccsrc/kernel/rts/send.cc View File

@@ -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;


+ 3
- 0
mindspore/ccsrc/kernel/rts/stream_active.cc View File

@@ -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;
}


+ 11
- 2
mindspore/ccsrc/kernel/rts/stream_switch.cc View File

@@ -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]);


Loading…
Cancel
Save