diff --git a/projects/clr/hipamd/src/hip_event.cpp b/projects/clr/hipamd/src/hip_event.cpp index 28574c2753..405da38913 100644 --- a/projects/clr/hipamd/src/hip_event.cpp +++ b/projects/clr/hipamd/src/hip_event.cpp @@ -237,7 +237,9 @@ hipError_t Event::recordCommand(amd::Command*& command, amd::HostQueue* stream, // ================================================================================================ hipError_t Event::enqueueRecordCommand(hipStream_t stream, amd::Command* command, bool record) { command->enqueue(); - if (event_ == &command->event()) return hipSuccess; + if (event_ == &command->event()) { + return hipSuccess; + } if (event_ != nullptr) { event_->release(); } @@ -250,7 +252,9 @@ hipError_t Event::enqueueRecordCommand(hipStream_t stream, amd::Command* command // ================================================================================================ hipError_t Event::addMarker(hipStream_t stream, amd::Command* command, bool record, bool batch_flush) { - hip::Stream* hip_stream = hip::getStream(stream); + // Skip wait as we should not be resolving stream in this sub + constexpr bool kSkipWait = true; + hip::Stream* hip_stream = hip::getStream(stream, kSkipWait); // 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); diff --git a/projects/clr/hipamd/src/hip_event.hpp b/projects/clr/hipamd/src/hip_event.hpp index 2b75ab869e..66025eff7c 100644 --- a/projects/clr/hipamd/src/hip_event.hpp +++ b/projects/clr/hipamd/src/hip_event.hpp @@ -106,7 +106,6 @@ class Event { Event(uint32_t flags) : flags_(flags), lock_(true) /* hipEvent_t lock*/, event_(nullptr), unrecorded_(false), stream_(nullptr) { - // No need to init event_ here as addMarker does that device_id_ = hip::getCurrentDevice()->deviceId(); // Created in current device ctx } diff --git a/projects/clr/hipamd/src/hip_mempool_impl.cpp b/projects/clr/hipamd/src/hip_mempool_impl.cpp index a1c0ef9b54..bb2b839ffc 100644 --- a/projects/clr/hipamd/src/hip_mempool_impl.cpp +++ b/projects/clr/hipamd/src/hip_mempool_impl.cpp @@ -97,7 +97,7 @@ Heap::SortedMap::iterator Heap::EraseAllocaton(Heap::SortedMap::iterator& it) { const device::Memory* dev_mem = memory->getDeviceMemory(*device_->devices()[0]); void* dev_mem_vaddr = reinterpret_cast(dev_mem->virtualAddress()); total_size_ -= it->first.first; - + if (dev_mem_vaddr != nullptr) { amd::SvmBuffer::free(memory->getContext(), dev_mem_vaddr); } else {