From 14760c6eba79343a58b5a0debf561fefaf850f3e Mon Sep 17 00:00:00 2001 From: "Stojiljkovic, Vladana" Date: Wed, 13 Aug 2025 15:15:31 +0200 Subject: [PATCH] SWDEV-533220 - Release marker when HostQueue is destroyed (#460) Co-authored-by: Anusha GodavarthySurya --- rocclr/platform/commandqueue.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rocclr/platform/commandqueue.cpp b/rocclr/platform/commandqueue.cpp index 6e8d5a96ad..5fa3372213 100644 --- a/rocclr/platform/commandqueue.cpp +++ b/rocclr/platform/commandqueue.cpp @@ -72,20 +72,21 @@ bool HostQueue::terminate() { if (lastCommand != nullptr) { // Check if CPU batch wasn't flushed for completion with the last command if (GetSubmissionBatch() != nullptr) { - auto command = new Marker(*this, false); - if (command != nullptr) { - ClPrint(LOG_DEBUG, LOG_CMD, "Marker queued to ensure finish"); - command->enqueue(); - lastCommand = command; - } + auto command = new Marker(*this, false); + if (command != nullptr) { + ClPrint(LOG_DEBUG, LOG_CMD, "Marker queued to ensure finish"); + command->enqueue(); + lastCommand->release(); + lastCommand = command; + } } if (device_.gpu_error_ == CL_SUCCESS) { - lastCommand->awaitCompletion(); + lastCommand->awaitCompletion(); } // Note that if lastCommand isn't a marker, it may not be lastEnqueueCommand_ now // after lastCommand->awaitCompletion() is called. if (lastEnqueueCommand_ != nullptr) { - lastEnqueueCommand_ ->release(); // lastEnqueueCommand_ should be a marker + lastEnqueueCommand_->release(); // lastEnqueueCommand_ should be a marker lastEnqueueCommand_ = nullptr; } lastCommand->release();