diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index b52e84aa21..48ccea15b4 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -258,7 +258,6 @@ void Command::enqueue() { ClPrint(LOG_DEBUG, LOG_CMD, "command is enqueued: %p", this); queue_->append(*this); - queue_->flush(); if ((queue_->device().settings().waitCommand_ && (type_ != 0)) || ((commandWaitBits_ & 0x2) != 0)) { awaitCompletion(); diff --git a/rocclr/platform/commandqueue.cpp b/rocclr/platform/commandqueue.cpp index 7ca3ba7878..c4853695ba 100644 --- a/rocclr/platform/commandqueue.cpp +++ b/rocclr/platform/commandqueue.cpp @@ -50,14 +50,10 @@ bool HostQueue::terminate() { Command* marker = nullptr; // Send a finish if the queue is still accepting commands. - { - ScopedLock sl(queueLock_); - if (thread_.acceptingCommands_) { - marker = new Marker(*this, false); - if (marker != nullptr) { - append(*marker); - queueLock_.notify(); - } + if (thread_.acceptingCommands_) { + marker = new Marker(*this, false); + if (marker != nullptr) { + append(*marker); } } if (marker != nullptr) { @@ -186,8 +182,10 @@ void HostQueue::append(Command& command) { command.retain(); command.setStatus(CL_QUEUED); ScopedLock l(lastCmdLock_); + ScopedLock l2(queueLock_); queue_.enqueue(&command); if (!IS_HIP) { + queueLock_.notify(); return; } // Set last submitted command @@ -196,6 +194,7 @@ void HostQueue::append(Command& command) { } lastEnqueueCommand_ = &command; lastEnqueueCommand_->retain(); + queueLock_.notify(); } bool HostQueue::isEmpty() {