Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 4209792

Browse files
committed
SWDEV-301667 - Optimize lock for graph global capture mode
Remove unneeded lock and add smaller scope Change-Id: I03a437057d54ce2d72c07a080bb872693b7f3f6c
1 parent 0e37910 commit 4209792

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/hip_internal.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ static amd::Monitor g_hipInitlock{"hipInit lock"};
166166
if (hip::tls.capture_streams_.size() != 0) { \
167167
HIP_RETURN(hipErrorStreamCaptureUnsupported); \
168168
} \
169-
amd::ScopedLock lock(g_captureStreamsLock); \
170169
if (g_captureStreams.size() != 0) { \
171170
HIP_RETURN(hipErrorStreamCaptureUnsupported); \
172171
} \

src/hip_stream.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,12 @@ hipError_t hipStreamDestroy(hipStream_t stream) {
470470
}
471471
s->GetDevice()->RemoveStreamFromPools(s);
472472

473-
amd::ScopedLock lock(g_captureStreamsLock);
474-
const auto& g_it = std::find(g_captureStreams.begin(), g_captureStreams.end(), s);
475-
if (g_it != g_captureStreams.end()) {
476-
g_captureStreams.erase(g_it);
473+
{
474+
amd::ScopedLock lock(g_captureStreamsLock);
475+
const auto& g_it = std::find(g_captureStreams.begin(), g_captureStreams.end(), s);
476+
if (g_it != g_captureStreams.end()) {
477+
g_captureStreams.erase(g_it);
478+
}
477479
}
478480
const auto& l_it = std::find(hip::tls.capture_streams_.begin(),
479481
hip::tls.capture_streams_.end(), s);

0 commit comments

Comments
 (0)