From 4e19807783dc43b32edb129147b69eb984bb5b03 Mon Sep 17 00:00:00 2001 From: Lukasz Jobczyk Date: Wed, 15 Feb 2023 11:36:05 +0000 Subject: [PATCH] Add ClientNotRegistered constexpr definition Related-To: NEO-7422, NEO-7458 Signed-off-by: Lukasz Jobczyk --- level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl | 2 +- level_zero/core/source/cmdqueue/cmdqueue.cpp | 2 +- level_zero/core/source/cmdqueue/cmdqueue.h | 4 +++- level_zero/core/source/cmdqueue/cmdqueue_hw.inl | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl b/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl index eef9647073..1e0386fc70 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_immediate.inl @@ -203,7 +203,7 @@ inline ze_result_t CommandListCoreFamilyImmediate::executeCommand auto csr = static_cast(cmdQ)->getCsr(); auto lockCSR = csr->obtainUniqueOwnership(); - if (cmdQ->getClientId() == std::numeric_limits::max()) { + if (cmdQ->getClientId() == CommandQueue::clientNotRegistered) { cmdQ->setClientId(csr->registerClient()); } diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index 2813121089..1899314a4a 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -50,7 +50,7 @@ CommandQueueImp::CommandQueueImp(Device *device, NEO::CommandStreamReceiver *csr } ze_result_t CommandQueueImp::destroy() { - if (this->clientId != std::numeric_limits::max()) { + if (this->clientId != CommandQueue::clientNotRegistered) { this->csr->unregisterClient(); } diff --git a/level_zero/core/source/cmdqueue/cmdqueue.h b/level_zero/core/source/cmdqueue/cmdqueue.h index bdc6e6eed4..882cfb5e9c 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.h +++ b/level_zero/core/source/cmdqueue/cmdqueue.h @@ -61,10 +61,12 @@ struct CommandQueue : _ze_command_queue_handle_t { uint32_t getClientId() { return this->clientId; } void setClientId(uint32_t value) { this->clientId = value; } + static constexpr uint32_t clientNotRegistered = std::numeric_limits::max(); + protected: bool frontEndTrackingEnabled() const; - uint32_t clientId = std::numeric_limits::max(); + uint32_t clientId = clientNotRegistered; uint32_t partitionCount = 1; uint32_t activeSubDevices = 1; bool preemptionCmdSyncProgramming = true; diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 2d0a207519..be550c0e2e 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -67,7 +67,7 @@ ze_result_t CommandQueueHw::executeCommandLists( auto lockCSR = this->csr->obtainUniqueOwnership(); - if (this->clientId == std::numeric_limits::max()) { + if (this->clientId == CommandQueue::clientNotRegistered) { this->clientId = this->csr->registerClient(); }