SWDEV-400448 - SWDEV-392872 - Optimize to add lock only if its null stream

Change-Id: Ia905109a295614e8ce4e2bd24261c86ba8138178


[ROCm/clr commit: a6841e3f43]
This commit is contained in:
Satyanvesh Dittakavi
2024-02-06 08:09:21 +00:00
parent 1a5fd1ea86
commit 45f3dc72fd
+5 -5
Vedi File
@@ -31,11 +31,11 @@ namespace hip {
// ================================================================================================
hip::Stream* Device::NullStream(bool wait) {
{
amd::ScopedLock lock(lock_);
if (null_stream_ == nullptr) {
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
}
if (null_stream_ == nullptr) {
amd::ScopedLock lock(lock_);
if (null_stream_ == nullptr) {
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
}
}
if (null_stream_ == nullptr) {
return nullptr;