SWDEV-518831 - fix streams' sync issue in mthreads (#123)

* SWDEV-518831 - fix streams' sync issue in mthreads

1. Fix sync issue of null stream and non-null streams in
multithreads.
2. Remove assert(GetSubmissionBatch() == nullptr) as it
is invalid in multithreads.
3. Update getActiveQueues() to deal with the state of 
being terminated.

[ROCm/clr commit: 27aad09bd4]
这个提交包含在:
Sang, Tao
2025-04-23 15:08:07 -04:00
提交者 GitHub
父节点 45b75013ec
当前提交 60110b6c01
共修改 4 个文件,包含 18 行新增和 4 行删除
+15
查看文件
@@ -1107,6 +1107,21 @@ void Device::IpcDetach(void* dev_ptr) const {
}
}
std::vector<amd::CommandQueue*> Device::getActiveQueues() {
amd::ScopedLock lock(activeQueuesLock_);
for (auto it = activeQueues.begin(); it != activeQueues.end();) {
if ((*it)->referenceCount() == 0) {
// It is being terminated in HostQueue::terminate().
// We should not wait for commands in a queue being terminated.
it = activeQueues.erase(it);
} else {
// In case the queue will be destroyed in Stream::Destroy().
(*it)->retain();
++it;
}
}
return std::vector<amd::CommandQueue*>(activeQueues.begin(), activeQueues.end());
}
} // namespace amd
namespace amd::device {