Skip to content

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

[NPU] Convert metrics into device helpers (#37089)

Stefania Hergane62d02fd219ec
diff --git a/src/plugins/intel_npu/src/common/include/intel_npu/common/device_helpers.hpp b/src/plugins/intel_npu/src/common/include/intel_npu/common/device_helpers.hpp
index a2cbd8feedc..53b0068c86f 100644
--- a/src/plugins/intel_npu/src/common/include/intel_npu/common/device_helpers.hpp
+++ b/src/plugins/intel_npu/src/common/include/intel_npu/common/device_helpers.hpp
@@ -24,6 +24,20 @@ std::string getCompilationPlatform(const std::string_view platform,
* @brief Gets the device by its ID.
*/
std::shared_ptr<IDevice> getDeviceById(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& deviceId);
+std::string getFullDeviceName(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+std::string getDeviceArchitecture(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName);
+IDevice::Uuid getDeviceUuid(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+ov::device::LUID getDeviceLUID(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+uint32_t getSteppingNumber(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+uint32_t getMaxTiles(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+uint64_t getDeviceAllocMemSize(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+uint64_t getDeviceTotalMemSize(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+std::string getDeviceName(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+ov::device::PCIInfo getPciInfo(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
+std::map<ov::element::Type, float> getGops(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName);
+ov::device::Type getDeviceType(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName);
/**
* @brief Gets the optimal number of infer requests in parallel for the given platform and performance mode.
diff --git a/src/plugins/intel_npu/src/common/src/device_helpers.cpp b/src/plugins/intel_npu/src/common/src/device_helpers.cpp
index d98905ed525..15afe0b13e3 100644
--- a/src/plugins/intel_npu/src/common/src/device_helpers.cpp
+++ b/src/plugins/intel_npu/src/common/src/device_helpers.cpp
@@ -71,6 +71,141 @@ std::shared_ptr<IDevice> utils::getDeviceById(const ov::SoPtr<IEngineBackend>& e
return nullptr;
}
+std::string utils::getFullDeviceName(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device) {
+ return device->getFullDeviceName();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
+std::string utils::getDeviceArchitecture(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ return getPlatformByDeviceName(devName);
+}
+
+IDevice::Uuid utils::getDeviceUuid(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ const auto deviceToUse = getDeviceById(engineBackend, devName);
+ if (deviceToUse) {
+ return deviceToUse->getUuid();
+ }
+
+ return IDevice::Uuid{};
+}
+
+ov::device::LUID utils::getDeviceLUID(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device) {
+ return device->getLUID();
+ }
+
+ return ov::device::LUID{{
+ 0,
+ }};
+}
+
+uint32_t utils::getSteppingNumber(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device) {
+ return device->getSubDevId();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
+uint32_t utils::getMaxTiles(const ov::SoPtr<IEngineBackend>& engineBackend, const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device) {
+ return device->getMaxNumSlices();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
+uint64_t utils::getDeviceAllocMemSize(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device) {
+ return device->getAllocMemSize();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
+uint64_t utils::getDeviceTotalMemSize(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device) {
+ return device->getTotalMemSize();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
+std::string utils::getDeviceName(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ // In case of single device and empty input from user we should use the first element from the device list
+ if (specifiedDeviceName.empty()) {
+ std::vector<std::string> devNames;
+ if (engineBackend == nullptr || (devNames = engineBackend->getDeviceNames()).empty()) {
+ OPENVINO_THROW("No available devices");
+ }
+ if (devNames.size() >= 1) {
+ return devNames[0];
+ } else {
+ OPENVINO_THROW("The device name was not specified. Please specify device name by providing DEVICE_ID");
+ }
+ }
+
+ return specifiedDeviceName;
+}
+
+ov::device::PCIInfo utils::getPciInfo(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device != nullptr) {
+ return device->getPciInfo();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
+std::map<ov::element::Type, float> utils::getGops(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device != nullptr) {
+ return device->getGops();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
+ov::device::Type utils::getDeviceType(const ov::SoPtr<IEngineBackend>& engineBackend,
+ const std::string& specifiedDeviceName) {
+ const auto devName = getDeviceName(engineBackend, specifiedDeviceName);
+ auto device = getDeviceById(engineBackend, devName);
+ if (device != nullptr) {
+ return device->getDeviceType();
+ }
+
+ OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
+}
+
uint32_t utils::getOptimalNumberOfInferRequestsInParallel(std::string_view platform,
const ov::hint::PerformanceMode performanceMode) {
if (performanceMode != ov::hint::PerformanceMode::THROUGHPUT) {
diff --git a/src/plugins/intel_npu/src/plugin/include/metrics.hpp b/src/plugins/intel_npu/src/plugin/include/metrics.hpp
deleted file mode 100644
index 6dfd9dea40f..00000000000
--- a/src/plugins/intel_npu/src/plugin/include/metrics.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#pragma once
-
-#include <string>
-#include <unordered_set>
-#include <vector>
-
-#include "intel_npu/common/npu.hpp"
-#include "intel_npu/npu_private_properties.hpp"
-#include "openvino/runtime/intel_npu/properties.hpp"
-#include "openvino/runtime/internal_properties.hpp"
-#include "openvino/runtime/properties.hpp"
-
-namespace intel_npu {
-
-class Metrics final {
-public:
- Metrics(const ov::SoPtr<IEngineBackend>& backend) : _backend(backend) {};
-
- std::vector<std::string> GetAvailableDevicesNames() const;
- std::string GetFullDeviceName(const std::string& specifiedDeviceName) const;
- IDevice::Uuid GetDeviceUuid(const std::string& specifiedDeviceName) const;
- ov::device::LUID GetDeviceLUID(const std::string& specifiedDeviceName) const;
- const std::vector<std::string> GetOptimizationCapabilities() const;
- const std::tuple<uint32_t, uint32_t, uint32_t>& GetRangeForAsyncInferRequest() const;
- const std::tuple<uint32_t, uint32_t>& GetRangeForStreams() const;
- std::string GetDeviceArchitecture(const std::string& specifiedDeviceName) const;
- std::string GetBackendName() const;
- uint64_t GetDeviceAllocMemSize(const std::string& specifiedDeviceName) const;
- uint64_t GetDeviceTotalMemSize(const std::string& specifiedDeviceName) const;
- uint32_t GetDriverVersion() const;
- uint32_t GetGraphExtVersion() const;
- uint32_t GetSteppingNumber(const std::string& specifiedDeviceName) const;
- uint32_t GetMaxTiles(const std::string& specifiedDeviceName) const;
- ov::device::PCIInfo GetPciInfo(const std::string& specifiedDeviceName) const;
- std::map<ov::element::Type, float> GetGops(const std::string& specifiedDeviceName) const;
- ov::device::Type GetDeviceType(const std::string& specifiedDeviceName) const;
- bool IsCommandQueueExtSupported() const;
-
- ~Metrics() = default;
-
-private:
- const ov::SoPtr<IEngineBackend> _backend;
- static constexpr uint32_t _maxNumOfOptimalInferRequests = 8u;
- const std::vector<std::string> _optimizationCapabilities = {
- ov::device::capability::FP16,
- ov::device::capability::INT8,
- ov::device::capability::EXPORT_IMPORT,
- };
-
- // Metric to provide a hint for a range for number of async infer requests. (bottom bound, upper bound, step)
- const std::tuple<uint32_t, uint32_t, uint32_t> _rangeForAsyncInferRequests{1u, _maxNumOfOptimalInferRequests, 1u};
-
- // Metric to provide information about a range for streams.(bottom bound, upper bound)
- const std::tuple<uint32_t, uint32_t> _rangeForStreams{0u, _maxNumOfOptimalInferRequests};
-
- std::string getDeviceName(const std::string& specifiedDeviceName) const;
- std::shared_ptr<intel_npu::IDevice> getDevice(const std::string& specifiedDeviceName) const;
-};
-
-} // namespace intel_npu
diff --git a/src/plugins/intel_npu/src/plugin/include/plugin_property_manager.hpp b/src/plugins/intel_npu/src/plugin/include/plugin_property_manager.hpp
index 3f77b711db0..5d632c00965 100644
--- a/src/plugins/intel_npu/src/plugin/include/plugin_property_manager.hpp
+++ b/src/plugins/intel_npu/src/plugin/include/plugin_property_manager.hpp
@@ -12,19 +12,16 @@
#include "intel_npu/common/filtered_config.hpp"
#include "intel_npu/common/icompiler_adapter.hpp"
+#include "intel_npu/common/npu.hpp"
#include "intel_npu/config/npuw.hpp"
#include "intel_npu/utils/logger/logger.hpp"
-#include "metrics.hpp"
#include "property_registration.hpp"
namespace intel_npu {
class PluginPropertyManager final {
public:
- PluginPropertyManager(const FilteredConfig& config,
- const std::shared_ptr<Metrics>& metrics,
- const ov::SoPtr<IEngineBackend>& backend,
- Logger& logger);
+ PluginPropertyManager(const FilteredConfig& config, const ov::SoPtr<IEngineBackend>& backend, Logger& logger);
PluginPropertyManager& operator=(const PluginPropertyManager& other) = delete;
@@ -47,7 +44,6 @@ private:
PluginPropertyManager(const PluginPropertyManager& other);
struct CopyState {
FilteredConfig config;
- std::shared_ptr<Metrics> metrics;
ov::SoPtr<IEngineBackend> backend;
Logger& logger;
ov::intel_npu::CompilerType currentlyUsedCompiler;
@@ -66,7 +62,6 @@ private:
mutable FilteredConfig _config;
- std::shared_ptr<Metrics> _metrics;
ov::SoPtr<IEngineBackend> _backend;
Logger& _logger;
diff --git a/src/plugins/intel_npu/src/plugin/sources.cmake b/src/plugins/intel_npu/src/plugin/sources.cmake
index 36d7624502e..3b06312172a 100644
--- a/src/plugins/intel_npu/src/plugin/sources.cmake
+++ b/src/plugins/intel_npu/src/plugin/sources.cmake
@@ -9,7 +9,6 @@ set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/include/compiled_model_property_manager.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/executor.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/metadata.hpp
- ${CMAKE_CURRENT_SOURCE_DIR}/include/metrics.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/plugin.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/plugin_property_manager.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/property_registration.hpp
@@ -22,7 +21,6 @@ set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/executor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/extension.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/metadata.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/src/metrics.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin_property_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/remote_context.cpp
diff --git a/src/plugins/intel_npu/src/plugin/src/metrics.cpp b/src/plugins/intel_npu/src/plugin/src/metrics.cpp
deleted file mode 100644
index 58506a06337..00000000000
--- a/src/plugins/intel_npu/src/plugin/src/metrics.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-// Plugin
-#include "metrics.hpp"
-
-#include "intel_npu/common/device_helpers.hpp"
-#include "intel_npu/npu_private_properties.hpp"
-#include "openvino/runtime/intel_npu/properties.hpp"
-
-namespace intel_npu {
-
-std::vector<std::string> Metrics::GetAvailableDevicesNames() const {
- return _backend == nullptr ? std::vector<std::string>() : _backend->getDeviceNames();
-}
-
-std::string Metrics::GetFullDeviceName(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = _backend->getDevice(devName);
- if (device) {
- return device->getFullDeviceName();
- }
-
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-const std::vector<std::string> Metrics::GetOptimizationCapabilities() const {
- return _optimizationCapabilities;
-}
-
-const std::tuple<uint32_t, uint32_t, uint32_t>& Metrics::GetRangeForAsyncInferRequest() const {
- return _rangeForAsyncInferRequests;
-}
-
-const std::tuple<uint32_t, uint32_t>& Metrics::GetRangeForStreams() const {
- return _rangeForStreams;
-}
-
-std::string Metrics::GetDeviceArchitecture(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- return utils::getPlatformByDeviceName(devName);
-}
-
-IDevice::Uuid Metrics::GetDeviceUuid(const std::string& specifiedDeviceName) const {
- const auto& devName = getDeviceName(specifiedDeviceName);
- const auto& deviceToUse = getDevice(devName);
- if (deviceToUse) {
- return deviceToUse->getUuid();
- }
- return IDevice::Uuid{};
-}
-
-ov::device::LUID Metrics::GetDeviceLUID(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device) {
- return device->getLUID();
- }
- return ov::device::LUID{{
- 0,
- }};
-}
-
-std::string Metrics::GetBackendName() const {
- if (_backend == nullptr) {
- OPENVINO_THROW("No available backend");
- }
-
- return _backend->getName();
-}
-
-uint32_t Metrics::GetDriverVersion() const {
- if (_backend == nullptr) {
- OPENVINO_THROW("No available backend");
- }
-
- return _backend->getDriverVersion();
-}
-
-uint32_t Metrics::GetGraphExtVersion() const {
- if (_backend == nullptr) {
- OPENVINO_THROW("No available backend");
- }
-
- return _backend->getGraphExtVersion();
-}
-
-uint32_t Metrics::GetSteppingNumber(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device) {
- return device->getSubDevId();
- }
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-uint32_t Metrics::GetMaxTiles(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device) {
- return device->getMaxNumSlices();
- }
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-uint64_t Metrics::GetDeviceAllocMemSize(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device) {
- return device->getAllocMemSize();
- }
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-uint64_t Metrics::GetDeviceTotalMemSize(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device) {
- return device->getTotalMemSize();
- }
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-std::string Metrics::getDeviceName(const std::string& specifiedDeviceName) const {
- // In case of single device and empty input from user we should use the first element from the device list
- if (specifiedDeviceName.empty()) {
- std::vector<std::string> devNames;
- if (_backend == nullptr || (devNames = _backend->getDeviceNames()).empty()) {
- OPENVINO_THROW("No available devices");
- }
- if (devNames.size() >= 1) {
- return devNames[0];
- } else {
- OPENVINO_THROW("The device name was not specified. Please specify device name by providing DEVICE_ID");
- }
- }
-
- return specifiedDeviceName;
-}
-
-std::shared_ptr<intel_npu::IDevice> Metrics::getDevice(const std::string& specifiedDeviceName) const {
- std::shared_ptr<IDevice> deviceToUse;
-
- if (_backend != nullptr) {
- if (specifiedDeviceName.empty()) {
- return _backend->getDevice();
- } else {
- return _backend->getDevice(specifiedDeviceName);
- }
- }
-
- return nullptr;
-}
-
-ov::device::PCIInfo Metrics::GetPciInfo(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device != nullptr) {
- return device->getPciInfo();
- }
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-std::map<ov::element::Type, float> Metrics::GetGops(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device != nullptr) {
- return device->getGops();
- }
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-ov::device::Type Metrics::GetDeviceType(const std::string& specifiedDeviceName) const {
- const auto devName = getDeviceName(specifiedDeviceName);
- auto device = getDevice(devName);
- if (device != nullptr) {
- return device->getDeviceType();
- }
- OPENVINO_THROW("No device with name '", specifiedDeviceName, "' is available");
-}
-
-bool Metrics::IsCommandQueueExtSupported() const {
- if (_backend == nullptr) {
- OPENVINO_THROW("No available backend");
- }
- return _backend->isCommandQueueExtSupported();
-}
-
-} // namespace intel_npu
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin.cpp b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
index 69c5847181c..438c70791e0 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin.cpp
@@ -18,7 +18,6 @@
#include "intel_npu/config/npuw.hpp"
#include "intel_npu/config/options.hpp"
#include "intel_npu/utils/utils.hpp"
-#include "metrics.hpp"
#include "npuw/compiled_model.hpp"
#include "npuw/gqa_compiled_model.hpp"
#include "npuw/llm_compiled_model.hpp"
@@ -359,12 +358,9 @@ Plugin::Plugin() : _logger("NPUPlugin", Logger::global().level()) {
_backend->registerOptions(*options);
}
- OV_ITT_TASK_NEXT(PLUGIN, "CreateMetrics");
- auto metrics = std::make_shared<Metrics>(_backend);
-
/// Init and register properties
OV_ITT_TASK_NEXT(PLUGIN, "RegisterProperties");
- _propertiesManager = std::make_unique<PluginPropertyManager>(config, metrics, _backend, _logger);
+ _propertiesManager = std::make_unique<PluginPropertyManager>(config, _backend, _logger);
}
void Plugin::set_property(const ov::AnyMap& properties) {
diff --git a/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp b/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp
index af5bc1bd62c..cbd35d71ade 100644
--- a/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp
@@ -8,6 +8,7 @@
#include <optional>
#include <tuple>
#include <utility>
+#include <vector>
#include "intel_npu/common/compiler_adapter_factory.hpp"
#include "intel_npu/common/device_helpers.hpp"
@@ -17,6 +18,20 @@
namespace {
+constexpr uint32_t maxNumOfOptimalInferRequests = 8u;
+
+const std::vector<std::string> optimizationCapabilities = {
+ ov::device::capability::FP16,
+ ov::device::capability::INT8,
+ ov::device::capability::EXPORT_IMPORT,
+};
+
+// Provides a hint for a range for number of async infer requests (bottom bound, upper bound, step)
+const std::tuple<uint32_t, uint32_t, uint32_t> rangeForAsyncInferRequests{1u, maxNumOfOptimalInferRequests, 1u};
+
+// Provides information about a range for streams (bottom bound, upper bound)
+const std::tuple<uint32_t, uint32_t> rangeForStreams{0u, maxNumOfOptimalInferRequests};
+
std::map<std::string, std::string> any_copy(const ov::AnyMap& params) {
std::map<std::string, std::string> result;
for (auto&& value : params) {
@@ -158,6 +173,10 @@ void exclude_model_ptr_from_map(ov::AnyMap& properties) {
}
}
+std::vector<std::string> getAvailableDevicesNames(const ov::SoPtr<intel_npu::IEngineBackend>& backend) {
+ return backend == nullptr ? std::vector<std::string>() : backend->getDeviceNames();
+}
+
bool isCompatibilityCheckSupported(const ov::SoPtr<intel_npu::IEngineBackend>& backend) {
using namespace intel_npu;
@@ -238,11 +257,9 @@ ov::CompatibilityCheck validateCompatibilityDescriptor(const ov::SoPtr<intel_npu
namespace intel_npu {
PluginPropertyManager::PluginPropertyManager(const FilteredConfig& config,
- const std::shared_ptr<Metrics>& metrics,
const ov::SoPtr<IEngineBackend>& backend,
Logger& logger)
: _config(config),
- _metrics(metrics),
_backend(backend),
_logger(logger) {
registerProperties();
@@ -252,7 +269,6 @@ PluginPropertyManager::PluginPropertyManager(const PluginPropertyManager& other)
: PluginPropertyManager([&other]() {
std::lock_guard<std::mutex> lock(other._mutex);
return CopyState{other._config,
- other._metrics,
other._backend,
other._logger,
other._currentlyUsedCompiler,
@@ -265,7 +281,6 @@ PluginPropertyManager::PluginPropertyManager(const PluginPropertyManager& other)
PluginPropertyManager::PluginPropertyManager(CopyState&& state)
: _config(std::move(state.config)),
- _metrics(std::move(state.metrics)),
_backend(std::move(state.backend)),
_logger(state.logger),
_currentlyUsedCompiler(state.currentlyUsedCompiler),
@@ -332,9 +347,9 @@ void PluginPropertyManager::registerProperties() const {
if (!config.has<STEPPING>()) {
try {
const auto specifiedDeviceName = get_specified_device_name(config);
- return static_cast<int64_t>(_metrics->GetSteppingNumber(specifiedDeviceName));
+ return static_cast<int64_t>(utils::getSteppingNumber(_backend, specifiedDeviceName));
} catch (...) {
- _logger.warning("Metrics GetSteppingNumber failed to get value from device.");
+ _logger.warning("getSteppingNumber failed to get value from device.");
}
}
return config.get<STEPPING>();
@@ -343,9 +358,9 @@ void PluginPropertyManager::registerProperties() const {
if (!config.has<MAX_TILES>()) {
try {
const auto specifiedDeviceName = get_specified_device_name(config);
- return static_cast<int64_t>(_metrics->GetMaxTiles(specifiedDeviceName));
+ return static_cast<int64_t>(utils::getMaxTiles(_backend, specifiedDeviceName));
} catch (...) {
- _logger.warning("Metrics GetMaxTiles failed to get value from device.");
+ _logger.warning("getMaxTiles failed to get value from device.");
}
}
return config.get<MAX_TILES>();
@@ -376,61 +391,66 @@ void PluginPropertyManager::registerProperties() const {
});
// clang-format off
- if (_metrics != nullptr) {
- register_property_with_custom_function(_properties, ov::available_devices.name(), true, [&](const Config&) {
- return _metrics->GetAvailableDevicesNames();
- });
- register_property_with_custom_function(_properties, ov::device::capabilities.name(), true, [&](const Config&) {
- return _metrics->GetOptimizationCapabilities();
- });
- register_property_with_custom_function(_properties, ov::range_for_async_infer_requests.name(), true, [&](const Config&) {
- return _metrics->GetRangeForAsyncInferRequest();
- });
- register_property_with_custom_function(_properties, ov::range_for_streams.name(), true, [&](const Config&) {
- return _metrics->GetRangeForStreams();
- });
- register_property_with_custom_function(_properties, ov::device::pci_info.name(), true, [&](const Config& config) {
- return _metrics->GetPciInfo(get_specified_device_name(config));
- });
- register_property_with_custom_function(_properties, ov::device::gops.name(), true, [&](const Config& config) {
- return _metrics->GetGops(get_specified_device_name(config));
- });
- register_property_with_custom_function(_properties, ov::device::type.name(), true, [&](const Config& config) {
- return _metrics->GetDeviceType(get_specified_device_name(config));
- });
- register_property_with_custom_function(_properties, ov::intel_npu::device_alloc_mem_size.name(), true, [&](const Config& config) {
- return _metrics->GetDeviceAllocMemSize(get_specified_device_name(config));
- });
- register_property_with_custom_function(_properties, ov::intel_npu::device_total_mem_size.name(), true, [&](const Config& config) {
- return _metrics->GetDeviceTotalMemSize(get_specified_device_name(config));
- });
- register_property_with_custom_function(_properties, ov::intel_npu::driver_version.name(), true, [&](const Config&) {
- return _metrics->GetDriverVersion();
- });
- register_property_with_custom_function(_properties, ov::device::uuid.name(), true, [&](const Config& config) {
- auto devUuid = _metrics->GetDeviceUuid(get_specified_device_name(config));
- return decltype(ov::device::uuid)::value_type{devUuid};
- });
- register_property_with_custom_function(_properties, ov::device::luid.name(), _backend == nullptr ? false : _backend->isLUIDExtSupported(), [&](const Config& config) {
- return _metrics->GetDeviceLUID(get_specified_device_name(config));
- });
- register_property_with_custom_function(_properties, ov::execution_devices.name(), true, [&](const Config& config) {
- if (_metrics->GetAvailableDevicesNames().size() > 1) {
- return std::string("NPU." + config.get<DEVICE_ID>());
- }
- return std::string("NPU");
- });
- register_property_with_custom_function(_properties, ov::intel_npu::backend_name.name(), false, [&](const Config&) {
- return _metrics->GetBackendName();
- });
-
- try_register_property_with_custom_function(_properties, ov::device::architecture.name(), !_metrics->GetAvailableDevicesNames().empty(), true, [&](const Config& config) {
- return _metrics->GetDeviceArchitecture(get_specified_device_name(config));
- });
- try_register_property_with_custom_function(_properties, ov::device::full_name.name(), !_metrics->GetAvailableDevicesNames().empty(), true, [&](const Config& config) {
- return _metrics->GetFullDeviceName(get_specified_device_name(config));
- });
- }
+ register_property_with_custom_function(_properties, ov::available_devices.name(), true, [&](const Config&) {
+ return getAvailableDevicesNames(_backend);
+ });
+ register_property_with_custom_function(_properties, ov::device::capabilities.name(), true, [&](const Config&) {
+ return optimizationCapabilities;
+ });
+ register_property_with_custom_function(_properties, ov::range_for_async_infer_requests.name(), true, [&](const Config&) {
+ return rangeForAsyncInferRequests;
+ });
+ register_property_with_custom_function(_properties, ov::range_for_streams.name(), true, [&](const Config&) {
+ return rangeForStreams;
+ });
+ register_property_with_custom_function(_properties, ov::device::pci_info.name(), true, [&](const Config& config) {
+ return utils::getPciInfo(_backend, get_specified_device_name(config));
+ });
+ register_property_with_custom_function(_properties, ov::device::gops.name(), true, [&](const Config& config) {
+ return utils::getGops(_backend, get_specified_device_name(config));
+ });
+ register_property_with_custom_function(_properties, ov::device::type.name(), true, [&](const Config& config) {
+ return utils::getDeviceType(_backend, get_specified_device_name(config));
+ });
+ register_property_with_custom_function(_properties, ov::intel_npu::device_alloc_mem_size.name(), true, [&](const Config& config) {
+ return utils::getDeviceAllocMemSize(_backend, get_specified_device_name(config));
+ });
+ register_property_with_custom_function(_properties, ov::intel_npu::device_total_mem_size.name(), true, [&](const Config& config) {
+ return utils::getDeviceTotalMemSize(_backend, get_specified_device_name(config));
+ });
+ register_property_with_custom_function(_properties, ov::intel_npu::driver_version.name(), true, [&](const Config&) {
+ if (_backend == nullptr) {
+ OPENVINO_THROW("No available backend");
+ }
+
+ return _backend->getDriverVersion();
+ });
+ register_property_with_custom_function(_properties, ov::device::uuid.name(), true, [&](const Config& config) {
+ auto devUuid = utils::getDeviceUuid(_backend, get_specified_device_name(config));
+ return decltype(ov::device::uuid)::value_type{devUuid};
+ });
+ register_property_with_custom_function(_properties, ov::device::luid.name(), _backend == nullptr ? false : _backend->isLUIDExtSupported(), [&](const Config& config) {
+ return utils::getDeviceLUID(_backend, get_specified_device_name(config));
+ });
+ register_property_with_custom_function(_properties, ov::execution_devices.name(), true, [&](const Config& config) {
+ if (getAvailableDevicesNames(_backend).size() > 1) {
+ return std::string("NPU." + config.get<DEVICE_ID>());
+ }
+ return std::string("NPU");
+ });
+ register_property_with_custom_function(_properties, ov::intel_npu::backend_name.name(), false, [&](const Config&) {
+ if (_backend == nullptr) {
+ OPENVINO_THROW("No available backend");
+ }
+ return _backend->getName();
+ });
+
+ try_register_property_with_custom_function(_properties, ov::device::architecture.name(), !getAvailableDevicesNames(_backend).empty(), true, [&](const Config& config) {
+ return utils::getDeviceArchitecture(_backend, get_specified_device_name(config));
+ });
+ try_register_property_with_custom_function(_properties, ov::device::full_name.name(), !getAvailableDevicesNames(_backend).empty(), true, [&](const Config& config) {
+ return utils::getFullDeviceName(_backend, get_specified_device_name(config));
+ });
register_property_with_custom_function(_properties, ov::hint::model.name(), true, [](const Config&) {
return std::shared_ptr<const ov::Model>(nullptr);
diff --git a/src/plugins/intel_npu/tests/functional/CMakeLists.txt b/src/plugins/intel_npu/tests/functional/CMakeLists.txt
index 1b33742934a..27e896eef1f 100644
--- a/src/plugins/intel_npu/tests/functional/CMakeLists.txt
+++ b/src/plugins/intel_npu/tests/functional/CMakeLists.txt
@@ -50,7 +50,6 @@ ov_add_test_target(
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/plugin_property_manager.cpp"
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/remote_context.cpp"
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/transformations.cpp"
- "${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/metrics.cpp"
"${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/executor.cpp"
LINK_LIBRARIES
${OPTIONAL_FUNC_TESTS_LIBS}
diff --git a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
index d34a86af42c..cf7a1816963 100644
--- a/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
+++ b/src/plugins/intel_npu/tests/functional/internal/plugin/test_properties.hpp
@@ -25,7 +25,6 @@
#include "intel_npu/config/options.hpp"
#include "intel_npu/npu_private_properties.hpp"
#include "intel_npu/npuw_private_properties.hpp"
-#include "metrics.hpp"
#include "openvino/core/any.hpp"
#include "openvino/core/log.hpp"
#include "openvino/runtime/core.hpp"
@@ -79,7 +78,6 @@ public:
OVPluginTestBase::SetUp();
backend = ov::SoPtr<IEngineBackend>(std::make_shared<ZeroEngineBackend>());
- auto metrics = std::make_shared<Metrics>(backend);
options->reset();
@@ -182,7 +180,7 @@ public:
}
propertiesManager =
- std::make_unique<PluginPropertyManager>(npu_config, metrics, backend, ::intel_npu::Logger::global());
+ std::make_unique<PluginPropertyManager>(npu_config, backend, ::intel_npu::Logger::global());
}
void TearDown() override {