!21652 fix bugs: DestroyHccl must be called before FreeDeviceMemory

Merge pull request !21652 from jjfeing/r1.4
This commit is contained in:
i-robot 2021-08-11 11:59:51 +00:00 committed by Gitee
commit 6efa88c486
1 changed files with 2 additions and 1 deletions

View File

@ -249,6 +249,8 @@ void AscendKernelRuntime::ReleaseDeviceRes() {
MS_EXCEPTION_IF_NULL(context_ptr); MS_EXCEPTION_IF_NULL(context_ptr);
uint32_t device_id = context_ptr->get_param<uint32_t>(MS_CTX_DEVICE_ID); uint32_t device_id = context_ptr->get_param<uint32_t>(MS_CTX_DEVICE_ID);
// DestroyHccl must be called before FreeDeviceMemory
(void)DestroyHccl();
if (mem_manager_ != nullptr) { if (mem_manager_ != nullptr) {
mem_manager_->FreeDeviceMemory(); mem_manager_->FreeDeviceMemory();
} }
@ -258,7 +260,6 @@ void AscendKernelRuntime::ReleaseDeviceRes() {
MS_LOG(EXCEPTION) << "Reg SetTaskFailCallback failed, error: " << rt_ret; MS_LOG(EXCEPTION) << "Reg SetTaskFailCallback failed, error: " << rt_ret;
} }
(void)DestroyHccl();
(void)ResetDevice(device_id); (void)ResetDevice(device_id);
(void)ProfilingManager::GetInstance().StopProfiling(); (void)ProfilingManager::GetInstance().StopProfiling();
current_graph_ = nullptr; current_graph_ = nullptr;