From 1c24072d132946f77d33e5cb7a3bd9bd816121fa Mon Sep 17 00:00:00 2001 From: Saleel Kudchadker Date: Mon, 24 Aug 2020 17:59:46 -0700 Subject: [PATCH] Revert "SWDEV-241977 [ROCm QA] Random Soft hang observed while running TF and Caffe2 benchmarks" This reverts commit ce038f316385748bce7abd593f16f0603cd783e2. Change-Id: Ib56493c92eca793f1dfb6f1cbefb32f0b4f65e89 --- rocclr/platform/command.cpp | 1 + rocclr/platform/commandqueue.cpp | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index 1cba93affa..a16e52d12b 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -258,6 +258,7 @@ 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 c4853695ba..7ca3ba7878 100644 --- a/rocclr/platform/commandqueue.cpp +++ b/rocclr/platform/commandqueue.cpp @@ -50,10 +50,14 @@ bool HostQueue::terminate() { Command* marker = nullptr; // Send a finish if the queue is still accepting commands. - if (thread_.acceptingCommands_) { - marker = new Marker(*this, false); - if (marker != nullptr) { - append(*marker); + { + ScopedLock sl(queueLock_); + if (thread_.acceptingCommands_) { + marker = new Marker(*this, false); + if (marker != nullptr) { + append(*marker); + queueLock_.notify(); + } } } if (marker != nullptr) { @@ -182,10 +186,8 @@ 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 @@ -194,7 +196,6 @@ void HostQueue::append(Command& command) { } lastEnqueueCommand_ = &command; lastEnqueueCommand_->retain(); - queueLock_.notify(); } bool HostQueue::isEmpty() {