From 8bc5692749c95ab14e78a1c570bb0814e73bc31c Mon Sep 17 00:00:00 2001 From: limingqi107 Date: Wed, 24 Nov 2021 16:29:00 +0800 Subject: [PATCH] fix the bug of single thread execution stack overflow --- mindspore/ccsrc/runtime/framework/graph_scheduler.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mindspore/ccsrc/runtime/framework/graph_scheduler.cc b/mindspore/ccsrc/runtime/framework/graph_scheduler.cc index 847e059fef7..1df593d57db 100644 --- a/mindspore/ccsrc/runtime/framework/graph_scheduler.cc +++ b/mindspore/ccsrc/runtime/framework/graph_scheduler.cc @@ -392,7 +392,8 @@ void GraphScheduler::SetActorExecutionStrategy(ActorSet *const actor_set, GraphE } if ((actor_set->copy_actors_.size() > 0) || - (actor_set->kernel_actors_.size() > ActorDispatcher::kSingleThreadExecutionActorMaxNum)) { + (actor_set->kernel_actors_.size() > ActorDispatcher::kSingleThreadExecutionActorMaxNum) || + (actor_set->loop_count_actor_->loop_count_ > 1)) { return; } @@ -403,7 +404,6 @@ void GraphScheduler::SetActorExecutionStrategy(ActorSet *const actor_set, GraphE if (actor_set->execution_count_ == ActorDispatcher::kMultiThreadExecutionCountEnd) { actor_set->multi_thread_execution_time_ /= (ActorDispatcher::kMultiThreadExecutionCountEnd - ActorDispatcher::kMultiThreadExecutionCountBegin + 1); - actor_set->multi_thread_execution_time_ /= actor_set->loop_count_actor_->loop_count_; actor_set->is_multi_thread_execution_ = false; } return; @@ -416,7 +416,6 @@ void GraphScheduler::SetActorExecutionStrategy(ActorSet *const actor_set, GraphE if (actor_set->execution_count_ == ActorDispatcher::kSingleThreadExecutionCountEnd) { actor_set->single_thread_execution_time_ /= (ActorDispatcher::kSingleThreadExecutionCountEnd - ActorDispatcher::kSingleThreadExecutionCountBegin + 1); - actor_set->single_thread_execution_time_ /= actor_set->loop_count_actor_->loop_count_; actor_set->is_multi_thread_execution_ = (actor_set->multi_thread_execution_time_ <= actor_set->single_thread_execution_time_) ? true : false; MS_LOG(INFO) << "Multi thread execution time cost: " << actor_set->multi_thread_execution_time_