diff --git a/rocclr/device/rocm/rocdevice.cpp b/rocclr/device/rocm/rocdevice.cpp index 5e3b09fa2..56152895d 100644 --- a/rocclr/device/rocm/rocdevice.cpp +++ b/rocclr/device/rocm/rocdevice.cpp @@ -3199,7 +3199,7 @@ hsa_queue_t* Device::acquireQueue(uint32_t queue_size_hint, bool coop_queue, return queue; } -void Device::releaseQueue(hsa_queue_t* queue, const std::vector& cuMask) { +void Device::releaseQueue(hsa_queue_t* queue, const std::vector& cuMask, bool coop_queue) { for (auto& it : cuMask.size() == 0 ? queuePool_ : queueWithCUMaskPool_) { auto qIter = it.find(queue); if (qIter != it.end()) { @@ -3210,6 +3210,12 @@ void Device::releaseQueue(hsa_queue_t* queue, const std::vector& cuMas qIter->first->base_address, qIter->second.refCount); } } + if(coop_queue) { // cooperative queue + ClPrint(amd::LOG_INFO, amd::LOG_QUEUE, "Deleting CG enabled hardware queue %p ", + queue->base_address); + hsa_queue_destroy(queue); + } + } void* Device::getOrCreateHostcallBuffer(hsa_queue_t* queue, bool coop_queue, diff --git a/rocclr/device/rocm/rocdevice.hpp b/rocclr/device/rocm/rocdevice.hpp index 2ff992b28..276c35cb7 100644 --- a/rocclr/device/rocm/rocdevice.hpp +++ b/rocclr/device/rocm/rocdevice.hpp @@ -556,7 +556,7 @@ class Device : public NullDevice { amd::CommandQueue::Priority priority = amd::CommandQueue::Priority::Normal); //! Release HSA queue - void releaseQueue(hsa_queue_t*, const std::vector& cuMask = {}); + void releaseQueue(hsa_queue_t*, const std::vector& cuMask = {}, bool coop_queue = false); //! For the given HSA queue, return an existing hostcall buffer or create a //! new one. queuePool_ keeps a mapping from HSA queue to hostcall buffer. diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index ee5cacd4b..169e81e65 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -1316,7 +1316,7 @@ VirtualGPU::~VirtualGPU() { } if (gpu_queue_) { - roc_device_.releaseQueue(gpu_queue_, cuMask_); + roc_device_.releaseQueue(gpu_queue_, cuMask_, cooperative_); } }