From a81756bba3e34befce81f7d329dfb5a6522146ef Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Wed, 19 May 2021 09:58:39 -0400 Subject: [PATCH] SWDEV-285318 - Wait for the queue before destruction With direct dispatch enabled make sure the queue is done before destruction. Change-Id: Ib80af3efb97dfb93e2dce60a11db34fb5c45f5cd --- rocclr/platform/commandqueue.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rocclr/platform/commandqueue.cpp b/rocclr/platform/commandqueue.cpp index c5fdad469f..358e79df73 100644 --- a/rocclr/platform/commandqueue.cpp +++ b/rocclr/platform/commandqueue.cpp @@ -54,6 +54,13 @@ HostQueue::HostQueue(Context& context, Device& device, cl_command_queue_properti bool HostQueue::terminate() { if (AMD_DIRECT_DISPATCH) { + Command* marker = new Marker(*this, true); + if (marker != nullptr) { + marker->enqueue(); + marker->awaitCompletion(); + marker->release(); + } + thread_.acceptingCommands_ = false; thread_.Release(); } else { if (Os::isThreadAlive(thread_)) {