From 06ab4fdf36a21e78ddcb4cc7b71fdbc21df347ad Mon Sep 17 00:00:00 2001 From: Christophe Paquot Date: Thu, 13 Feb 2020 10:31:57 -0800 Subject: [PATCH] SWDEV-222949 - hipEventRecord hipEventRecord should always create a new marker so it can track work going on at the time the API is called. Change-Id: I10ce98044be894fbacab8798441ec3d3f2753b93 [ROCm/clr commit: eb132ccef862e4f6ba897e5641b95c373325d72d] --- projects/clr/hipamd/vdi/hip_event.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/vdi/hip_event.cpp b/projects/clr/hipamd/vdi/hip_event.cpp index 1fb463030a..e3d556a52d 100644 --- a/projects/clr/hipamd/vdi/hip_event.cpp +++ b/projects/clr/hipamd/vdi/hip_event.cpp @@ -133,6 +133,8 @@ void Event::addMarker(amd::HostQueue* queue, amd::Command* command) { stream_ = queue; + if (event_ == &command->event()) return; + if (event_ != nullptr) { event_->release(); } @@ -229,9 +231,11 @@ hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream) { hip::Event* e = reinterpret_cast(event); + hip::Stream* s = reinterpret_cast(stream); amd::HostQueue* queue = hip::getQueue(stream); - amd::Command* command = queue->getLastQueuedCommand(true); + amd::Command* command = (s != nullptr && (s->flags & hipStreamNonBlocking)) ? + queue->getLastQueuedCommand(true) : nullptr; if (command == nullptr) { command = new amd::Marker(*queue, false);