From 7dadaa1ccb42810787afd8d6684c8c529751fc6a 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 [ROCm/clr commit: a81756bba3e34befce81f7d329dfb5a6522146ef] --- projects/clr/rocclr/platform/commandqueue.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/clr/rocclr/platform/commandqueue.cpp b/projects/clr/rocclr/platform/commandqueue.cpp index c5fdad469f..358e79df73 100644 --- a/projects/clr/rocclr/platform/commandqueue.cpp +++ b/projects/clr/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_)) {