From 1d4bb503ae65a82c7df502013b377451988b6614 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 --- vdi/hip_event.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vdi/hip_event.cpp b/vdi/hip_event.cpp index 1fb463030a..e3d556a52d 100644 --- a/vdi/hip_event.cpp +++ b/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);