diff --git a/src/plugins/intel_npu/src/backend/include/zero_executor.hpp b/src/plugins/intel_npu/src/backend/include/zero_executor.hpp index 11cc6fab4bce25..f535f62d78e180 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_executor.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_executor.hpp @@ -61,6 +61,8 @@ class ZeroExecutor final : public IExecutor { } private: + void initilize_graph_through_command_list() const; + const Config _config; Logger _logger; diff --git a/src/plugins/intel_npu/src/backend/src/zero_executor.cpp b/src/plugins/intel_npu/src/backend/src/zero_executor.cpp index ade476c5649e53..ab9fed13be692a 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_executor.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_executor.cpp @@ -37,23 +37,6 @@ ZeroExecutor::ZeroExecutor(const std::shared_ptr& i _initStructs->getCommandQueueDdiTable(), _config, group_ordinal)} { - _logger.debug("ZeroExecutor::ZeroExecutor init start - create graph_command_list"); - OV_ITT_SCOPED_TASK(itt::domains::LevelZeroBackend, "Executor::ZeroExecutor"); - CommandList graph_command_list(_initStructs->getDevice(), - _initStructs->getContext(), - _graph_ddi_table_ext, - _config, - _group_ordinal); - _logger.debug("ZeroExecutor::ZeroExecutor - create graph_command_queue"); - CommandQueue graph_command_queue(_initStructs->getDevice(), - _initStructs->getContext(), - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - _initStructs->getCommandQueueDdiTable(), - _config, - _group_ordinal); - _logger.debug("ZeroExecutor::ZeroExecutor - create fence"); - Fence fence(graph_command_queue, _config); - _logger.debug("ZeroExecutor::ZeroExecutor - create graph"); OV_ITT_TASK_CHAIN(ZERO_EXECUTOR_GRAPH, itt::domains::LevelZeroBackend, "Executor::ZeroExecutor", "graphCreate"); @@ -100,6 +83,55 @@ ZeroExecutor::ZeroExecutor(const std::shared_ptr& i } } + if (_graph_ddi_table_ext.version() < ZE_GRAPH_EXT_VERSION_1_8) { + initilize_graph_through_command_list(); + } else { + ze_graph_properties_2_t properties = {}; + properties.stype = ZE_STRUCTURE_TYPE_GRAPH_PROPERTIES; + _graph_ddi_table_ext.pfnGetProperties2(_graph, &properties); + + switch (properties.initStageRequired) { + case ZE_GRAPH_STAGE_INITIALIZE: + OV_ITT_TASK_NEXT(ZERO_EXECUTOR_GRAPH, "pfnGraphInitialize"); + _graph_ddi_table_ext.pfnGraphInitialize(_graph); + break; + case ZE_GRAPH_STAGE_COMMAND_LIST_INITIALIZE: + initilize_graph_through_command_list(); + break; + case ZE_GRAPH_STAGE_FORCE_UINT32: + default: + break; + } + } + + if (config.has()) { + setWorkloadType(config.get()); + } +} + +void ZeroExecutor::initilize_graph_through_command_list() const { + OV_ITT_TASK_CHAIN(ZERO_EXECUTOR_GRAPH, + itt::domains::LevelZeroBackend, + "Executor::ZeroExecutor", + "initilize_graph_through_command_list"); + + _logger.debug("ZeroExecutor::ZeroExecutor init start - create graph_command_list"); + OV_ITT_SCOPED_TASK(itt::domains::LevelZeroBackend, "Executor::ZeroExecutor"); + CommandList graph_command_list(_initStructs->getDevice(), + _initStructs->getContext(), + _graph_ddi_table_ext, + _config, + _group_ordinal); + _logger.debug("ZeroExecutor::ZeroExecutor - create graph_command_queue"); + CommandQueue graph_command_queue(_initStructs->getDevice(), + _initStructs->getContext(), + ZE_COMMAND_QUEUE_PRIORITY_NORMAL, + _initStructs->getCommandQueueDdiTable(), + _config, + _group_ordinal); + _logger.debug("ZeroExecutor::ZeroExecutor - create fence"); + Fence fence(graph_command_queue, _config); + OV_ITT_TASK_NEXT(ZERO_EXECUTOR_GRAPH, "appendGraphInitialize"); _logger.debug("ZeroExecutor::ZeroExecutor - performing appendGraphInitialize"); graph_command_list.appendGraphInitialize(_graph); @@ -112,10 +144,6 @@ ZeroExecutor::ZeroExecutor(const std::shared_ptr& i _logger.debug("ZeroExecutor::ZeroExecutor - performing hostSynchronize"); fence.hostSynchronize(); _logger.debug("ZeroExecutor::ZeroExecutor - hostSynchronize completed"); - - if (config.has()) { - setWorkloadType(config.get()); - } } void ZeroExecutor::setWorkloadType(const ov::WorkloadType workloadType) const {