diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index 0101553fd7..5fb4f642e6 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -236,33 +236,33 @@ GpuAgent::GpuAgent(HSAuint32 node, const HsaNodeProperties& node_props, bool xna } GpuAgent::~GpuAgent() { - if (!(this)->Enabled()) return; - - for (auto& blit : blits_) { - if (!blit.empty()) { - hsa_status_t status = blit->Destroy(*this); - assert(status == HSA_STATUS_SUCCESS); + if (this->Enabled()) { + for (auto& blit : blits_) { + if (!blit.empty()) { + hsa_status_t status = blit->Destroy(*this); + assert(status == HSA_STATUS_SUCCESS); + } } - } - if (ape1_base_ != 0) { - _aligned_free(reinterpret_cast(ape1_base_)); - } + if (ape1_base_ != 0) { + _aligned_free(reinterpret_cast(ape1_base_)); + } - scratch_cache_.trim(true); - scratch_cache_.free_reserve(); + scratch_cache_.trim(true); + scratch_cache_.free_reserve(); - if (scratch_pool_.base() != NULL) { - hsaKmtFreeMemory(scratch_pool_.base(), scratch_pool_.size()); - } + if (scratch_pool_.base() != NULL) { + hsaKmtFreeMemory(scratch_pool_.base(), scratch_pool_.size()); + } - for (int i = 0; i < QueueCount; i++) - queues_[i].reset(); + for (int i = 0; i < QueueCount; i++) + queues_[i].reset(); - system_deallocator()(doorbell_queue_map_); + system_deallocator()(doorbell_queue_map_); - if (trap_code_buf_ != NULL) { - ReleaseShader(trap_code_buf_, trap_code_buf_size_); + if (trap_code_buf_ != NULL) { + ReleaseShader(trap_code_buf_, trap_code_buf_size_); + } } std::for_each(regions_.begin(), regions_.end(), DeleteObject());