diff --git a/src/plugins/intel_npu/src/al/include/npu.hpp b/src/plugins/intel_npu/src/al/include/npu.hpp index 0bfc660a96cd20..dd0c16e05dec64 100644 --- a/src/plugins/intel_npu/src/al/include/npu.hpp +++ b/src/plugins/intel_npu/src/al/include/npu.hpp @@ -27,6 +27,10 @@ class IEngineBackend : public std::enable_shared_from_this { virtual const std::shared_ptr getDevice(const ov::AnyMap& paramMap) const; /** @brief Provide a list of names of all devices, with which user can work directly */ virtual const std::vector getDeviceNames() const; + /** @brief Provide driver version */ + virtual uint32_t getDriverVersion() const; + /** @brief Provide driver extension version */ + virtual uint32_t getDriverExtVersion() const; /** @brief Get name of backend */ virtual const std::string getName() const = 0; /** @brief Register backend-specific options */ @@ -60,7 +64,6 @@ class IDevice : public std::enable_shared_from_this { virtual uint32_t getMaxNumSlices() const; virtual uint64_t getAllocMemSize() const; virtual uint64_t getTotalMemSize() const; - virtual uint32_t getDriverVersion() const; virtual std::shared_ptr createInferRequest( const std::shared_ptr& compiledModel, diff --git a/src/plugins/intel_npu/src/al/src/npu.cpp b/src/plugins/intel_npu/src/al/src/npu.cpp index f88c0427f7be71..2d9c852a6d0742 100644 --- a/src/plugins/intel_npu/src/al/src/npu.cpp +++ b/src/plugins/intel_npu/src/al/src/npu.cpp @@ -21,6 +21,12 @@ const std::shared_ptr IEngineBackend::getDevice(const ov::AnyMap&) cons const std::vector IEngineBackend::getDeviceNames() const { OPENVINO_THROW("Get all device names not implemented"); } +uint32_t IEngineBackend::getDriverVersion() const { + OPENVINO_THROW("Get NPU driver version is not supported with this backend"); +} +uint32_t IEngineBackend::getDriverExtVersion() const { + OPENVINO_THROW("Get NPU driver extension version is not supported with this backend"); +} void IEngineBackend::registerOptions(OptionsDesc&) const {} @@ -44,8 +50,4 @@ uint64_t IDevice::getTotalMemSize() const { OPENVINO_THROW("Get TotalMemSize is not supported"); } -uint32_t IDevice::getDriverVersion() const { - OPENVINO_THROW("Get NPU driver version is not supported with this backend"); -} - } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/include/zero_backend.hpp b/src/plugins/intel_npu/src/backend/include/zero_backend.hpp index fd3d03c5079db1..0c13cc5bb2adf5 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_backend.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_backend.hpp @@ -21,11 +21,15 @@ class ZeroEngineBackend final : public IEngineBackend { return "LEVEL0"; } const std::vector getDeviceNames() const override; + uint32_t getDriverVersion() const override; + uint32_t getDriverExtVersion() const override; private: std::shared_ptr _instance; std::map> _devices{}; + + ze_driver_properties_t _driver_properties = {}; }; } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/include/zero_device.hpp b/src/plugins/intel_npu/src/backend/include/zero_device.hpp index 3ca7f3316dea95..15f3cbd3d2572f 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_device.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_device.hpp @@ -29,7 +29,6 @@ class ZeroDevice : public IDevice { uint32_t getMaxNumSlices() const override; uint64_t getAllocMemSize() const override; uint64_t getTotalMemSize() const override; - uint32_t getDriverVersion() const override; std::shared_ptr createInferRequest(const std::shared_ptr& compiledModel, const std::shared_ptr& executor, diff --git a/src/plugins/intel_npu/src/backend/include/zero_init.hpp b/src/plugins/intel_npu/src/backend/include/zero_init.hpp index 2c7ad554674184..165074a97ad007 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_init.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_init.hpp @@ -42,6 +42,9 @@ class ZeroInitStructsHolder final { inline ze_graph_profiling_dditable_ext_t* getProfilingDdiTable() const { return _graph_profiling_ddi_table_ext; } + inline uint32_t getDriverExtVersion() const { + return driver_ext_version; + } private: static const ze_driver_uuid_t uuid; @@ -52,6 +55,8 @@ class ZeroInitStructsHolder final { ze_context_handle_t context = nullptr; std::unique_ptr graph_dditable_ext_decorator; ze_graph_profiling_dditable_ext_t* _graph_profiling_ddi_table_ext = nullptr; + + uint32_t driver_ext_version = 0; }; } // namespace intel_npu diff --git a/src/plugins/intel_npu/src/backend/src/zero_backend.cpp b/src/plugins/intel_npu/src/backend/src/zero_backend.cpp index facedd789981d3..a05d4a6ab555a8 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_backend.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_backend.cpp @@ -20,6 +20,14 @@ ZeroEngineBackend::ZeroEngineBackend(const Config& config) { _devices.emplace(std::make_pair(device->getName(), device)); } +uint32_t ZeroEngineBackend::getDriverVersion() const { + return _driver_properties.driverVersion; +} + +uint32_t ZeroEngineBackend::getDriverExtVersion() const { + return _instance->getDriverExtVersion(); +} + ZeroEngineBackend::~ZeroEngineBackend() = default; const std::shared_ptr ZeroEngineBackend::getDevice() const { diff --git a/src/plugins/intel_npu/src/backend/src/zero_device.cpp b/src/plugins/intel_npu/src/backend/src/zero_device.cpp index dc0c8041a3bcb7..a1b5a548c566b2 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_device.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_device.cpp @@ -89,10 +89,6 @@ IDevice::Uuid ZeroDevice::getUuid() const { return uuid; } -uint32_t ZeroDevice::getDriverVersion() const { - return driver_properties.driverVersion; -} - uint32_t ZeroDevice::getSubDevId() const { return device_properties.subdeviceId; } diff --git a/src/plugins/intel_npu/src/backend/src/zero_init.cpp b/src/plugins/intel_npu/src/backend/src/zero_init.cpp index 1cff12491b60f0..68106edc6817a8 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_init.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_init.cpp @@ -105,25 +105,24 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", } // Query our graph extension version - uint32_t driverExtVersion = 0; - std::string graphExtName; - std::tie(driverExtVersion, graphExtName) = queryDriverExtensionVersion(driver_handle); + std::string graph_ext_name; + std::tie(driver_ext_version, graph_ext_name) = queryDriverExtensionVersion(driver_handle); log.debug("Found Driver Version %d.%d, Driver Extension Version %d.%d (%s)", ZE_MAJOR_VERSION(ze_drv_api_version), ZE_MINOR_VERSION(ze_drv_api_version), - ZE_MAJOR_VERSION(driverExtVersion), - ZE_MINOR_VERSION(driverExtVersion), - graphExtName.c_str()); + ZE_MAJOR_VERSION(driver_ext_version), + ZE_MINOR_VERSION(driver_ext_version), + graph_ext_name.c_str()); // Load our graph extension ze_graph_dditable_ext_last_t* graph_ddi_table_ext = nullptr; zeroUtils::throwOnFail("zeDriverGetExtensionFunctionAddress", zeDriverGetExtensionFunctionAddress(driver_handle, - graphExtName.c_str(), + graph_ext_name.c_str(), reinterpret_cast(&graph_ddi_table_ext))); graph_dditable_ext_decorator = - std::make_unique(graph_ddi_table_ext, driverExtVersion); + std::make_unique(graph_ddi_table_ext, driver_ext_version); // Load our profiling extension zeroUtils::throwOnFail( diff --git a/src/plugins/intel_npu/src/plugin/include/backends.hpp b/src/plugins/intel_npu/src/plugin/include/backends.hpp index 30b9006fa23a1c..08b983f0aea6d2 100644 --- a/src/plugins/intel_npu/src/plugin/include/backends.hpp +++ b/src/plugins/intel_npu/src/plugin/include/backends.hpp @@ -29,6 +29,8 @@ class NPUBackends final { std::shared_ptr getDevice(const ov::AnyMap& paramMap) const; std::vector getAvailableDevicesNames() const; std::string getBackendName() const; + uint32_t getDriverVersion() const; + uint32_t getDriverExtVersion() const; void registerOptions(OptionsDesc& options) const; std::string getCompilationPlatform(const std::string_view platform, const std::string& deviceId) const; diff --git a/src/plugins/intel_npu/src/plugin/include/metrics.hpp b/src/plugins/intel_npu/src/plugin/include/metrics.hpp index f16da63bfbbd4f..20e30fdd949ddf 100644 --- a/src/plugins/intel_npu/src/plugin/include/metrics.hpp +++ b/src/plugins/intel_npu/src/plugin/include/metrics.hpp @@ -33,7 +33,8 @@ class Metrics final { std::string GetBackendName() const; uint64_t GetDeviceAllocMemSize(const std::string& specifiedDeviceName) const; uint64_t GetDeviceTotalMemSize(const std::string& specifiedDeviceName) const; - uint32_t GetDriverVersion(const std::string& specifiedDeviceName) const; + uint32_t GetDriverVersion() const; + uint32_t GetDriverExtVersion() const; std::vector GetCachingProperties() const; std::vector GetInternalSupportedProperties() const; diff --git a/src/plugins/intel_npu/src/plugin/src/backends.cpp b/src/plugins/intel_npu/src/plugin/src/backends.cpp index 9a77018781c4b1..34bfb02fdc69e0 100644 --- a/src/plugins/intel_npu/src/plugin/src/backends.cpp +++ b/src/plugins/intel_npu/src/plugin/src/backends.cpp @@ -139,6 +139,22 @@ std::string NPUBackends::getBackendName() const { return ""; } +uint32_t NPUBackends::getDriverVersion() const { + if (_backend != nullptr) { + return _backend->getDriverVersion(); + } + + OPENVINO_THROW("No available backend"); +} + +uint32_t NPUBackends::getDriverExtVersion() const { + if (_backend != nullptr) { + return _backend->getDriverExtVersion(); + } + + OPENVINO_THROW("No available backend"); +} + std::shared_ptr NPUBackends::getDevice(const std::string& specificName) const { _logger.debug("Searching for device %s to use started...", specificName.c_str()); // TODO iterate over all available backends diff --git a/src/plugins/intel_npu/src/plugin/src/metrics.cpp b/src/plugins/intel_npu/src/plugin/src/metrics.cpp index 5016fb8e24ca81..8882c62391089b 100644 --- a/src/plugins/intel_npu/src/plugin/src/metrics.cpp +++ b/src/plugins/intel_npu/src/plugin/src/metrics.cpp @@ -103,6 +103,22 @@ std::string Metrics::GetBackendName() const { return _backends->getBackendName(); } +uint32_t Metrics::GetDriverVersion() const { + if (_backends == nullptr) { + OPENVINO_THROW("No available backends"); + } + + return _backends->getDriverVersion(); +} + +uint32_t Metrics::GetDriverExtVersion() const { + if (_backends == nullptr) { + OPENVINO_THROW("No available backends"); + } + + return _backends->getDriverExtVersion(); +} + uint64_t Metrics::GetDeviceAllocMemSize(const std::string& specifiedDeviceName) const { const auto devName = getDeviceName(specifiedDeviceName); auto device = _backends->getDevice(devName); @@ -121,15 +137,6 @@ uint64_t Metrics::GetDeviceTotalMemSize(const std::string& specifiedDeviceName) OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available"); } -uint32_t Metrics::GetDriverVersion(const std::string& specifiedDeviceName) const { - const auto devName = getDeviceName(specifiedDeviceName); - auto device = _backends->getDevice(devName); - if (device) { - return device->getDriverVersion(); - } - OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available"); -} - std::string Metrics::getDeviceName(const std::string& specifiedDeviceName) const { std::vector devNames; if (_backends == nullptr || (devNames = _backends->getAvailableDevicesNames()).empty()) { diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp index 0fd92c44b2f7f6..0e8b4b1543c794 100644 --- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp +++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp @@ -329,7 +329,7 @@ Plugin::Plugin() {true, ov::PropertyMutability::RO, [&](const Config& config) { - return _metrics->GetDriverVersion(get_specified_device_name(config)); + return _metrics->GetDriverVersion(); }}}, // NPU Private // =========