From 439af94dd961bc0fa18cf956ac62f46c14bee74c Mon Sep 17 00:00:00 2001 From: haoyuan2 Date: Wed, 1 Dec 2021 09:17:04 -0800 Subject: [PATCH] SWDEV-290298 - add a flag to indicate the primary context active status Change-Id: Ia31790706d3f855bc1eedf5ef874e471 --- rocclr/platform/command.cpp | 3 +++ rocclr/platform/commandqueue.cpp | 3 ++- rocclr/platform/commandqueue.hpp | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index f3e7793ef2..4ce6fa776e 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -377,6 +377,9 @@ void Command::enqueue() { ((commandWaitBits_ & 0x2) != 0)) { awaitCompletion(); } + + // set this queue status is active + queue_->SetQueueStatus(); } // ================================================================================================ diff --git a/rocclr/platform/commandqueue.cpp b/rocclr/platform/commandqueue.cpp index 0e904aab89..c98ec4d509 100644 --- a/rocclr/platform/commandqueue.cpp +++ b/rocclr/platform/commandqueue.cpp @@ -39,7 +39,8 @@ HostQueue::HostQueue(Context& context, Device& device, cl_command_queue_properti priority, cuMask), lastEnqueueCommand_(nullptr), head_(nullptr), - tail_(nullptr) { + tail_(nullptr), + isActive_(false) { if (AMD_DIRECT_DISPATCH) { // Initialize the queue thread_.Init(this); diff --git a/rocclr/platform/commandqueue.hpp b/rocclr/platform/commandqueue.hpp index e61a45b945..999b569cd6 100644 --- a/rocclr/platform/commandqueue.hpp +++ b/rocclr/platform/commandqueue.hpp @@ -278,9 +278,18 @@ class HostQueue : public CommandQueue { //! Reset the command batch list void ResetSubmissionBatch() { head_ = nullptr; } + //! Set queue status + void SetQueueStatus() { isActive_ = true; } + + //! Get queue status + bool GetQueueStatus() { return isActive_; } + private: Command* head_; //!< Head of the batch list Command* tail_; //!< Tail of the batch list + + //! True if this command queue is active + bool isActive_; };