Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPU] Compute hash inside CommandQueueDesc and not in the graph (#35104)

Bogdan Pereanuaba783cb6e25
diff --git a/src/plugins/intel_npu/src/backend/src/zero_dynamic_pipeline.cpp b/src/plugins/intel_npu/src/backend/src/zero_dynamic_pipeline.cpp
index 618393eda46..ed47c697082 100644
--- a/src/plugins/intel_npu/src/backend/src/zero_dynamic_pipeline.cpp
+++ b/src/plugins/intel_npu/src/backend/src/zero_dynamic_pipeline.cpp
@@ -182,7 +182,7 @@ void DynamicPipeline::push() {
OPENVINO_ASSERT(dynamicGraph != nullptr, "Failed to cast graph to IDynamicGraph");
const auto command_queue_desc = _graph->get_command_queue_desc();
- const bool command_queue_version_changed = (command_queue_desc.key != _command_queue->desc().key);
+ const bool command_queue_version_changed = (command_queue_desc.key() != _command_queue->desc().key());
if (command_queue_version_changed) {
_command_queue = ZeroCmdQueuePool::getInstance().getCommandQueue(_init_structs, command_queue_desc);
diff --git a/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp b/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp
index 4b2e4797945..06114a98ee2 100644
--- a/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp
+++ b/src/plugins/intel_npu/src/backend/src/zero_pipeline.cpp
@@ -286,7 +286,7 @@ void Pipeline::push() {
}
const auto command_queue_desc = _graph->get_command_queue_desc();
- const bool command_queue_version_changed = (command_queue_desc.key != _command_queue->desc().key);
+ const bool command_queue_version_changed = (command_queue_desc.key() != _command_queue->desc().key());
if (command_queue_version_changed) {
_command_queue = ZeroCmdQueuePool::getInstance().getCommandQueue(_init_structs, command_queue_desc);
diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cpp
index 96252fd29da..9bf5c960f02 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/src/dynamic_graph.cpp
@@ -14,6 +14,7 @@
#include "intel_npu/utils/utils.hpp"
#include "intel_npu/utils/zero/zero_api.hpp"
#include "intel_npu/utils/zero/zero_cmd_queue_pool.hpp"
+#include "intel_npu/utils/zero/zero_utils.hpp"
#include "openvino/runtime/make_tensor.hpp"
namespace intel_npu {
@@ -502,14 +503,10 @@ void DynamicGraph::set_workload_type(const ov::WorkloadType workloadType) {
std::lock_guard<std::mutex> lock(_commandQueueDescMutex);
auto zeWorkloadType = zeroUtils::toZeQueueWorkloadType(workloadType);
- if (_commandQueueDesc.workload == zeWorkloadType) {
+ if (_commandQueueDesc.workload() == zeWorkloadType) {
return;
}
- _commandQueueDesc.workload = zeWorkloadType;
-
- const ZeroCmdQueueKey key{_zeroInitStruct->getContext(), _zeroInitStruct->getDevice(), _commandQueueDesc};
- const auto queueKeyHash = ZeroCmdQueueKeyHash{}(key);
- _commandQueueDesc.key = static_cast<uint64_t>(queueKeyHash);
+ _commandQueueDesc.set_workload(zeWorkloadType);
}
void DynamicGraph::set_model_priority(const ov::hint::Priority modelPriority) {
@@ -519,14 +516,10 @@ void DynamicGraph::set_model_priority(const ov::hint::Priority modelPriority) {
std::lock_guard<std::mutex> lock(_commandQueueDescMutex);
auto zeModelPriority = zeroUtils::toZeQueuePriority(modelPriority);
- if (_commandQueueDesc.priority == zeModelPriority) {
+ if (_commandQueueDesc.priority() == zeModelPriority) {
return;
}
- _commandQueueDesc.priority = zeModelPriority;
-
- const ZeroCmdQueueKey key{_zeroInitStruct->getContext(), _zeroInitStruct->getDevice(), _commandQueueDesc};
- const auto queueKeyHash = ZeroCmdQueueKeyHash{}(key);
- _commandQueueDesc.key = static_cast<uint64_t>(queueKeyHash);
+ _commandQueueDesc.set_priority(zeModelPriority);
}
void DynamicGraph::set_argument_value(uint32_t argi, const void* argv) const {
@@ -593,10 +586,6 @@ void DynamicGraph::initialize_impl(const FilteredConfig& config) {
commandQueueOptions,
this,
config.get<SHARED_COMMON_QUEUE>()};
-
- const ZeroCmdQueueKey key{_zeroInitStruct->getContext(), _zeroInitStruct->getDevice(), _commandQueueDesc};
- const auto queueKeyHash = ZeroCmdQueueKeyHash{}(key);
- _commandQueueDesc.key = static_cast<uint64_t>(queueKeyHash);
}
_logger.debug("Graph initialize finish");
diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/graph.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/graph.cpp
index 04503cb76e2..2cf3cf9562b 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/src/graph.cpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/src/graph.cpp
@@ -11,6 +11,7 @@
#include "intel_npu/utils/utils.hpp"
#include "intel_npu/utils/zero/zero_api.hpp"
#include "intel_npu/utils/zero/zero_cmd_queue_pool.hpp"
+#include "intel_npu/utils/zero/zero_utils.hpp"
#include "openvino/runtime/make_tensor.hpp"
namespace intel_npu {
@@ -62,14 +63,10 @@ void Graph::set_workload_type(const ov::WorkloadType workloadType) {
std::lock_guard<std::mutex> lock(_commandQueueDescMutex);
auto zeWorkloadType = zeroUtils::toZeQueueWorkloadType(workloadType);
- if (_commandQueueDesc.workload == zeWorkloadType) {
+ if (_commandQueueDesc.workload() == zeWorkloadType) {
return;
}
- _commandQueueDesc.workload = zeWorkloadType;
-
- const ZeroCmdQueueKey key{_zeroInitStruct->getContext(), _zeroInitStruct->getDevice(), _commandQueueDesc};
- const auto queueKeyHash = ZeroCmdQueueKeyHash{}(key);
- _commandQueueDesc.key = static_cast<uint64_t>(queueKeyHash);
+ _commandQueueDesc.set_workload(zeWorkloadType);
}
void Graph::set_model_priority(const ov::hint::Priority modelPriority) {
@@ -79,14 +76,10 @@ void Graph::set_model_priority(const ov::hint::Priority modelPriority) {
std::lock_guard<std::mutex> lock(_commandQueueDescMutex);
auto zeModelPriority = zeroUtils::toZeQueuePriority(modelPriority);
- if (_commandQueueDesc.priority == zeModelPriority) {
+ if (_commandQueueDesc.priority() == zeModelPriority) {
return;
}
- _commandQueueDesc.priority = zeModelPriority;
-
- const ZeroCmdQueueKey key{_zeroInitStruct->getContext(), _zeroInitStruct->getDevice(), _commandQueueDesc};
- const auto queueKeyHash = ZeroCmdQueueKeyHash{}(key);
- _commandQueueDesc.key = static_cast<uint64_t>(queueKeyHash);
+ _commandQueueDesc.set_priority(zeModelPriority);
}
ze_graph_handle_t Graph::get_handle() const {
@@ -203,10 +196,6 @@ void Graph::initialize_impl(const FilteredConfig& config) {
this,
config.get<SHARED_COMMON_QUEUE>(),
};
-
- const ZeroCmdQueueKey key{_zeroInitStruct->getContext(), _zeroInitStruct->getDevice(), _commandQueueDesc};
- const auto queueKeyHash = ZeroCmdQueueKeyHash{}(key);
- _commandQueueDesc.key = static_cast<uint64_t>(queueKeyHash);
}
_zeGraphExt->initializeGraph(_graphDesc);
diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp
index 1dcb96ffa4e..b02e99ced3d 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp
+++ b/src/plugins/intel_npu/src/compiler_adapter/src/weightless_graph.cpp
@@ -13,6 +13,7 @@
#include "intel_npu/prefix.hpp"
#include "intel_npu/utils/utils.hpp"
#include "intel_npu/utils/zero/zero_cmd_queue_pool.hpp"
+#include "intel_npu/utils/zero/zero_utils.hpp"
#include "openvino/core/memory_util.hpp"
#include "openvino/core/model.hpp"
#include "openvino/core/rt_info/weightless_caching_attributes.hpp"
diff --git a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_cmd_queue_pool.hpp b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_cmd_queue_pool.hpp
index 024e4caffe4..9cc454a5e3a 100644
--- a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_cmd_queue_pool.hpp
+++ b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_cmd_queue_pool.hpp
@@ -7,6 +7,7 @@
#include <ze_api.h>
#include <ze_command_queue_npu_ext.h>
+#include <functional>
#include <memory>
#include <mutex>
#include <unordered_map>
@@ -31,31 +32,10 @@ struct ZeroCmdQueueKey {
struct ZeroCmdQueueKeyHash {
size_t operator()(const ZeroCmdQueueKey& key) const {
- // Initial 64-bit seed for deterministic key mixing.
- static constexpr uint64_t kFnvOffsetBasis64 = 1469598103934665603ULL;
- // 64-bit golden-ratio constant used by boost-style hash combine.
- static constexpr uint64_t kHashCombineConstant64 = 0x9e3779b97f4a7c15ULL;
-
- uint64_t hash = kFnvOffsetBasis64;
- const auto hash_combine = [&hash](const uint64_t value) {
- // Mix each field into the running hash; suitable for unordered_map use.
- hash ^= value + kHashCombineConstant64 + (hash << 6) + (hash >> 2);
- };
- hash_combine(std::hash<void*>{}(key.context));
- hash_combine(std::hash<void*>{}(key.device));
- hash_combine(static_cast<uint64_t>(key.desc.priority));
- if (key.desc.workload.has_value()) {
- hash_combine(1ULL);
- hash_combine(static_cast<uint64_t>(key.desc.workload.value()));
- } else {
- hash_combine(0ULL);
- }
- hash_combine(static_cast<uint64_t>(key.desc.options));
- if (key.desc.options & ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC || !key.desc.shared_common_queue) {
- OPENVINO_ASSERT(key.desc.owner_tag != nullptr,
- "owner_tag must not be null when ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC is set");
- hash_combine(std::hash<const void*>{}(key.desc.owner_tag));
- }
+ uint64_t hash = zero_hashing::kFnvOffsetBasis64;
+ hash = zero_hashing::hash_combine64(hash, std::hash<void*>{}(key.context));
+ hash = zero_hashing::hash_combine64(hash, std::hash<void*>{}(key.device));
+ hash = zero_hashing::hash_combine64(hash, key.desc.key());
return static_cast<size_t>(hash);
}
diff --git a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_wrappers.hpp b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_wrappers.hpp
index f74a220b0da..9dafd0e2629 100644
--- a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_wrappers.hpp
+++ b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_wrappers.hpp
@@ -7,85 +7,75 @@
#include <ze_api.h>
#include <ze_command_queue_npu_ext.h>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
#include <optional>
+#include <vector>
#include "intel_npu/utils/logger/logger.hpp"
#include "intel_npu/utils/zero/zero_init.hpp"
#include "intel_npu/utils/zero/zero_types.hpp"
-#include "intel_npu/utils/zero/zero_utils.hpp"
namespace intel_npu {
-class CommandList;
-class CommandQueue;
-struct CommandQueueDesc {
- ze_command_queue_priority_t priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
- std::optional<ze_command_queue_workload_type_t> workload = std::nullopt;
- uint32_t options = 0;
- const void* owner_tag = nullptr;
- bool shared_common_queue = true;
- uint64_t key = 0;
-
- bool operator==(const CommandQueueDesc& other) const {
- if (priority != other.priority || workload != other.workload || options != other.options ||
- shared_common_queue != other.shared_common_queue) {
- return false;
- }
- // pointer is only meaningful when the device-sync flag is active
- const bool use_owner_tag = (options & ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC) != 0 || !shared_common_queue;
- const bool other_use_owner_tag =
- (other.options & ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC) != 0 || !other.shared_common_queue;
- if (use_owner_tag || other_use_owner_tag) {
- // when owner_tag participates in the key, require it to be non-null and equal on both sides
- if (owner_tag == nullptr || other.owner_tag == nullptr || owner_tag != other.owner_tag) {
- return false;
- }
- }
-
- return true;
- }
-};
+namespace zero_hashing {
+inline constexpr uint64_t kFnvOffsetBasis64 = 1469598103934665603ULL;
+inline constexpr uint64_t kHashCombineConstant64 = 0x9e3779b97f4a7c15ULL;
-class EventPool {
+inline uint64_t hash_combine64(uint64_t seed, uint64_t value) {
+ return seed ^ (value + kHashCombineConstant64 + (seed << 6) + (seed >> 2));
+}
+} // namespace zero_hashing
+
+class CommandQueue;
+
+class CommandQueueDesc {
public:
- EventPool() = delete;
- EventPool(ze_device_handle_t device_handle, const ze_context_handle_t& context, uint32_t event_count);
- EventPool(const EventPool&) = delete;
- EventPool(EventPool&&) = delete;
- EventPool& operator=(const EventPool&) = delete;
- EventPool& operator=(EventPool&&) = delete;
- ~EventPool();
- inline ze_event_pool_handle_t handle() const {
- return _handle;
- }
+ friend class CommandQueue;
-private:
- ze_event_pool_handle_t _handle = nullptr;
+ CommandQueueDesc();
+ CommandQueueDesc(ze_command_queue_priority_t priority,
+ std::optional<ze_command_queue_workload_type_t> workload,
+ uint32_t options,
+ const void* owner_tag,
+ bool shared_common_queue);
- Logger _log;
-};
+ ze_command_queue_priority_t priority() const {
+ return _priority;
+ }
+ std::optional<ze_command_queue_workload_type_t> workload() const {
+ return _workload;
+ }
+ uint64_t key() const {
+ return _key;
+ }
-class Event {
-public:
- Event() = delete;
- Event(const std::shared_ptr<EventPool>& event_pool, uint32_t event_index);
- Event(const Event&) = delete;
- Event(Event&&) = delete;
- Event& operator=(const Event&) = delete;
- Event& operator=(Event&&) = delete;
+ void set_priority(ze_command_queue_priority_t priority);
+ void set_workload(std::optional<ze_command_queue_workload_type_t> workload);
- void AppendSignalEvent(CommandList& command_list) const;
- void AppendWaitOnEvent(CommandList& command_list);
- void AppendEventReset(CommandList& command_list) const;
- void hostSynchronize() const;
- void reset() const;
- ~Event();
+ bool operator==(const CommandQueueDesc& other) const;
private:
- std::shared_ptr<EventPool> _event_pool;
- ze_event_handle_t _handle = nullptr;
+ bool owner_tag_required() const;
+ void update_key();
- Logger _log;
+ uint32_t options() const {
+ return _options;
+ }
+ const void* owner_tag() const {
+ return _owner_tag;
+ }
+ bool shared_common_queue() const {
+ return _shared_common_queue;
+ }
+
+ ze_command_queue_priority_t _priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
+ std::optional<ze_command_queue_workload_type_t> _workload = std::nullopt;
+ uint32_t _options = 0;
+ const void* _owner_tag = nullptr;
+ bool _shared_common_queue = true;
+ uint64_t _key = 0;
};
class CommandList {
@@ -178,4 +168,46 @@ private:
ze_command_queue_handle_t _handle = nullptr;
};
+class EventPool {
+public:
+ EventPool() = delete;
+ EventPool(ze_device_handle_t device_handle, const ze_context_handle_t& context, uint32_t event_count);
+ EventPool(const EventPool&) = delete;
+ EventPool(EventPool&&) = delete;
+ EventPool& operator=(const EventPool&) = delete;
+ EventPool& operator=(EventPool&&) = delete;
+ ~EventPool();
+ inline ze_event_pool_handle_t handle() const {
+ return _handle;
+ }
+
+private:
+ ze_event_pool_handle_t _handle = nullptr;
+
+ Logger _log;
+};
+
+class Event {
+public:
+ Event() = delete;
+ Event(const std::shared_ptr<EventPool>& event_pool, uint32_t event_index);
+ Event(const Event&) = delete;
+ Event(Event&&) = delete;
+ Event& operator=(const Event&) = delete;
+ Event& operator=(Event&&) = delete;
+
+ void AppendSignalEvent(CommandList& command_list) const;
+ void AppendWaitOnEvent(CommandList& command_list);
+ void AppendEventReset(CommandList& command_list) const;
+ void hostSynchronize() const;
+ void reset() const;
+ ~Event();
+
+private:
+ std::shared_ptr<EventPool> _event_pool;
+ ze_event_handle_t _handle = nullptr;
+
+ Logger _log;
+};
+
} // namespace intel_npu
diff --git a/src/plugins/intel_npu/src/utils/src/zero/zero_wrappers.cpp b/src/plugins/intel_npu/src/utils/src/zero/zero_wrappers.cpp
index eb03a8eb50e..fc7ae9a9409 100644
--- a/src/plugins/intel_npu/src/utils/src/zero/zero_wrappers.cpp
+++ b/src/plugins/intel_npu/src/utils/src/zero/zero_wrappers.cpp
@@ -4,10 +4,78 @@
#include "intel_npu/utils/zero/zero_wrappers.hpp"
+#include <functional>
+
#include "intel_npu/utils/zero/zero_api.hpp"
+#include "intel_npu/utils/zero/zero_utils.hpp"
namespace intel_npu {
+CommandQueueDesc::CommandQueueDesc() {
+ update_key();
+}
+CommandQueueDesc::CommandQueueDesc(ze_command_queue_priority_t priority,
+ std::optional<ze_command_queue_workload_type_t> workload,
+ uint32_t options,
+ const void* owner_tag,
+ bool shared_common_queue)
+ : _priority(priority),
+ _workload(workload),
+ _options(options),
+ _owner_tag(owner_tag),
+ _shared_common_queue(shared_common_queue) {
+ update_key();
+}
+void CommandQueueDesc::set_priority(ze_command_queue_priority_t priority) {
+ _priority = priority;
+ update_key();
+}
+void CommandQueueDesc::set_workload(std::optional<ze_command_queue_workload_type_t> workload) {
+ _workload = workload;
+ update_key();
+}
+bool CommandQueueDesc::operator==(const CommandQueueDesc& other) const {
+ if (_priority != other._priority || _workload != other._workload || _options != other._options ||
+ _shared_common_queue != other._shared_common_queue) {
+ return false;
+ }
+
+ const bool use_owner_tag = owner_tag_required();
+ const bool other_use_owner_tag = other.owner_tag_required();
+ if (use_owner_tag || other_use_owner_tag) {
+ if (_owner_tag == nullptr || other._owner_tag == nullptr || _owner_tag != other._owner_tag) {
+ return false;
+ }
+ }
+
+ return true;
+}
+bool CommandQueueDesc::owner_tag_required() const {
+ return (_options & ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC) != 0 || !_shared_common_queue;
+}
+void CommandQueueDesc::update_key() {
+ uint64_t hash = zero_hashing::kFnvOffsetBasis64;
+ hash = zero_hashing::hash_combine64(hash, static_cast<uint64_t>(_priority));
+ if (_workload.has_value()) {
+ hash = zero_hashing::hash_combine64(hash, 1ULL);
+ hash = zero_hashing::hash_combine64(hash, static_cast<uint64_t>(_workload.value()));
+ } else {
+ hash = zero_hashing::hash_combine64(hash, 0ULL);
+ }
+ hash = zero_hashing::hash_combine64(hash, static_cast<uint64_t>(_options));
+ hash = zero_hashing::hash_combine64(hash, static_cast<uint64_t>(_shared_common_queue));
+
+ const bool use_owner_tag = owner_tag_required();
+ if (use_owner_tag) {
+ OPENVINO_ASSERT(_owner_tag != nullptr,
+ "owner_tag must not be null when ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC is set or "
+ "shared_common_queue is disabled");
+ hash = zero_hashing::hash_combine64(hash, std::hash<const void*>{}(_owner_tag));
+ }
+
+ _key = hash;
+}
+
EventPool::EventPool(ze_device_handle_t device_handle, const ze_context_handle_t& context, uint32_t event_count)
: _log("EventPool", Logger::global().level()) {
ze_event_pool_desc_t event_pool_desc = {ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
@@ -213,18 +281,18 @@ CommandQueue::CommandQueue(const std::shared_ptr<ZeroInitStructsHolder>& init_st
0,
0,
ZE_COMMAND_QUEUE_MODE_DEFAULT,
- _desc.priority};
+ _desc.priority()};
ze_command_queue_desc_npu_ext_t turbo_cfg = {};
ze_command_queue_desc_npu_ext_2_t command_queue_desc = {};
- if (_desc.options) {
+ if (_desc.options()) {
if (_init_structs->getCommandQueueDdiTable().version() == ZE_MAKE_VERSION(1, 0)) {
turbo_cfg.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC_NPU_EXT;
- turbo_cfg.turbo = _desc.options & ZE_NPU_COMMAND_QUEUE_OPTION_TURBO;
+ turbo_cfg.turbo = _desc.options() & ZE_NPU_COMMAND_QUEUE_OPTION_TURBO;
ze_queue_desc.pNext = &turbo_cfg;
} else if (_init_structs->getCommandQueueDdiTable().version() > ZE_MAKE_VERSION(1, 0)) {
command_queue_desc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC_NPU_EXT_2;
- command_queue_desc.options = _desc.options;
+ command_queue_desc.options = _desc.options();
ze_queue_desc.pNext = &command_queue_desc;
}
}
@@ -233,12 +301,12 @@ CommandQueue::CommandQueue(const std::shared_ptr<ZeroInitStructsHolder>& init_st
"zeCommandQueueCreate",
zeCommandQueueCreate(_init_structs->getContext(), _init_structs->getDevice(), &ze_queue_desc, &_handle));
- if (_desc.workload.has_value()) {
+ if (_desc.workload().has_value()) {
try {
if (_init_structs->getCommandQueueDdiTable().version() >= ZE_MAKE_VERSION(1, 0)) {
THROW_ON_FAIL_FOR_LEVELZERO(
"zeSetWorkloadType",
- _init_structs->getCommandQueueDdiTable().pfnSetWorkloadType(_handle, _desc.workload.value()));
+ _init_structs->getCommandQueueDdiTable().pfnSetWorkloadType(_handle, _desc.workload().value()));
} else {
OPENVINO_THROW("The WorkloadType property is not supported by the current Driver Version!");
}
diff --git a/src/plugins/intel_npu/tests/functional/internal/utils/zero/zero_cmd_queue_pool_tests.hpp b/src/plugins/intel_npu/tests/functional/internal/utils/zero/zero_cmd_queue_pool_tests.hpp
index 8bd7dd63945..d68dd543620 100644
--- a/src/plugins/intel_npu/tests/functional/internal/utils/zero/zero_cmd_queue_pool_tests.hpp
+++ b/src/plugins/intel_npu/tests/functional/internal/utils/zero/zero_cmd_queue_pool_tests.hpp
@@ -76,7 +76,11 @@ public:
};
TEST_P(ZeroCmdQueuePoolTests, SetWorkloadType) {
- ::intel_npu::CommandQueueDesc command_queue_desc{ZE_COMMAND_QUEUE_PRIORITY_NORMAL, ZE_WORKLOAD_TYPE_BACKGROUND};
+ ::intel_npu::CommandQueueDesc command_queue_desc{ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
+ ZE_WORKLOAD_TYPE_BACKGROUND,
+ 0,
+ nullptr,
+ true};
if (init_struct->getCommandQueueDdiTable().version() > 0) {
OV_ASSERT_NO_THROW(
@@ -91,7 +95,11 @@ TEST_P(ZeroCmdQueuePoolTests, SetWorkloadType) {
TEST_P(ZeroCmdQueuePoolTests, PoolReusabilityTest) {
// Test that the pool correctly reuses queues after weak_ptr cleanup
- ::intel_npu::CommandQueueDesc command_queue_desc{ZE_COMMAND_QUEUE_PRIORITY_NORMAL};
+ ::intel_npu::CommandQueueDesc command_queue_desc{ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
+ std::nullopt,
+ 0,
+ nullptr,
+ true};
// First allocation
std::shared_ptr<::intel_npu::CommandQueue> queue1 =
@@ -187,11 +195,9 @@ TEST_P(ZeroCmdQueuePoolTests, AllCommandQueueOptionsCombinations) {
for (auto priority : priorities) {
for (auto workload_type : workload_types) {
for (auto options : option_combinations) {
- ::intel_npu::CommandQueueDesc cmd_desc{priority, workload_type, options};
- if (options & ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC) {
- static int owner = 1; // Just a dummy pointer value for testing
- cmd_desc.owner_tag = &owner;
- }
+ static int owner = 1; // Just a dummy pointer value for testing
+ ::intel_npu::CommandQueueDesc cmd_desc{priority, workload_type, options, &owner, true};
+
auto cmd_queue = ::intel_npu::ZeroCmdQueuePool::getInstance().getCommandQueue(init_struct, cmd_desc);
EXPECT_NE(cmd_queue, nullptr) << "Failed to allocate command queue for priority=" << (int)priority
@@ -225,7 +231,8 @@ TEST_P(ZeroCmdQueuePoolTests, CreateDifferentCommandQueueForEachDeviceSyncOption
::intel_npu::CommandQueueDesc device_sync_desc_a{ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
ZE_WORKLOAD_TYPE_DEFAULT,
ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC,
- &owner_a};
+ &owner_a,
+ true};
auto queue_device_sync_a_1 =
::intel_npu::ZeroCmdQueuePool::getInstance().getCommandQueue(init_struct, device_sync_desc_a);
auto queue_device_sync_a_2 =
@@ -238,7 +245,8 @@ TEST_P(ZeroCmdQueuePoolTests, CreateDifferentCommandQueueForEachDeviceSyncOption
::intel_npu::CommandQueueDesc device_sync_desc_b{ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
ZE_WORKLOAD_TYPE_DEFAULT,
ZE_NPU_COMMAND_QUEUE_OPTION_DEVICE_SYNC,
- &owner_b};
+ &owner_b,
+ true};
auto queue_device_sync_b =
::intel_npu::ZeroCmdQueuePool::getInstance().getCommandQueue(init_struct, device_sync_desc_b);
@@ -250,11 +258,13 @@ TEST_P(ZeroCmdQueuePoolTests, CreateDifferentCommandQueueForEachDeviceSyncOption
::intel_npu::CommandQueueDesc no_device_sync_desc_a{ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
ZE_WORKLOAD_TYPE_DEFAULT,
0,
- &owner_a};
+ &owner_a,
+ true};
::intel_npu::CommandQueueDesc no_device_sync_desc_b{ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
ZE_WORKLOAD_TYPE_DEFAULT,
0,
- &owner_b};
+ &owner_b,
+ true};
auto queue_no_device_sync_a =
::intel_npu::ZeroCmdQueuePool::getInstance().getCommandQueue(init_struct, no_device_sync_desc_a);
auto queue_no_device_sync_b =
@@ -309,7 +319,7 @@ TEST_P(ZeroCmdQueuePoolTests, MultiThreadingTest) {
}
// else: no options (commandQueueOptions = 0)
- ::intel_npu::CommandQueueDesc command_queue_desc{priority, workload_type, commandQueueOptions};
+ ::intel_npu::CommandQueueDesc command_queue_desc{priority, workload_type, commandQueueOptions, nullptr, true};
auto cmd_queue =
::intel_npu::ZeroCmdQueuePool::getInstance().getCommandQueue(init_struct, command_queue_desc);
@@ -376,7 +386,11 @@ TEST_P(ZeroCmdQueuePoolTests, MultiThreadingTestWithDestroyCmdQueue) {
}
// else: no options (commandQueueOptions = 0)
- ::intel_npu::CommandQueueDesc command_queue_desc{priority, workload_type, commandQueueOptions};
+ ::intel_npu::CommandQueueDesc command_queue_desc{priority,
+ workload_type,
+ commandQueueOptions,
+ nullptr,
+ true};
auto cmd_queue =
::intel_npu::ZeroCmdQueuePool::getInstance().getCommandQueue(init_struct, command_queue_desc);
ASSERT_NE(cmd_queue, nullptr);