SWDEV-372757 - Don't destroy null queue in MT

Skip destruction of the null queue for MT. Windows can destroy worker
thread on exit during the stream destruction, causing a race condition.

Change-Id: I3e4bc3ab2b477d38c0aec1fc59e6f1af0f8f6b0f
此提交包含在:
German
2023-01-06 15:18:26 -05:00
提交者 Maneesh Gupta
父節點 695533d435
當前提交 f39655c0c8
共有 2 個檔案被更改,包括 7 行新增3 行删除
+1 -1
查看文件
@@ -406,7 +406,7 @@ namespace hip {
Device(amd::Context* ctx, int devId): context_(ctx),
deviceId_(devId),
null_stream_(this, Stream::Priority::Normal, 0, true),
flags_(hipDeviceScheduleSpin),
flags_(hipDeviceScheduleSpin),
isActive_(false),
default_mem_pool_(nullptr),
current_mem_pool_(nullptr)
+6 -2
查看文件
@@ -48,8 +48,12 @@ Stream::~Stream() {
amd::ScopedLock lock(streamSetLock);
streamSet.erase(this);
queue_->release();
queue_ = nullptr;
// Skip queue destruction for null stream in MT. Queue worker thread can be destroyed on
// the app exit, during the stream destruction, causing a race condition.
if (!null_ || AMD_DIRECT_DISPATCH) {
queue_->release();
queue_ = nullptr;
}
}
}