From 31df9b358de2a8ff30277e1fc7c5c6b182203a60 Mon Sep 17 00:00:00 2001 From: Christophe Paquot Date: Thu, 19 Mar 2020 11:11:59 -0700 Subject: [PATCH] hipStreamAddCallback test seg faults Change-Id: I1f107fc8a5c586cd571f0280ed8716c5f89d25b7 SWDEV-227875: Need to add a dummy marker in case the stream is empty. --- hipamd/vdi/hip_stream.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hipamd/vdi/hip_stream.cpp b/hipamd/vdi/hip_stream.cpp index 53311ae4ff..b66b525699 100644 --- a/hipamd/vdi/hip_stream.cpp +++ b/hipamd/vdi/hip_stream.cpp @@ -251,6 +251,11 @@ hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback amd::HostQueue* hostQueue = reinterpret_cast (stream)->asHostQueue(); amd::Command* command = hostQueue->getLastQueuedCommand(true); + if (command == nullptr) { + amd::Command::EventWaitList eventWaitList; + command = new amd::Marker(*hostQueue, false, eventWaitList); + command->enqueue(); + } amd::Event& event = command->event(); StreamCallback* cbo = new StreamCallback(stream, callback, userData, command);