OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Use graph properties from ZeroInitStruct in compiler adapter (#28699)
Patrik Stepan5981aab184c2
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hppindex 3a2af03df8c..daf401100e6 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/driver_compiler_adapter.hpp@@ -55,7 +55,7 @@ private:std::shared_ptr<ZeroInitStructsHolder> _zeroInitStruct;std::shared_ptr<ZeGraphExtWrappers> _zeGraphExt;- ze_device_graph_properties_t _deviceGraphProperties = {};+ ze_device_graph_properties_t _compilerProperties = {};Logger _logger;};diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cppindex 1d19854618a..624ba448fed 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp@@ -145,10 +145,7 @@ DriverCompilerAdapter::DriverCompilerAdapter(const std::shared_ptr<ZeroInitStrucuint32_t graphExtVersion = _zeroInitStruct->getGraphDdiTable().version();- _deviceGraphProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_GRAPH_PROPERTIES;- auto result = _zeroInitStruct->getGraphDdiTable().pfnDeviceGetGraphProperties(_zeroInitStruct->getDevice(),- &_deviceGraphProperties);- THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnDeviceGetGraphProperties", result, _zeroInitStruct->getGraphDdiTable());+ _compilerProperties = _zeroInitStruct->getCompilerProperties();_logger.info("DriverCompilerAdapter creating adapter using graphExtVersion");@@ -163,8 +160,8 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compile(const std::shared_ptr<conconst Config& config) const {OV_ITT_TASK_CHAIN(COMPILE_BLOB, itt::domains::NPUPlugin, "DriverCompilerAdapter", "compile");- const ze_graph_compiler_version_info_t& compilerVersion = _deviceGraphProperties.compilerVersion;- const auto maxOpsetVersion = _deviceGraphProperties.maxOVOpsetVersionSupported;+ const ze_graph_compiler_version_info_t& compilerVersion = _compilerProperties.compilerVersion;+ const auto maxOpsetVersion = _compilerProperties.maxOVOpsetVersionSupported;_logger.info("getSupportedOpsetVersion Max supported version of opset in CiD: %d", maxOpsetVersion);_logger.debug("serialize IR");@@ -227,8 +224,8 @@ ov::SupportedOpsMap DriverCompilerAdapter::query(const std::shared_ptr<const ov:const Config& config) const {OV_ITT_TASK_CHAIN(query_BLOB, itt::domains::NPUPlugin, "DriverCompilerAdapter", "query");- const ze_graph_compiler_version_info_t& compilerVersion = _deviceGraphProperties.compilerVersion;- const auto maxOpsetVersion = _deviceGraphProperties.maxOVOpsetVersionSupported;+ const ze_graph_compiler_version_info_t& compilerVersion = _compilerProperties.compilerVersion;+ const auto maxOpsetVersion = _compilerProperties.maxOVOpsetVersionSupported;_logger.info("getSupportedOpsetVersion Max supported version of opset in CiD: %d", maxOpsetVersion);_logger.debug("serialize IR");diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cppindex 23e2e04fbe0..34dafb94449 100644--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp@@ -183,6 +183,7 @@ Plugin::Plugin()// parse env_variables to get LOG_LEVEL if needed_globalConfig.parseEnvVars();+ Logger::global().setLevel(_globalConfig.get<LOG_LEVEL>());// TODO: generation of available backends list can be done during execution of CMake scriptsstd::vector<AvailableBackends> backendRegistry;diff --git a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_init.hpp b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_init.hppindex e96d4744553..3178aecd182 100644--- a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_init.hpp+++ b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_init.hpp@@ -50,7 +50,10 @@ public:return driver_properties.driverVersion;}inline uint32_t getCompilerVersion() const {- return compiler_version;+ return ZE_MAKE_VERSION(compiler_properties.compilerVersion.major, compiler_properties.compilerVersion.minor);+ }+ inline ze_device_graph_properties_t getCompilerProperties() const {+ return compiler_properties;}inline uint32_t getMutableCommandListVersion() const {return mutable_command_list_version;@@ -89,7 +92,7 @@ private:ze_api_version_t ze_drv_api_version = {};- uint32_t compiler_version = 0;+ ze_device_graph_properties_t compiler_properties = {};};} // namespace intel_npudiff --git a/src/plugins/intel_npu/src/utils/src/zero/zero_init.cpp b/src/plugins/intel_npu/src/utils/src/zero/zero_init.cppindex ff2daaccafb..135f648d597 100644--- a/src/plugins/intel_npu/src/utils/src/zero/zero_init.cpp+++ b/src/plugins/intel_npu/src/utils/src/zero/zero_init.cpp@@ -313,12 +313,10 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder",THROW_ON_FAIL_FOR_LEVELZERO("zeContextCreate", zeContextCreate(driver_handle, &context_desc, &context));log.debug("ZeroInitStructsHolder initialize complete");- // Obtain compiler-in-driver (vcl) version- ze_device_graph_properties_t graph_props;- graph_props.stype = ZE_STRUCTURE_TYPE_DEVICE_GRAPH_PROPERTIES;- auto result = graph_dditable_ext_decorator->pfnDeviceGetGraphProperties(device_handle, &graph_props);+ // Obtain compiler-in-driver properties+ compiler_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_GRAPH_PROPERTIES;+ auto result = graph_dditable_ext_decorator->pfnDeviceGetGraphProperties(device_handle, &compiler_properties);THROW_ON_FAIL_FOR_LEVELZERO("pfnDeviceGetGraphProperties", result);- compiler_version = ZE_MAKE_VERSION(graph_props.compilerVersion.major, graph_props.compilerVersion.minor);}ZeroInitStructsHolder::~ZeroInitStructsHolder() {