SWDEV-301667 - Optimize lock for graph global capture mode

Remove unneeded lock and add smaller scope

Change-Id: I03a437057d54ce2d72c07a080bb872693b7f3f6c
This commit is contained in:
Christophe Paquot
2023-03-16 08:29:19 -07:00
committato da Maneesh Gupta
parent 0442501849
commit 6e86d29a58
2 ha cambiato i file con 6 aggiunte e 5 eliminazioni
-1
Vedi File
@@ -166,7 +166,6 @@ static amd::Monitor g_hipInitlock{"hipInit lock"};
if (hip::tls.capture_streams_.size() != 0) { \
HIP_RETURN(hipErrorStreamCaptureUnsupported); \
} \
amd::ScopedLock lock(g_captureStreamsLock); \
if (g_captureStreams.size() != 0) { \
HIP_RETURN(hipErrorStreamCaptureUnsupported); \
} \
+6 -4
Vedi File
@@ -470,10 +470,12 @@ hipError_t hipStreamDestroy(hipStream_t stream) {
}
s->GetDevice()->RemoveStreamFromPools(s);
amd::ScopedLock lock(g_captureStreamsLock);
const auto& g_it = std::find(g_captureStreams.begin(), g_captureStreams.end(), s);
if (g_it != g_captureStreams.end()) {
g_captureStreams.erase(g_it);
{
amd::ScopedLock lock(g_captureStreamsLock);
const auto& g_it = std::find(g_captureStreams.begin(), g_captureStreams.end(), s);
if (g_it != g_captureStreams.end()) {
g_captureStreams.erase(g_it);
}
}
const auto& l_it = std::find(hip::tls.capture_streams_.begin(),
hip::tls.capture_streams_.end(), s);