fixed bugs

This commit is contained in:
wangchangheng 2023-01-04 17:48:53 +08:00
parent 500a0d9c23
commit a913ef1b73
2 changed files with 3 additions and 9 deletions

View File

@ -780,6 +780,7 @@ void GradExecutor::CheckNeedCompileGraph(const InputArgsInfoPtr &input_args_info
{
py::gil_scoped_acquire acquire;
EraseTopCellFromTopCellList(pre_top_cell);
pre_top_cell->ClearDeviceMemory();
}
already_run_top_cell_[already_top_cell_id] = new_top_cell;
new_top_cell->set_force_top_cell_compile(false);

View File

@ -40,17 +40,10 @@ void AsyncQueue::WorkerLoop() {
while (true) {
std::shared_ptr<AsyncTask> task;
bool task_empty = false;
{
std::unique_lock<std::mutex> lock(task_mutex_);
task_empty = tasks_.empty();
if (!task_empty) {
task = tasks_.front();
}
}
if (task_empty) {
std::this_thread::yield();
continue;
task_cond_var_.wait(lock, [this]() { return !tasks_.empty(); });
task = tasks_.front();
}
MS_LOG(DEBUG) << "Get task";