SWDEV-382397 - Move VirtualGPU destruction back to the thread exit
OS can terminate unfinished queue thread from default stream at any
time. Potentially leaving the queue lock in a bad state and causing a
deadlock if runtime destroys VirtualGPU later from the host thread.
Change-Id: I247f102ee84e6b4dba947504933395071945c85d
[ROCm/clr commit: 28daf98f1f]
This commit is contained in:
@@ -66,6 +66,7 @@ bool HostQueue::terminate() {
|
||||
marker->awaitCompletion();
|
||||
marker->release();
|
||||
}
|
||||
thread_.Release();
|
||||
thread_.acceptingCommands_ = false;
|
||||
} else {
|
||||
if (Os::isThreadAlive(thread_)) {
|
||||
|
||||
@@ -164,19 +164,13 @@ class HostQueue : public CommandQueue {
|
||||
acceptingCommands_(false),
|
||||
virtualDevice_(nullptr) {}
|
||||
|
||||
virtual ~Thread() {
|
||||
if (virtualDevice_ != nullptr) {
|
||||
delete virtualDevice_;
|
||||
virtualDevice_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//! The command queue thread entry point.
|
||||
void run(void* data) {
|
||||
HostQueue* queue = static_cast<HostQueue*>(data);
|
||||
virtualDevice_ = queue->device().createVirtualDevice(queue);
|
||||
if (virtualDevice_ != nullptr) {
|
||||
queue->loop(virtualDevice_);
|
||||
Release();
|
||||
} else {
|
||||
acceptingCommands_ = false;
|
||||
queue->flush();
|
||||
@@ -190,6 +184,8 @@ class HostQueue : public CommandQueue {
|
||||
}
|
||||
}
|
||||
|
||||
void Release() const { delete virtualDevice_; }
|
||||
|
||||
//! Get virtual device for the current thread
|
||||
device::VirtualDevice* vdev() const { return virtualDevice_; }
|
||||
|
||||
|
||||
مرجع در شماره جدید
Block a user