From a2ffb2ad4029753cd12b91ebba8506d16b0e1a2f Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Fri, 19 Apr 2024 16:12:16 -0400 Subject: [PATCH] SWDEV-440746 - Release last command on terminate Change-Id: Ib6a9b8fc9a8692eb17b39b854cefd92c6b59733f [ROCm/clr commit: 0ccdb3e16083e0fba6d18aed8804ef48dde7d565] --- projects/clr/rocclr/platform/commandqueue.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/clr/rocclr/platform/commandqueue.cpp b/projects/clr/rocclr/platform/commandqueue.cpp index 9375b4324f..6dde23d923 100644 --- a/projects/clr/rocclr/platform/commandqueue.cpp +++ b/projects/clr/rocclr/platform/commandqueue.cpp @@ -59,11 +59,11 @@ HostQueue::HostQueue(Context& context, Device& device, cl_command_queue_properti bool HostQueue::terminate() { if (AMD_DIRECT_DISPATCH) { if (vdev() != nullptr) { - Command* marker = new Marker(*this, true); - if (marker != nullptr) { - marker->enqueue(); - marker->awaitCompletion(); - marker->release(); + // If the queue still has the last command, then wait and release it + if (lastEnqueueCommand_ != nullptr) { + lastEnqueueCommand_->awaitCompletion(); + lastEnqueueCommand_->release(); + lastEnqueueCommand_ = nullptr; } } thread_.Release();