Browse Source

unified runtime control flow add log

tags/v1.6.0
limingqi107 4 years ago
parent
commit
57824d2879
5 changed files with 28 additions and 10 deletions
  1. +1
    -1
      mindspore/ccsrc/runtime/framework/actor/actor_set.h
  2. +9
    -2
      mindspore/ccsrc/runtime/framework/actor/control_flow/control_actor.cc
  3. +5
    -2
      mindspore/ccsrc/runtime/framework/actor/control_flow/entrance_actor.cc
  4. +9
    -2
      mindspore/ccsrc/runtime/framework/actor/control_flow/stack_actor.cc
  5. +4
    -3
      mindspore/ccsrc/runtime/framework/graph_scheduler.cc

+ 1
- 1
mindspore/ccsrc/runtime/framework/actor/actor_set.h View File

@@ -83,7 +83,7 @@ struct ActorSet {
std::vector<CopyActorPtr> copy_actors_;
LoopCountActorPtr loop_count_actor_{nullptr};
OutputActorPtr output_actor_{nullptr};
ControlActorSetPtr control_actors_;
ControlActorSetPtr control_actors_{nullptr};
ActorInfo name_;
// The related statistics information of multi thread and single thread to decide whether use the multi thread.
bool is_multi_thread_execution_{true};


+ 9
- 2
mindspore/ccsrc/runtime/framework/actor/control_flow/control_actor.cc View File

@@ -60,7 +60,11 @@ void ControlActor::RunOpPartial(OpPartialPtr partial, size_t position, OpContext
MS_EXCEPTION_IF_NULL(context);
auto &sequential_num = context->sequential_num_;
input_op_partials_[sequential_num].emplace_back(position, partial);
if (CheckRunningCondition(context)) {

auto is_run = CheckRunningCondition(context);
MS_LOG(DEBUG) << "Actor(" << GetAID().Name()
<< ") receive the input op partial and check running condition:" << is_run;
if (is_run) {
Run(context);
}
}
@@ -70,7 +74,10 @@ void ControlActor::RunBranchID(int branch_id, OpContext<DeviceTensor> *const con
auto &sequential_num = context->sequential_num_;
input_branch_ids_[sequential_num].push(branch_id);

if (CheckRunningCondition(context)) {
auto is_run = CheckRunningCondition(context);
MS_LOG(DEBUG) << "Actor(" << GetAID().Name()
<< ") receive the input branch id and check running condition:" << is_run;
if (is_run) {
Run(context);
}
}


+ 5
- 2
mindspore/ccsrc/runtime/framework/actor/control_flow/entrance_actor.cc View File

@@ -56,6 +56,8 @@ void EntranceActor::RunOpRealParameterWithBranchID(OpRealParameterWithBranchID r

void EntranceActor::ClearDataOnStepEnd(AID *const input_control, OpContext<DeviceTensor> *const context) {
MS_EXCEPTION_IF_NULL(context);
MS_LOG(DEBUG) << "Actor(" << GetAID().Name() << ") receive the message of clearing data.";

is_loop_body_execution_ = false;

if (loop_body_input_controls_nums_ != 0) {
@@ -64,11 +66,12 @@ void EntranceActor::ClearDataOnStepEnd(AID *const input_control, OpContext<Devic
}

void EntranceActor::Run(OpContext<DeviceTensor> *const context) {
// The begin execution of step is false and the others execution of step is true.
is_loop_body_execution_ = true;

FetchInput(context);
EraseInput(context);
SendOutput(context);
// The begin execution of step is false and the others execution of step is true.
is_loop_body_execution_ = true;
}

void EntranceActor::FetchInput(OpContext<DeviceTensor> *const context) {


+ 9
- 2
mindspore/ccsrc/runtime/framework/actor/control_flow/stack_actor.cc View File

@@ -82,7 +82,10 @@ void StackActor::RunOpData(OpData<DeviceTensor> *const input_data, OpContext<Dev
// The outputs of call nodes are placed directly in the input data.
input_op_datas_[context->sequential_num_].emplace_back(input_data);
}
if (CheckRunningCondition(context)) {

auto is_run = CheckRunningCondition(context);
MS_LOG(DEBUG) << "Actor(" << GetAID().Name() << ") receive the input op data and check running condition:" << is_run;
if (is_run) {
Run(context);
}
}
@@ -96,7 +99,11 @@ void StackActor::RunOpPartial(OpPartialPtr partial, size_t position, OpContext<D
} else {
input_op_partials_[context->sequential_num_].emplace_back(position, partial);
}
if (CheckRunningCondition(context)) {

auto is_run = CheckRunningCondition(context);
MS_LOG(DEBUG) << "Actor(" << GetAID().Name()
<< ") receive the input op partial and check running condition:" << is_run;
if (is_run) {
Run(context);
}
}


+ 4
- 3
mindspore/ccsrc/runtime/framework/graph_scheduler.cc View File

@@ -428,9 +428,10 @@ void GraphScheduler::SetActorExecutionStrategy(ActorSet *const actor_set, GraphE
return;
}

if ((actor_set->copy_actors_.size() > 0) || (actor_set->super_kernel_actors_.size() > 0) ||
(actor_set->kernel_actors_.size() > ActorDispatcher::kSingleThreadExecutionActorMaxNum) ||
(actor_set->loop_count_actor_->loop_count() > 1)) {
// The constraint condition of not supporting the single thread execution.
if ((actor_set->control_actors_ != nullptr) || (actor_set->copy_actors_.size() > 0) ||
(actor_set->super_kernel_actors_.size() > 0) || (actor_set->loop_count_actor_->loop_count() > 1) ||
(actor_set->kernel_actors_.size() > ActorDispatcher::kSingleThreadExecutionActorMaxNum)) {
return;
}



Loading…
Cancel
Save