From 5070d4b65442a1bb8ef00512eba1779ad0beabd0 Mon Sep 17 00:00:00 2001 From: Saleel Kudchadker Date: Tue, 4 Mar 2025 21:12:12 +0000 Subject: [PATCH] SWDEV-508004 - Improve hipStreamWaitEvent & Fix typo - hipStreamWaitEvent may not resolve streams - Correct usage of flag passed to streamWait function Change-Id: I2ee163615d303b98937c1035d60da283cce6f677 [ROCm/clr commit: 940347ad42a93799976bec21e4b84190b8a3e00d] --- projects/clr/hipamd/src/hip_event.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/clr/hipamd/src/hip_event.cpp b/projects/clr/hipamd/src/hip_event.cpp index 92bf3d32b5..41e4fb0fab 100644 --- a/projects/clr/hipamd/src/hip_event.cpp +++ b/projects/clr/hipamd/src/hip_event.cpp @@ -184,7 +184,9 @@ hipError_t Event::streamWaitCommand(amd::Command*& command, hip::Stream* stream) } // ================================================================================================ hipError_t Event::streamWait(hipStream_t stream, uint flags) { - hip::Stream* hip_stream = hip::getStream(stream); + // Get the stream without any resolution + constexpr bool kWait = false; + hip::Stream* hip_stream = hip::getStream(stream, kWait); // Access to event_ object must be lock protected amd::ScopedLock lock(lock_); if ((event_ == nullptr) || (event_->command().queue() == hip_stream) || ready()) { @@ -241,8 +243,8 @@ hipError_t Event::enqueueRecordCommand(hipStream_t stream, amd::Command* command hipError_t Event::addMarker(hipStream_t stream, amd::Command* command, bool batch_flush) { // Skip wait as we should not be resolving stream in this sub - constexpr bool kSkipWait = true; - hip::Stream* hip_stream = hip::getStream(stream, kSkipWait); + constexpr bool kWait = false; + hip::Stream* hip_stream = hip::getStream(stream, kWait); // Keep the lock always at the beginning of this to avoid a race. SWDEV-277847 amd::ScopedLock lock(lock_); hipError_t status = recordCommand(command, hip_stream, 0, batch_flush);