SWDEV-400448 - SWDEV-392872 - Add lock to NullStream

Fetching null stream's logic has changed earlier from amd::HostQueue
to hip::Stream. This seem to cause some timing difference between
checking for null stream and creating it due to which issues are
observed in multithreaded applications using default stream.

Change-Id: Ie02365dec537275d23a1d225de9811e2fd3a9c55
Этот коммит содержится в:
Satyanvesh Dittakavi
2024-01-31 16:24:25 +00:00
родитель dca7bb22b6
Коммит 8d265838cb
+5 -3
Просмотреть файл
@@ -31,10 +31,12 @@ namespace hip {
// ================================================================================================
hip::Stream* Device::NullStream(bool wait) {
if (null_stream_ == nullptr) {
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
{
amd::ScopedLock lock(lock_);
if (null_stream_ == nullptr) {
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
}
}
if (null_stream_ == nullptr) {
return nullptr;
}