From 59aa56a340ac279b70f5c4b3df14759833776d44 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras <38722728+iassiour@users.noreply.github.com> Date: Tue, 20 Jan 2026 18:42:27 +0000 Subject: [PATCH] hip-issue-3876 : Take into account thread-local capture mode in checks for valid capture (#2177) --- projects/clr/hipamd/src/hip_stream.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/projects/clr/hipamd/src/hip_stream.cpp b/projects/clr/hipamd/src/hip_stream.cpp index b9b84033b6..cdd446239d 100644 --- a/projects/clr/hipamd/src/hip_stream.cpp +++ b/projects/clr/hipamd/src/hip_stream.cpp @@ -153,12 +153,14 @@ bool Stream::StreamCaptureOngoing(hipStream_t hStream) { return false; } // If any stream in current/concurrent thread is capturing in global mode - amd::ScopedLock lock(g_captureStreamsLock); - if (!g_captureStreams.empty()) { - for (auto stream : hip::g_captureStreams) { - stream->SetCaptureStatus(hipStreamCaptureStatusInvalidated); + if (hip::tls.stream_capture_mode_ == hipStreamCaptureModeGlobal) { + amd::ScopedLock lock(g_captureStreamsLock); + if (!g_captureStreams.empty()) { + for (auto stream : hip::g_captureStreams) { + stream->SetCaptureStatus(hipStreamCaptureStatusInvalidated); + } + return true; } - return true; } // If any stream in current thread is capturing in ThreadLocal mode if (!hip::tls.capture_streams_.empty()) {