Skip to content

Commit

Permalink
SWDEV-478921 - Destroy Queue created by Coop Launch
Browse files Browse the repository at this point in the history
Change-Id: I7f31ce05421479ff1de138cae26aafa071e956e2
  • Loading branch information
Rahul Manocha authored and JeniferC99 committed Aug 26, 2024
1 parent 95ed002 commit 7f04509
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion rocclr/device/rocm/rocdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>& cuMask) {
void Device::releaseQueue(hsa_queue_t* queue, const std::vector<uint32_t>& cuMask, bool coop_queue) {
for (auto& it : cuMask.size() == 0 ? queuePool_ : queueWithCUMaskPool_) {
auto qIter = it.find(queue);
if (qIter != it.end()) {
Expand All @@ -3210,6 +3210,12 @@ void Device::releaseQueue(hsa_queue_t* queue, const std::vector<uint32_t>& 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,
Expand Down
2 changes: 1 addition & 1 deletion rocclr/device/rocm/rocdevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>& cuMask = {});
void releaseQueue(hsa_queue_t*, const std::vector<uint32_t>& 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.
Expand Down
2 changes: 1 addition & 1 deletion rocclr/device/rocm/rocvirtual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ VirtualGPU::~VirtualGPU() {
}

if (gpu_queue_) {
roc_device_.releaseQueue(gpu_queue_, cuMask_);
roc_device_.releaseQueue(gpu_queue_, cuMask_, cooperative_);
}
}

Expand Down

0 comments on commit 7f04509

Please sign in to comment.