Skip to content

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

[AUTO] Model compilation device selection per device utilization (#36745)

Wang, Yangbdce5c164e15
diff --git a/.gitmodules b/.gitmodules
index 347326835c7..178d8e17768 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -91,6 +91,9 @@
[submodule "src/plugins/intel_cpu/thirdparty/xbyak_riscv"]
path = src/plugins/intel_cpu/thirdparty/xbyak_riscv
url = https://github.com/herumi/xbyak_riscv.git
+[submodule "src/plugins/auto/thirdparty/ipf"]
+ path = src/plugins/auto/thirdparty/ipf
+ url = https://github.com/intel/ipf.git
[submodule "thirdparty/liburing/liburing"]
path = thirdparty/liburing/liburing
url = https://github.com/axboe/liburing.git
diff --git a/cmake/features.cmake b/cmake/features.cmake
index 0dafba18ec8..681b69e0585 100644
--- a/cmake/features.cmake
+++ b/cmake/features.cmake
@@ -222,6 +222,8 @@ ov_option(ENABLE_OPENVINO_DEBUG "Enable output for OPENVINO_DEBUG statements" OF
ov_dependent_option(ENABLE_IO_URING "Enables io_uring feature" OFF "LINUX" OFF)
+ov_dependent_option (ENABLE_IPF_CLIENT_API "Enable IPF ClientApi integration for AUTO device telemetry" ON "MSVC;ENABLE_AUTO" OFF)
+
if(NOT BUILD_SHARED_LIBS AND ENABLE_OV_TF_FRONTEND)
set(FORCE_FRONTENDS_USE_PROTOBUF ON)
else()
diff --git a/cmake/toolchains/mt.runtime.win32.toolchain.cmake b/cmake/toolchains/mt.runtime.win32.toolchain.cmake
index b9dc428a7b1..1b5ead8b86a 100644
--- a/cmake/toolchains/mt.runtime.win32.toolchain.cmake
+++ b/cmake/toolchains/mt.runtime.win32.toolchain.cmake
@@ -67,6 +67,10 @@ ov_set_msvc_runtime(CLDNN__COMPILE_LINK_USE_STATIC_RUNTIME ${use_static_runtime}
ov_set_msvc_runtime(USE_DYNAMIC_VCXX_RUNTIME ${use_dynamic_runtime})
# google-test
ov_set_msvc_runtime(gtest_force_shared_crt ${use_dynamic_runtime})
+# AUTO plugin IPF telemetry client (ClientApi is only built against dynamic CRT)
+if(use_static_runtime)
+ ov_set_msvc_runtime(ENABLE_IPF_CLIENT_API OFF)
+endif()
unset(use_static_runtime)
unset(use_dynamic_runtime)
diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
index 38aa50d7f6c..d6de8ec96b1 100644
--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp
@@ -339,6 +339,7 @@ void regmodule_properties(py::module m) {
wrap_property_RW(m_intel_auto, ov::intel_auto::enable_startup_fallback, "enable_startup_fallback");
wrap_property_RW(m_intel_auto, ov::intel_auto::enable_runtime_fallback, "enable_runtime_fallback");
wrap_property_RW(m_intel_auto, ov::intel_auto::schedule_policy, "schedule_policy");
+ wrap_property_RW(m_intel_auto, ov::intel_auto::devices_utilization_threshold, "devices_utilization_threshold");
// Submodule npu
py::module m_intel_npu =
diff --git a/src/bindings/python/src/pyopenvino/utils/utils.cpp b/src/bindings/python/src/pyopenvino/utils/utils.cpp
index 4b1a2669dcd..ffc107d0345 100644
--- a/src/bindings/python/src/pyopenvino/utils/utils.cpp
+++ b/src/bindings/python/src/pyopenvino/utils/utils.cpp
@@ -184,6 +184,10 @@ py::object from_ov_any(const ov::Any& any) {
else if (any.is<std::map<std::string, std::string>>()) {
return py::cast(any.as<std::map<std::string, std::string>>());
}
+ // Check for std::map<std::string, unsigned>
+ else if (any.is<std::map<std::string, unsigned>>()) {
+ return py::cast(any.as<std::map<std::string, unsigned>>());
+ }
// Check for std::map<std::string, int>
else if (any.is<std::map<std::string, int>>()) {
return py::cast(any.as<std::map<std::string, int>>());
@@ -333,6 +337,31 @@ std::map<std::string, ov::Any> properties_to_any_map(const std::map<std::string,
} else if (property.first == ov::hint::model.name()) {
auto model = Common::utils::convert_to_model(property.second);
properties_to_cpp[property.first] = std::static_pointer_cast<const ov::Model>(model);
+ } else if (property.first == ov::intel_auto::devices_utilization_threshold.name() &&
+ py::isinstance<py::dict>(property.second)) {
+ std::map<std::string, unsigned> thresholds;
+ auto dict = py::cast<py::dict>(property.second);
+ for (const auto& item : dict) {
+ if (!py::isinstance<py::str>(item.first)) {
+ OPENVINO_THROW("The key type of ",
+ ov::intel_auto::devices_utilization_threshold.name(),
+ " should be dict[str, int in [0, 100]] with string keys");
+ }
+ if (!py::isinstance<py::int_>(item.second) || py::isinstance<py::bool_>(item.second)) {
+ OPENVINO_THROW("The value type of ",
+ ov::intel_auto::devices_utilization_threshold.name(),
+ " should be dict[str, int in [0, 100]] with integer values");
+ }
+ const auto key = py::str(item.first).cast<std::string>();
+ const auto value = py::cast<long long>(item.second);
+ if (value < 0 || value > 100) {
+ OPENVINO_THROW("The value type of ",
+ ov::intel_auto::devices_utilization_threshold.name(),
+ " should be dict[str, int in [0, 100]]");
+ }
+ thresholds[key] = static_cast<unsigned>(value);
+ }
+ properties_to_cpp[property.first] = thresholds;
} else {
properties_to_cpp[property.first] = Common::utils::py_object_to_any(property.second);
}
diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.py
index 1ae6bcb78b3..a14e067787a 100644
--- a/src/bindings/python/tests/test_runtime/test_properties.py
+++ b/src/bindings/python/tests/test_runtime/test_properties.py
@@ -592,6 +592,29 @@ def test_properties_device_properties():
"GPU": {"INFERENCE_PRECISION_HINT": Type.f16, "NUM_STREAMS": streams.Num(1)}})
+def test_properties_devices_utilization_threshold():
+ # Assert the property name is correctly registered
+ assert intel_auto.devices_utilization_threshold == "DEVICES_UTILIZATION_THRESHOLD"
+
+ def check(value1, value2):
+ ret = intel_auto.devices_utilization_threshold(value1)
+ assert ret[0] == "DEVICES_UTILIZATION_THRESHOLD"
+ assert ret[1].value == value2
+
+ # Test cases for different input formats and expected outputs
+ check({"GPU": 88}, {"GPU": 88})
+ check({"CPU": 75, "GPU": 88}, {"CPU": 75, "GPU": 88})
+ with pytest.raises(TypeError) as e:
+ value = {"GPU": "75"}
+ intel_auto.devices_utilization_threshold(value)
+ assert "incompatible function arguments" in str(e.value)
+
+ with pytest.raises(TypeError) as e:
+ value = {23: "CPU"}
+ intel_auto.devices_utilization_threshold(value)
+ assert "incompatible function arguments" in str(e.value)
+
+
def test_properties_streams():
# Test extra Num class
assert streams.Num().to_integer() == -1
diff --git a/src/inference/include/openvino/runtime/auto/properties.hpp b/src/inference/include/openvino/runtime/auto/properties.hpp
index 6f2d9113708..eb6415aae11 100644
--- a/src/inference/include/openvino/runtime/auto/properties.hpp
+++ b/src/inference/include/openvino/runtime/auto/properties.hpp
@@ -74,5 +74,12 @@ inline std::istream& operator>>(std::istream& is, SchedulePolicy& policy) {
* @ingroup ov_runtime_cpp_prop_api
*/
static constexpr Property<SchedulePolicy> schedule_policy{"SCHEDULE_POLICY"};
+
+/**
+ * @brief Device utilization thresholds (in percent) used by AUTO for device selection.
+ * @ingroup ov_runtime_cpp_prop_api
+ */
+static constexpr Property<std::map<std::string, unsigned>> devices_utilization_threshold{
+ "DEVICES_UTILIZATION_THRESHOLD"};
} // namespace intel_auto
} // namespace ov
\ No newline at end of file
diff --git a/src/plugins/auto/CMakeLists.txt b/src/plugins/auto/CMakeLists.txt
index 575d0a5abf6..6f578744479 100644
--- a/src/plugins/auto/CMakeLists.txt
+++ b/src/plugins/auto/CMakeLists.txt
@@ -10,6 +10,8 @@ set (TARGET_NAME "openvino_auto_plugin")
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/*.cpp)
+# Build the optional IPF telemetry client used by the device utilization monitor.
+add_subdirectory(thirdparty)
# WA for issue 141313
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
ov_add_compiler_flags(-Wno-stringop-overflow)
@@ -43,6 +45,21 @@ endif()
find_package(Threads REQUIRED)
target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads)
+# Enable the IPF-backed device utilization monitor when IPF was built.
+# ClientApi is linked as an ordinary DLL import library and called only through its
+# plain-C ABI (ClientApiC.h). No IPF-compiled objects are embedded into this plugin,
+# so ${TARGET_NAME} keeps following OpenVINO's normal /MD (Release) or /MDd (Debug)
+# convention regardless of IPF's own (fixed /MD) runtime library choice.
+if(TARGET openvino::ipf_client_api)
+ target_compile_definitions(${TARGET_NAME} PRIVATE OV_AUTO_ENABLE_IPF ClientApi_IMPORTS)
+ target_link_libraries(${TARGET_NAME} PRIVATE openvino::ipf_client_api)
+ target_include_directories(${TARGET_NAME} SYSTEM PRIVATE
+ $<TARGET_PROPERTY:nlohmann_json::nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>)
+ message(STATUS "[AUTO] IPF support successfully enabled for ${TARGET_NAME}")
+else()
+ message(STATUS "[AUTO] IPF support disabled")
+endif()
+
ov_set_threading_interface_for(${TARGET_NAME})
# must be called after all target_link_libraries
diff --git a/src/plugins/auto/src/auto_schedule.cpp b/src/plugins/auto/src/auto_schedule.cpp
index ed5bb2f0184..962b3e50f57 100644
--- a/src/plugins/auto/src/auto_schedule.cpp
+++ b/src/plugins/auto/src/auto_schedule.cpp
@@ -53,7 +53,8 @@ bool AutoSchedule::select_other_device(const std::string& cur_dev_name) {
m_compile_context[FALLBACKDEVICE].m_device_info =
m_plugin->select_device(m_context->m_device_priorities,
m_compile_context[FALLBACKDEVICE].m_model_precision,
- m_context->m_model_priority);
+ m_context->m_model_priority,
+ m_context->m_utilization_thresholds);
try {
m_compile_context[FALLBACKDEVICE].m_task();
// FALLBACKDEVICE need to be load again if infer failed, so reset promise here
@@ -96,7 +97,8 @@ void AutoSchedule::init() {
m_compile_context[ACTUALDEVICE].m_device_info =
m_plugin->select_device(m_context->m_device_priorities,
m_compile_context[ACTUALDEVICE].m_model_precision,
- m_context->m_model_priority);
+ m_context->m_model_priority,
+ m_context->m_utilization_thresholds);
auto load_device_task = [&](AutoCompileContext* context_ptr, const std::shared_ptr<ov::Model>& model) {
try_to_compile_model(*context_ptr, model);
@@ -365,8 +367,10 @@ void AutoSchedule::try_to_compile_model(AutoCompileContext& context, const std::
try {
std::lock_guard<std::mutex> lock(m_context->m_mutex);
context.m_device_info = m_plugin->select_device(device_list,
- context.m_model_precision, m_context->m_model_priority);
- } catch (const std::exception&) {
+ context.m_model_precision,
+ m_context->m_model_priority,
+ m_context->m_utilization_thresholds);
+ } catch (const ov::Exception&) {
return;
}
// if the select device is CPU, need to check the config of m_compile_context[CPU]
diff --git a/src/plugins/auto/src/common.hpp b/src/plugins/auto/src/common.hpp
index 7649a3cc25d..9e3db79163d 100644
--- a/src/plugins/auto/src/common.hpp
+++ b/src/plugins/auto/src/common.hpp
@@ -222,6 +222,7 @@ public:
std::mutex m_fallback_mutex;
SoCompiledModel m_hw_compiled_model;
std::string m_model_precision;
+ std::unordered_map<std::string, unsigned> m_utilization_thresholds;
// hold the resource of static variable to avoid the unexpected destruction.
std::shared_ptr<std::mutex> m_mtx;
std::shared_ptr<std::map<unsigned int, std::list<std::string>>> m_priority_map;
diff --git a/src/plugins/auto/src/plugin.cpp b/src/plugins/auto/src/plugin.cpp
index 373b5c8ca83..6e7a471d239 100644
--- a/src/plugins/auto/src/plugin.cpp
+++ b/src/plugins/auto/src/plugin.cpp
@@ -3,30 +3,31 @@
//
///////////////////////////////////////////////////////////////////////////////////////////////////
-#include <string>
-#include <vector>
-#include <memory>
+#include "plugin.hpp"
+
#include <map>
+#include <memory>
+#include <string>
+#include <transformations/utils/utils.hpp>
#include <unordered_map>
#include <unordered_set>
+#include <vector>
-#include <transformations/utils/utils.hpp>
-
+#include "auto_compiled_model.hpp"
+#include "auto_schedule.hpp"
+#include "cumulative_compiled_model.hpp"
+#include "cumulative_schedule.hpp"
+#include "itt.hpp"
+#include "utils/device_telemetry.hpp"
#include "openvino/op/convolution.hpp"
#include "openvino/op/fake_quantize.hpp"
#include "openvino/op/group_conv.hpp"
#include "openvino/runtime/auto/properties.hpp"
+#include "openvino/runtime/compilation_context.hpp"
#include "openvino/runtime/device_id_parser.hpp"
#include "openvino/runtime/internal_properties.hpp"
#include "openvino/runtime/iremote_context.hpp"
-#include "openvino/runtime/compilation_context.hpp"
#include "openvino/util/file_util.hpp"
-#include "plugin.hpp"
-#include "auto_schedule.hpp"
-#include "auto_compiled_model.hpp"
-#include "cumulative_compiled_model.hpp"
-#include "cumulative_schedule.hpp"
-#include "itt.hpp"
namespace {
const std::string get_model_precision(const std::shared_ptr<const ov::Model> &model) {
@@ -479,6 +480,11 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model_impl(const std::filesy
}
LOG_INFO_TAG("device:%s, priority:%ld", iter->device_name.c_str(), iter->device_priority);
}
+ auto device_utilization_thresholds = load_config.get_property(ov::intel_auto::devices_utilization_threshold);
+ if (!device_utilization_thresholds.empty()) {
+ auto_s_context->m_utilization_thresholds.insert(device_utilization_thresholds.begin(),
+ device_utilization_thresholds.end());
+ }
auto_s_context->m_startup_fallback = load_config.get_property(ov::intel_auto::enable_startup_fallback);
auto_s_context->m_runtime_fallback = load_config.get_property(ov::intel_auto::enable_runtime_fallback);
// in case of mismatching shape conflict when AUTO creates the infer requests for actual device with reshaped model
@@ -571,14 +577,30 @@ ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr<const ov::Model>&
return res;
}
-std::list<DeviceInformation> Plugin::get_valid_device(
- const std::vector<DeviceInformation>& meta_devices,
- const std::string& model_precision) const {
+std::optional<float> Plugin::get_device_utilization(const std::string& device_name,
+ const std::string& device_type) {
+ std::call_once(m_telemetry_client_init_once, [this]() {
+ m_telemetry_client = std::make_unique<device_monitor::TelemetryClient>();
+ });
+ auto result = m_telemetry_client->utilization(device_name, device_type);
+ if (result.has_value()) {
+ LOG_DEBUG_TAG("[IPF] Device %s utilization: %s",
+ device_name.c_str(),
+ std::to_string(result.value()).c_str());
+ } else {
+ LOG_DEBUG_TAG("[IPF] Device %s utilization query failed/unavailable", device_name.c_str());
+ }
+ return result;
+}
+
+std::list<DeviceInformation> Plugin::get_valid_device(const std::vector<DeviceInformation>& meta_devices,
+ const std::string& model_precision) const {
if (meta_devices.empty()) {
OPENVINO_THROW("No available device to select in ", get_device_name());
}
bool is_default_list = true;
std::list<DeviceInformation> valid_devices;
+ std::list<DeviceInformation> valid_filtered_devices;
std::list<DeviceInformation> CPU;
std::list<DeviceInformation> dGPU;
std::list<DeviceInformation> iGPU;
@@ -588,7 +610,7 @@ std::list<DeviceInformation> Plugin::get_valid_device(
std::vector<std::string> capability;
try {
capability = get_core()->get_property(device_name, ov::device::capabilities);
- } catch (std::exception&) {
+ } catch (const ov::Exception&) {
LOG_DEBUG_TAG("cannot get device capabity from device: %s", device_name.c_str());
}
auto support_model = std::find(capability.begin(), capability.end(), (model_precision));
@@ -596,13 +618,14 @@ std::list<DeviceInformation> Plugin::get_valid_device(
model_precision == "FP32" && std::find(capability.begin(), capability.end(), ("FP16")) != capability.end();
return support_model != capability.end() || is_support_fp16;
};
-
for (auto&& device_info : meta_devices) {
if (device_info.device_priority > 0)
is_default_list = false;
// check if device support this model precision
if (!is_supported_model(device_info.device_name) && meta_devices.size() > 1)
continue;
+
+ valid_filtered_devices.push_back(device_info);
if (device_info.device_name.find("CPU") == 0) {
CPU.push_back(device_info);
} else if (device_info.device_name.find("GPU") == 0) {
@@ -638,22 +661,30 @@ std::list<DeviceInformation> Plugin::get_valid_device(
if (is_default_list) {
// Generate the default device priority for selecting logic of AUTO.
// Default priority of selecting device: dGPU > iGPU > 3rd part devices > CPU
- valid_devices.clear();
- valid_devices.splice(valid_devices.end(), dGPU);
- valid_devices.splice(valid_devices.end(), iGPU);
- valid_devices.splice(valid_devices.end(), Others);
- valid_devices.splice(valid_devices.end(), CPU);
- return valid_devices;
+ std::list<DeviceInformation> default_valid_devices;
+ default_valid_devices.splice(default_valid_devices.end(), dGPU);
+ default_valid_devices.splice(default_valid_devices.end(), iGPU);
+ default_valid_devices.splice(default_valid_devices.end(), Others);
+ default_valid_devices.splice(default_valid_devices.end(), CPU);
+ return default_valid_devices.empty() ? (valid_filtered_devices.empty() ? valid_devices : valid_filtered_devices)
+ : default_valid_devices;
}
- // sort validDevices
- valid_devices.sort([](const DeviceInformation& a, const DeviceInformation& b) {
+ auto compare_by_priority = [](const DeviceInformation& a, const DeviceInformation& b) {
return a.device_priority < b.device_priority;
- });
- return valid_devices;
+ };
+ // sort validDevices
+ valid_devices.sort(compare_by_priority);
+ if (valid_filtered_devices.empty())
+ return valid_devices;
+
+ valid_filtered_devices.sort(compare_by_priority);
+ return valid_filtered_devices;
}
DeviceInformation Plugin::select_device(const std::vector<DeviceInformation>& meta_devices,
- const std::string& model_precision, unsigned int priority) {
+ const std::string& model_precision,
+ unsigned int priority,
+ const std::unordered_map<std::string, unsigned>& utilization_thresholds) {
OV_ITT_SCOPED_TASK(itt::domains::AutoPlugin, "Plugin::SelectDevice");
std::list<DeviceInformation> valid_devices = get_valid_device(meta_devices, model_precision);
@@ -686,14 +717,79 @@ DeviceInformation Plugin::select_device(const std::vector<DeviceInformation>& me
}
}
- DeviceInformation* ptr_select_device = NULL;
+ DeviceInformation* ptr_select_device = nullptr;
if (valid_devices.empty()) {
// after remove higher priority device,but the available devices is null,
// so select the last device of all available Devices.
ptr_select_device = &last_device;
} else {
+ // select the higher priority device in case all of device utilization is exceeded the threshold.
+ last_device = valid_devices.front();
+ }
+ for (const auto& item : utilization_thresholds)
+ LOG_DEBUG_TAG("Device: %s. Utilization threshold: %s", item.first.c_str(), std::to_string(item.second).c_str());
+ while (!ptr_select_device) {
// select the first device in the rest of available devices.
- ptr_select_device = &valid_devices.front();
+ if (valid_devices.empty()) {
+ // after remove higher priority device,but the available devices is null,
+ // so select the last device of all available Devices.
+ ptr_select_device = &last_device;
+ } else {
+ auto device = &valid_devices.front();
+ bool is_excluded = false;
+ // check utilization here.
+ ov::DeviceIDParser parsed{device->device_name};
+ unsigned device_utilization_threshold = 0;
+ bool has_device_utilization_threshold = false;
+ if (!utilization_thresholds.empty()) {
+ const auto exact_it = utilization_thresholds.find(device->device_name);
+ if (exact_it != utilization_thresholds.end()) {
+ device_utilization_threshold = exact_it->second;
+ has_device_utilization_threshold = true;
+ } else {
+ const auto base_it = utilization_thresholds.find(parsed.get_device_name());
+ if (base_it != utilization_thresholds.end()) {
+ device_utilization_threshold = base_it->second;
+ has_device_utilization_threshold = true;
+ }
+ }
+ }
+
+ if (has_device_utilization_threshold) {
+ std::string device_type;
+ if (parsed.get_device_name() == "GPU") {
+ try {
+ device_type = get_core()
+ ->get_property(device->device_name, ov::device::type.name(), {})
+ .as<std::string>();
+ } catch (const ov::Exception&) {
+ device_type = "";
+ }
+ }
+ const auto device_utilization = get_device_utilization(device->device_name, device_type);
+ if (!device_utilization.has_value()) {
+ LOG_DEBUG_TAG("Cannot get utilization for %s. Will keep it in the list",
+ device->device_name.c_str());
+ } else {
+ LOG_DEBUG_TAG("Device: %s\tutilization: %s",
+ device->device_name.c_str(),
+ std::to_string(device_utilization.value()).c_str());
+ if (device_utilization.value() >= device_utilization_threshold) {
+ is_excluded = true;
+ LOG_DEBUG_TAG("[%s] Current utilization [%s] exceeds the threshold[%s]",
+ device->device_name.c_str(),
+ std::to_string(device_utilization.value()).c_str(),
+ std::to_string(device_utilization_threshold).c_str());
+ }
+ }
+ }
+ if (is_excluded) {
+ // Remove the excluded candidate at the front in O(1).
+ valid_devices.erase(valid_devices.begin());
+ } else {
+ ptr_select_device = device;
+ }
+ }
}
//recode the device priority
register_priority(priority, ptr_select_device->unique_name);
diff --git a/src/plugins/auto/src/plugin.hpp b/src/plugins/auto/src/plugin.hpp
index e6e2629da0b..a31cc5a5873 100644
--- a/src/plugins/auto/src/plugin.hpp
+++ b/src/plugins/auto/src/plugin.hpp
@@ -6,16 +6,20 @@
#pragma once
#include <filesystem>
+#include <list>
#include <map>
-#include <vector>
+#include <mutex>
+#include <optional>
#include <string>
-#include <list>
+#include <unordered_map>
+#include <vector>
-#include "openvino/runtime/iplugin.hpp"
-#include "utils/log_util.hpp"
#include "common.hpp"
-#include "plugin_config.hpp"
#include "compiled_model.hpp"
+#include "openvino/runtime/iplugin.hpp"
+#include "plugin_config.hpp"
+#include "utils/device_telemetry.hpp"
+#include "utils/log_util.hpp"
namespace ov {
namespace auto_plugin {
@@ -53,9 +57,11 @@ public:
MOCKTESTMACRO std::list<DeviceInformation> get_valid_device(const std::vector<DeviceInformation>& meta_devices,
const std::string& model_precision = "FP32") const;
- MOCKTESTMACRO DeviceInformation select_device(const std::vector<DeviceInformation>& meta_devices,
- const std::string& model_precision = "FP32",
- unsigned int priority = 0);
+ MOCKTESTMACRO DeviceInformation
+ select_device(const std::vector<DeviceInformation>& meta_devices,
+ const std::string& model_precision = "FP32",
+ unsigned int priority = 0,
+ const std::unordered_map<std::string, unsigned>& utilization_thresholds = {});
void unregister_priority(const unsigned int& priority, const std::string& device_name);
void register_priority(const unsigned int& priority, const std::string& device_name);
@@ -70,6 +76,8 @@ public:
std::shared_ptr<ov::ICompiledModel> import_model(std::istream& model,
const ov::SoPtr<ov::IRemoteContext>& context,
const ov::AnyMap& properties) const override;
+ MOCKTESTMACRO std::optional<float> get_device_utilization(const std::string& device_name,
+ const std::string& device_type = "");
std::shared_ptr<ov::ICompiledModel> import_model(const ov::Tensor& model,
const ov::AnyMap& properties) const override;
@@ -92,6 +100,8 @@ private:
static std::shared_ptr<std::mutex> m_mtx;
static std::shared_ptr<std::map<unsigned int, std::list<std::string>>> m_priority_map;
PluginConfig m_plugin_config;
+ std::once_flag m_telemetry_client_init_once;
+ std::unique_ptr<device_monitor::TelemetryClient> m_telemetry_client;
};
} // namespace auto_plugin
diff --git a/src/plugins/auto/src/plugin_config.cpp b/src/plugins/auto/src/plugin_config.cpp
index 2c3579511c4..9e85b2c35b9 100644
--- a/src/plugins/auto/src/plugin_config.cpp
+++ b/src/plugins/auto/src/plugin_config.cpp
@@ -27,6 +27,7 @@ void PluginConfig::set_default() {
std::make_tuple(ov::hint::num_requests, 0, UnsignedTypeValidator()),
std::make_tuple(ov::intel_auto::enable_startup_fallback, true),
std::make_tuple(ov::intel_auto::enable_runtime_fallback, true),
+ std::make_tuple(ov::intel_auto::devices_utilization_threshold, std::map<std::string, unsigned>{}, DeviceUtilizationThresholdValidator()),
// RO for register only
std::make_tuple(ov::device::full_name),
std::make_tuple(ov::device::capabilities),
diff --git a/src/plugins/auto/src/plugin_config.hpp b/src/plugins/auto/src/plugin_config.hpp
index fe6a4380b0e..11da1369077 100644
--- a/src/plugins/auto/src/plugin_config.hpp
+++ b/src/plugins/auto/src/plugin_config.hpp
@@ -49,7 +49,27 @@ public:
return true;
else
throw std::logic_error("wrong val");
- } catch (std::exception&) {
+ } catch (const ov::Exception&) {
+ return false;
+ } catch (const std::exception&) {
+ return false;
+ }
+ }
+};
+
+class DeviceUtilizationThresholdValidator : public BaseValidator {
+public:
+ bool is_valid(const ov::Any& v) const override {
+ try {
+ const auto& threshold_map = v.as<std::map<std::string, unsigned>>();
+ // Validate that all threshold values are in range [0, 100]
+ for (const auto& [device, value] : threshold_map) {
+ if (value > 100) {
+ return false;
+ }
+ }
+ return true;
+ } catch (const ov::Exception&) {
return false;
}
}
@@ -153,6 +173,9 @@ public:
multi_supported_configKeys.erase(std::remove(
multi_supported_configKeys.begin(), multi_supported_configKeys.end(), ov::intel_auto::enable_runtime_fallback.name()),
multi_supported_configKeys.end());
+ multi_supported_configKeys.erase(std::remove(
+ multi_supported_configKeys.begin(), multi_supported_configKeys.end(), ov::intel_auto::devices_utilization_threshold.name()),
+ multi_supported_configKeys.end());
return plugin_name == "AUTO" ? supported_configKeys : multi_supported_configKeys;
}
@@ -168,6 +191,10 @@ public:
multi_supported_properties.erase(std::remove(
multi_supported_properties.begin(), multi_supported_properties.end(), ov::intel_auto::enable_runtime_fallback),
multi_supported_properties.end());
+ multi_supported_properties.erase(std::remove(multi_supported_properties.begin(),
+ multi_supported_properties.end(),
+ ov::intel_auto::devices_utilization_threshold),
+ multi_supported_properties.end());
return plugin_name == "AUTO" ? supported_properties : multi_supported_properties;
}
diff --git a/src/plugins/auto/src/utils/device_telemetry.cpp b/src/plugins/auto/src/utils/device_telemetry.cpp
new file mode 100644
index 00000000000..866e2540962
--- /dev/null
+++ b/src/plugins/auto/src/utils/device_telemetry.cpp
@@ -0,0 +1,147 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "device_telemetry.hpp"
+
+#ifdef OV_AUTO_ENABLE_IPF
+
+# include <cmath>
+# include <vector>
+
+# include "ClientApiC.h"
+# include "log_util.hpp"
+# include "nlohmann/json.hpp"
+
+namespace ov {
+namespace auto_plugin {
+namespace device_monitor {
+
+inline std::string get_log_tag() {
+ return "[IPF]";
+}
+
+// Calls into ClientApi.dll through the plain-C ABI (ClientApiC.h).
+class TelemetryClient::Impl {
+public:
+ Impl() {
+ const ipf_err_t status = IpfCreate(nullptr, &m_handle);
+ if (status != IpfError::IPF_ERR_OK) {
+ m_handle = nullptr;
+ LOG_WARNING_TAG("TelemetryClient: IPF ClientApi initialization failed: %s", ipf_ef_error_str(status));
+ } else {
+ LOG_INFO_TAG("TelemetryClient: IPF ClientApi initialized successfully");
+ }
+ }
+
+ ~Impl() {
+ if (m_handle != nullptr) {
+ IpfDestroy(m_handle);
+ m_handle = nullptr;
+ }
+ }
+
+ std::optional<float> utilization(const std::string& device_name, const std::string& device_type) {
+ if (m_handle == nullptr) {
+ LOG_DEBUG_TAG("TelemetryClient::utilization(%s): client not initialized", device_name.c_str());
+ return std::nullopt;
+ }
+ const auto metric_key_view = device_to_metric_key(device_name, device_type);
+ if (metric_key_view.empty()) {
+ LOG_WARNING_TAG("TelemetryClient::utilization(%s): unknown device type, metric_key empty", device_name.c_str());
+ return std::nullopt;
+ }
+ const std::string metric_key{metric_key_view};
+ LOG_DEBUG_TAG("TelemetryClient::utilization(%s): querying IPF for metric_key=%s", device_name.c_str(), metric_key.c_str());
+ const std::string json_str = get_node("Platform.Features.AISelector");
+ if (json_str.empty()) {
+ return std::nullopt;
+ }
+ try {
+ LOG_DEBUG_TAG("TelemetryClient: raw IPF response: %s", json_str.c_str());
+ const auto parsed = nlohmann::json::parse(json_str);
+ if (!parsed.contains("Performance")) {
+ LOG_WARNING_TAG("TelemetryClient: JSON missing 'Performance' section");
+ return std::nullopt;
+ }
+ if (!parsed["Performance"].contains(metric_key)) {
+ LOG_WARNING_TAG("TelemetryClient: Performance section missing key: %s", metric_key.c_str());
+ return std::nullopt;
+ }
+ float value = parsed["Performance"][metric_key].get<float>();
+ const std::string value_as_string = std::to_string(value);
+ LOG_DEBUG_TAG("TelemetryClient: parsed utilization=%s for device=%s",
+ value_as_string.c_str(),
+ device_name.c_str());
+ if (!std::isfinite(value) || value < 0.0f || value > 100.0f) {
+ LOG_WARNING_TAG("TelemetryClient: utilization value out of supported range [0,100], value=%s for device=%s",
+ value_as_string.c_str(),
+ device_name.c_str());
+ return std::nullopt;
+ }
+
+ return value;
+ } catch (const nlohmann::json::exception& e) {
+ LOG_DEBUG_TAG("TelemetryClient: JSON parsing exception: %s", e.what());
+ return std::nullopt;
+ }
+ }
+
+private:
+ // Query IPF node data with the two-call buffer-size protocol.
+ std::string get_node(const char* path) {
+ size_t len = 0;
+ ipf_err_t status = IpfGetNode(m_handle, path, nullptr, &len);
+ if (status != IpfError::IPF_ERR_BUFFERTOOSMALL || len == 0) {
+ LOG_WARNING_TAG("TelemetryClient: IpfGetNode(%s) size query failed: %s", path, ipf_ef_error_str(status));
+ return {};
+ }
+ std::vector<char> buf(len);
+ status = IpfGetNode(m_handle, path, buf.data(), &len);
+ if (status != IpfError::IPF_ERR_OK) {
+ LOG_WARNING_TAG("TelemetryClient: IpfGetNode(%s) failed: %s", path, ipf_ef_error_str(status));
+ return {};
+ }
+ std::string result(buf.data(), len);
+ if (!result.empty() && result.back() == '\0') {
+ result.pop_back();
+ }
+ return result;
+ }
+
+ void* m_handle = nullptr;
+};
+
+TelemetryClient::TelemetryClient() : m_impl(std::make_unique<Impl>()) {}
+
+TelemetryClient::~TelemetryClient() = default;
+
+std::optional<float> TelemetryClient::utilization(const std::string& device_name, const std::string& device_type) {
+ return m_impl->utilization(device_name, device_type);
+}
+
+} // namespace device_monitor
+} // namespace auto_plugin
+} // namespace ov
+
+#else // OV_AUTO_ENABLE_IPF
+
+namespace ov {
+namespace auto_plugin {
+namespace device_monitor {
+
+class TelemetryClient::Impl {};
+
+TelemetryClient::TelemetryClient() : m_impl(nullptr) {}
+
+TelemetryClient::~TelemetryClient() = default;
+
+std::optional<float> TelemetryClient::utilization(const std::string&, const std::string&) {
+ return std::nullopt;
+}
+
+} // namespace device_monitor
+} // namespace auto_plugin
+} // namespace ov
+
+#endif // OV_AUTO_ENABLE_IPF
diff --git a/src/plugins/auto/src/utils/device_telemetry.hpp b/src/plugins/auto/src/utils/device_telemetry.hpp
new file mode 100644
index 00000000000..b3e498451c3
--- /dev/null
+++ b/src/plugins/auto/src/utils/device_telemetry.hpp
@@ -0,0 +1,59 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <memory>
+#include <optional>
+#include <string>
+#include <string_view>
+
+#include "../common.hpp"
+
+namespace ov {
+namespace auto_plugin {
+namespace device_monitor {
+
+class TelemetryClient {
+public:
+ TelemetryClient();
+ ~TelemetryClient();
+
+ std::optional<float> utilization(const std::string& device_name, const std::string& device_type = "");
+
+private:
+ class Impl;
+ std::unique_ptr<Impl> m_impl;
+};
+
+inline constexpr std::string_view k_cpu_utilization_metric = "CPUUtilization";
+inline constexpr std::string_view k_igpu_utilization_metric = "IGPUUtilization";
+inline constexpr std::string_view k_dgpu_utilization_metric = "DGPUUtilization";
+inline constexpr std::string_view k_npu_utilization_metric = "NPUUtilization";
+
+inline constexpr bool has_prefix(std::string_view value, std::string_view prefix) {
+ return value.size() >= prefix.size() && value.compare(0, prefix.size(), prefix) == 0;
+}
+
+// CPU -> CPUUtilization; GPU(integrated/discrete) -> IGPU/DGPU; NPU -> NPUUtilization.
+inline constexpr std::string_view device_to_metric_key(std::string_view device_name,
+ std::string_view device_type = {}) {
+ std::string_view metric_key;
+ if (has_prefix(device_name, "CPU")) {
+ metric_key = k_cpu_utilization_metric;
+ } else if (has_prefix(device_name, "GPU")) {
+ if (device_type == "integrated") {
+ metric_key = k_igpu_utilization_metric;
+ } else if (device_type == "discrete") {
+ metric_key = k_dgpu_utilization_metric;
+ }
+ } else if (has_prefix(device_name, "NPU")) {
+ metric_key = k_npu_utilization_metric;
+ }
+ return metric_key;
+}
+
+} // namespace device_monitor
+} // namespace auto_plugin
+} // namespace ov
diff --git a/src/plugins/auto/tests/unit/auto_unit_test.cpp b/src/plugins/auto/tests/unit/auto_unit_test.cpp
index 06864441901..7a22c0f9217 100644
--- a/src/plugins/auto/tests/unit/auto_unit_test.cpp
+++ b/src/plugins/auto/tests/unit/auto_unit_test.cpp
@@ -120,8 +120,9 @@ ov::mock_auto_plugin::tests::BaseTest::BaseTest(const MODELTYPE modelType) {
ON_CALL(*plugin, select_device)
.WillByDefault([this](const std::vector<DeviceInformation>& metaDevices,
const std::string& netPrecision,
- unsigned int priority) {
- return plugin->Plugin::select_device(metaDevices, netPrecision, priority);
+ unsigned int priority,
+ const std::unordered_map<std::string, unsigned>& utilization_thresholds) {
+ return plugin->Plugin::select_device(metaDevices, netPrecision, priority, utilization_thresholds);
});
ON_CALL(*plugin, get_valid_device)
@@ -129,6 +130,15 @@ ov::mock_auto_plugin::tests::BaseTest::BaseTest(const MODELTYPE modelType) {
std::list<DeviceInformation> devices(metaDevices.begin(), metaDevices.end());
return devices;
});
+
+ ON_CALL(*plugin, get_property).WillByDefault([this](const std::string& name, const ov::AnyMap& arguments) {
+ return plugin->Plugin::get_property(name, arguments);
+ });
+
+ ON_CALL(*plugin, get_device_utilization)
+ .WillByDefault([](const std::string& device_name, const std::string& device_type) -> std::optional<float> {
+ return std::nullopt;
+ });
}
ov::mock_auto_plugin::tests::BaseTest::~BaseTest() {
diff --git a/src/plugins/auto/tests/unit/compile_model_metric_test.cpp b/src/plugins/auto/tests/unit/compile_model_metric_test.cpp
index 305a30811a2..433fae80a52 100644
--- a/src/plugins/auto/tests/unit/compile_model_metric_test.cpp
+++ b/src/plugins/auto/tests/unit/compile_model_metric_test.cpp
@@ -186,7 +186,7 @@ TEST_P(ExecNetworkget_propertyOptimalNumInferReq, OPTIMAL_NUMBER_OF_INFER_REQUES
metaDevices.push_back({actualDeviceName, metaConfig, actualCustomerNum, ""});
ON_CALL(*core, get_property(_, StrEq(ov::compilation_num_threads.name()), _)).WillByDefault(Return(8));
}
- ON_CALL(*plugin, select_device(_, _, _)).WillByDefault(Return(metaDevices[1]));
+ ON_CALL(*plugin, select_device(_, _, _, _)).WillByDefault(Return(metaDevices[1]));
ON_CALL(*plugin, parse_meta_devices(_, _)).WillByDefault(Return(metaDevices));
ON_CALL(*plugin, get_valid_device)
.WillByDefault([](const std::vector<DeviceInformation>& metaDevices, const std::string& netPrecision) {
@@ -194,7 +194,7 @@ TEST_P(ExecNetworkget_propertyOptimalNumInferReq, OPTIMAL_NUMBER_OF_INFER_REQUES
return devices;
});
EXPECT_CALL(*plugin, parse_meta_devices(_, _)).Times(1);
- EXPECT_CALL(*plugin, select_device(_, _, _)).Times(1);
+ EXPECT_CALL(*plugin, select_device(_, _, _, _)).Times(1);
if (cpuSleep) {
ON_CALL(*core,
@@ -375,7 +375,7 @@ TEST_P(ExecNetworkGetMetricOtherTest, modelPriority_perfHint_exclusiveAsyncReq_t
metaDevices.push_back(
{actualDeviceName, {ov::hint::performance_mode(performanceHint.as<ov::hint::PerformanceMode>())}, 2, ""});
- ON_CALL(*plugin, select_device(_, _, _)).WillByDefault(Return(metaDevices[1]));
+ ON_CALL(*plugin, select_device(_, _, _, _)).WillByDefault(Return(metaDevices[1]));
ON_CALL(*plugin, parse_meta_devices(_, _)).WillByDefault(Return(metaDevices));
ON_CALL(*plugin, get_valid_device)
.WillByDefault([](const std::vector<DeviceInformation>& metaDevices, const std::string& netPrecision) {
@@ -383,7 +383,7 @@ TEST_P(ExecNetworkGetMetricOtherTest, modelPriority_perfHint_exclusiveAsyncReq_t
return devices;
});
EXPECT_CALL(*plugin, parse_meta_devices(_, _)).Times(1);
- EXPECT_CALL(*plugin, select_device(_, _, _)).Times(1);
+ EXPECT_CALL(*plugin, select_device(_, _, _, _)).Times(1);
ON_CALL(*core, get_property(_, StrEq(ov::compilation_num_threads.name()), _)).WillByDefault(Return(8));
ON_CALL(*core,
diff --git a/src/plugins/auto/tests/unit/device_telemetry_test.cpp b/src/plugins/auto/tests/unit/device_telemetry_test.cpp
new file mode 100644
index 00000000000..bf3abf7e384
--- /dev/null
+++ b/src/plugins/auto/tests/unit/device_telemetry_test.cpp
@@ -0,0 +1,77 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include <algorithm>
+#include <optional>
+#include <sstream>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include "utils/device_telemetry.hpp"
+
+using namespace ov::auto_plugin;
+
+// Parameters: OpenVINO device name, expected telemetry metric key.
+using DeviceMonitorKeyParams = std::tuple<std::string, // device name
+ std::string, // device type
+ std::string // expected metric key
+ >;
+
+class DeviceMonitorKeyTest : public ::testing::TestWithParam<DeviceMonitorKeyParams> {
+public:
+ static std::string getTestCaseName(const testing::TestParamInfo<DeviceMonitorKeyParams>& obj) {
+ const auto& [device_name, device_type, expected_key] = obj.param;
+ std::ostringstream result;
+ std::string sanitized = device_name.empty() ? "empty" : device_name;
+ std::replace(sanitized.begin(), sanitized.end(), '.', '_');
+ result << "device_" << sanitized << "_type_" << (device_type.empty() ? "none" : device_type) << "_key_"
+ << (expected_key.empty() ? "none" : expected_key);
+ return result.str();
+ }
+};
+
+TEST_P(DeviceMonitorKeyTest, maps_device_name_to_metric_key) {
+ const auto& [device_name, device_type, expected_key] = GetParam();
+ EXPECT_EQ(device_monitor::device_to_metric_key(device_name, device_type), expected_key);
+}
+
+const std::vector<DeviceMonitorKeyParams> deviceMonitorKeyConfigs = {
+ DeviceMonitorKeyParams{"CPU", "", "CPUUtilization"},
+ DeviceMonitorKeyParams{"GPU", "integrated", "IGPUUtilization"},
+ DeviceMonitorKeyParams{"GPU", "discrete", "DGPUUtilization"},
+ DeviceMonitorKeyParams{"GPU.0", "integrated", "IGPUUtilization"},
+ DeviceMonitorKeyParams{"GPU.1", "discrete", "DGPUUtilization"},
+ DeviceMonitorKeyParams{"GPU", "", ""},
+ DeviceMonitorKeyParams{"NPU", "", "NPUUtilization"},
+ DeviceMonitorKeyParams{"UNKNOWN", "", ""},
+ DeviceMonitorKeyParams{"", "", ""}};
+
+INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
+ DeviceMonitorKeyTest,
+ ::testing::ValuesIn(deviceMonitorKeyConfigs),
+ DeviceMonitorKeyTest::getTestCaseName);
+
+// TelemetryClient::utilization must never throw and must return a value within
+// [0.0, 100.0] when available, or std::nullopt otherwise. On builds without the
+// telemetry backend it consistently returns std::nullopt.
+TEST(DeviceMonitorTest, telemetry_client_utilization_is_safe) {
+ device_monitor::TelemetryClient client;
+ std::optional<float> utilization;
+ ASSERT_NO_THROW(utilization = client.utilization("CPU"));
+ if (utilization.has_value()) {
+ EXPECT_GE(utilization.value(), 0.0f);
+ EXPECT_LE(utilization.value(), 100.0f);
+ }
+}
+
+TEST(DeviceMonitorTest, telemetry_client_unknown_device_returns_nullopt) {
+ device_monitor::TelemetryClient client;
+ std::optional<float> utilization;
+ ASSERT_NO_THROW(utilization = client.utilization("UNKNOWN_DEVICE"));
+ EXPECT_FALSE(utilization.has_value());
+}
diff --git a/src/plugins/auto/tests/unit/get_device_list.cpp b/src/plugins/auto/tests/unit/get_device_list.cpp
index 92df244f6b9..913be546426 100644
--- a/src/plugins/auto/tests/unit/get_device_list.cpp
+++ b/src/plugins/auto/tests/unit/get_device_list.cpp
@@ -3,6 +3,7 @@
//
#include "include/auto_unit_test.hpp"
+#include "openvino/runtime/internal_properties.hpp"
using Config = std::map<std::string, std::string>;
using namespace ov::mock_auto_plugin;
@@ -196,4 +197,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests_GetDeviceListNotInteldGPU,
GetDeviceListTestWithNotInteldGPU::getTestCaseName);
// toDo need add test for ParseMetaDevices(_, config) to check device config of
-// return metaDevices
+// return metaDevices
\ No newline at end of file
diff --git a/src/plugins/auto/tests/unit/include/gmock_plugin.hpp b/src/plugins/auto/tests/unit/include/gmock_plugin.hpp
index a516468c049..710829fb69a 100644
--- a/src/plugins/auto/tests/unit/include/gmock_plugin.hpp
+++ b/src/plugins/auto/tests/unit/include/gmock_plugin.hpp
@@ -17,6 +17,11 @@ namespace mock_auto_plugin {
class MockAutoPlugin : public Plugin {
public:
+ MOCK_METHOD((ov::Any), get_property, ((const std::string&), (const ov::AnyMap&)), (const, override));
+ MOCK_METHOD((std::optional<float>),
+ get_device_utilization,
+ ((const std::string&), (const std::string&)),
+ (override));
MOCK_METHOD((std::string),
get_device_list,
((ov::AnyMap&), const std::shared_ptr<const ov::Model>&, const std::filesystem::path&),
@@ -28,7 +33,10 @@ public:
(const, override));
MOCK_METHOD(DeviceInformation,
select_device,
- ((const std::vector<DeviceInformation>&), const std::string&, unsigned int),
+ ((const std::vector<DeviceInformation>&),
+ const std::string&,
+ unsigned int,
+ (const std::unordered_map<std::string, unsigned>&)),
(override));
MOCK_METHOD((std::vector<DeviceInformation>),
parse_meta_devices,
diff --git a/src/plugins/auto/tests/unit/key_network_priority_test.cpp b/src/plugins/auto/tests/unit/key_network_priority_test.cpp
index 6892c2d4795..89352d5b3a8 100644
--- a/src/plugins/auto/tests/unit/key_network_priority_test.cpp
+++ b/src/plugins/auto/tests/unit/key_network_priority_test.cpp
@@ -75,11 +75,11 @@ TEST_P(KeyNetworkPriorityTest, SelectDevice) {
{"OTHER", {}, 2, "01", "OTHER_01", 0}};
}
- EXPECT_CALL(*plugin, select_device(_, _, _)).Times(sizeOfConfigs);
+ EXPECT_CALL(*plugin, select_device(_, _, _, _)).Times(sizeOfConfigs);
EXPECT_CALL(*core, get_property(_, _, _)).Times(AtLeast(sizeOfConfigs * 4));
for (auto& item : PriorityConfigs) {
- resDevInfo.push_back(plugin->select_device(metaDevices, netPrecision, std::get<0>(item)));
+ resDevInfo.push_back(plugin->select_device(metaDevices, netPrecision, std::get<0>(item), {}));
}
for (int i = 0; i < sizeOfConfigs; i++) {
EXPECT_EQ(resDevInfo[i].unique_name, std::get<1>(PriorityConfigs[i]));
@@ -101,14 +101,14 @@ TEST_P(KeyNetworkPriorityTest, MultiThreadsSelectDevice) {
{"GPU.1", {}, 2, "01", "dGPU_01", 0},
{"OTHER", {}, 2, "01", "OTHER_01", 0}};
}
- EXPECT_CALL(*plugin, select_device(_, _, _)).Times(sizeOfConfigs * 2);
+ EXPECT_CALL(*plugin, select_device(_, _, _, _)).Times(sizeOfConfigs * 2);
EXPECT_CALL(*core, get_property(_, _, _)).Times(AtLeast(sizeOfConfigs * 4 * 2));
// selectdevice in multi threads, and UnregisterPriority them all, should not affect the
// Priority Map
for (auto& item : PriorityConfigs) {
unsigned int priority = std::get<0>(item);
auto future = std::async(std::launch::async, [this, priority] {
- auto deviceInfo = plugin->select_device(metaDevices, netPrecision, priority);
+ auto deviceInfo = plugin->select_device(metaDevices, netPrecision, priority, {});
plugin->unregister_priority(priority, deviceInfo.unique_name);
});
futureVect.push_back(std::move(future));
@@ -119,7 +119,7 @@ TEST_P(KeyNetworkPriorityTest, MultiThreadsSelectDevice) {
}
for (auto& item : PriorityConfigs) {
- resDevInfo.push_back(plugin->select_device(metaDevices, netPrecision, std::get<0>(item)));
+ resDevInfo.push_back(plugin->select_device(metaDevices, netPrecision, std::get<0>(item), {}));
}
for (int i = 0; i < sizeOfConfigs; i++) {
EXPECT_EQ(resDevInfo[i].unique_name, std::get<1>(PriorityConfigs[i]));
diff --git a/src/plugins/auto/tests/unit/release_helper_test.cpp b/src/plugins/auto/tests/unit/release_helper_test.cpp
index a738725328c..62e80e2fa1f 100644
--- a/src/plugins/auto/tests/unit/release_helper_test.cpp
+++ b/src/plugins/auto/tests/unit/release_helper_test.cpp
@@ -121,9 +121,9 @@ TEST_P(AutoCompiledModelGetPropertyWithReleaseHelper, getPropertyTestAfterReleas
std::list<DeviceInformation> devices(metaDevices.begin(), metaDevices.end());
return devices;
});
- ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(2)), _, _))
+ ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(2)), _, _, _))
.WillByDefault(Return(metaDevices[1]));
- ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(1)), _, _))
+ ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(1)), _, _, _))
.WillByDefault(Return(metaDevices[0]));
config.insert(ov::device::priorities(ov::test::utils::DEVICE_CPU + std::string(",") + ov::test::utils::DEVICE_GPU));
std::shared_ptr<ov::ICompiledModel> exeNetwork;
@@ -203,9 +203,9 @@ TEST_P(AutoReleaseHelperTest, releaseResource) {
std::list<DeviceInformation> devices(metaDevices.begin(), metaDevices.end());
return devices;
});
- ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(2)), _, _))
+ ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(2)), _, _, _))
.WillByDefault(Return(metaDevices[1]));
- ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(1)), _, _))
+ ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(1)), _, _, _))
.WillByDefault(Return(metaDevices[0]));
config.insert(ov::device::priorities(ov::test::utils::DEVICE_CPU + std::string(",") + ov::test::utils::DEVICE_GPU));
std::shared_ptr<ov::ICompiledModel> exeNetwork;
diff --git a/src/plugins/auto/tests/unit/select_device_failed_test.cpp b/src/plugins/auto/tests/unit/select_device_failed_test.cpp
index c2ff6acee82..f525586db70 100644
--- a/src/plugins/auto/tests/unit/select_device_failed_test.cpp
+++ b/src/plugins/auto/tests/unit/select_device_failed_test.cpp
@@ -125,7 +125,7 @@ TEST_P(AutoLoadFailedTest, LoadCNNetWork) {
// set the return value of SelectDevice
// for example if there are three device, if will return GPU on the first call, and then NPU
// at last CPU
- ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(selDevsSize)), _, _))
+ ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(selDevsSize)), _, _, _))
.WillByDefault(Return(metaDevices[deviceConfigs.size() - selDevsSize]));
devicesStr += deviceName;
devicesStr += ((++iter) == deviceConfigs.end()) ? "" : ",";
@@ -142,16 +142,16 @@ TEST_P(AutoLoadFailedTest, LoadCNNetWork) {
if (thrExcWheSelect) {
selDevsSize = deviceConfigs.size();
if (selDevsSize > 1) {
- ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(selDevsSize - 1)), _, _))
+ ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(selDevsSize - 1)), _, _, _))
.WillByDefault(ov::Throw(""));
} else {
- ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(1)), _, _))
+ ON_CALL(*plugin, select_device(Property(&std::vector<DeviceInformation>::size, Eq(1)), _, _, _))
.WillByDefault(ov::Throw(""));
}
}
EXPECT_CALL(*plugin, parse_meta_devices(_, _)).Times(AtLeast(1));
- EXPECT_CALL(*plugin, select_device(_, _, _)).Times(selectCount);
+ EXPECT_CALL(*plugin, select_device(_, _, _, _)).Times(selectCount);
EXPECT_CALL(*core,
compile_model(::testing::Matcher<const std::shared_ptr<const ov::Model>&>(_),
::testing::Matcher<const std::string&>(_),
diff --git a/src/plugins/auto/tests/unit/select_device_test.cpp b/src/plugins/auto/tests/unit/select_device_test.cpp
index 431f2b2d292..9be0822c366 100644
--- a/src/plugins/auto/tests/unit/select_device_test.cpp
+++ b/src/plugins/auto/tests/unit/select_device_test.cpp
@@ -3,6 +3,7 @@
//
#include "include/auto_unit_test.hpp"
+#include <cctype>
using namespace ov::mock_auto_plugin;
using ConfigParams = std::tuple<std::string, // netPrecision
@@ -57,7 +58,6 @@ public:
} else {
result << "_reverseTotalDevice_false";
}
-
return result.str();
}
// combine select_num devices from devices and make them to ConfigParams
@@ -199,8 +199,9 @@ public:
ON_CALL(*plugin, select_device)
.WillByDefault([this](const std::vector<DeviceInformation>& metaDevices,
const std::string& netPrecision,
- unsigned int priority) {
- return plugin->Plugin::select_device(metaDevices, netPrecision, priority);
+ unsigned int priority,
+ const std::unordered_map<std::string, unsigned>& utilization_thresholds) {
+ return plugin->Plugin::select_device(metaDevices, netPrecision, priority, utilization_thresholds);
});
ON_CALL(*plugin, get_valid_device)
.WillByDefault([this](const std::vector<DeviceInformation>& metaDevices, const std::string& netPrecision) {
@@ -212,7 +213,7 @@ public:
TEST_P(SelectDeviceTest, SelectDevice) {
const auto& [netPrecision, devices, expect, throwExcept, enabledevice_priority, reverse] = this->GetParam();
- EXPECT_CALL(*plugin, select_device(_, _, _)).Times(1);
+ EXPECT_CALL(*plugin, select_device(_, _, _, _)).Times(1);
if (devices.size() >= 1) {
EXPECT_CALL(*core, get_property(_, _, _)).Times(AtLeast(static_cast<int>(devices.size()) - 1));
} else {
@@ -220,9 +221,9 @@ TEST_P(SelectDeviceTest, SelectDevice) {
}
if (throwExcept) {
- ASSERT_THROW(plugin->select_device(devices, netPrecision, 0), ov::Exception);
+ ASSERT_THROW(plugin->select_device(devices, netPrecision, 0, {}), ov::Exception);
} else {
- auto result = plugin->select_device(devices, netPrecision, 0);
+ auto result = plugin->select_device(devices, netPrecision, 0, {});
compare(result, expect);
}
}
@@ -231,3 +232,228 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
SelectDeviceTest,
::testing::ValuesIn(SelectDeviceTest::CreateConfigs()),
SelectDeviceTest::getTestCaseName);
+
+using ConfigFilterParams = std::tuple<std::unordered_map<std::string, unsigned>, // utilization threshold,
+ std::vector<ov::auto_plugin::DeviceInformation>, // device candidate list
+ std::map<std::string, float>, // device utilization
+ ov::auto_plugin::DeviceInformation // expected selected device
+ >;
+class SelectDeviceWithUtilizationTest : public tests::AutoTest, public ::testing::TestWithParam<ConfigFilterParams> {
+public:
+ static std::string getTestCaseName(testing::TestParamInfo<ConfigFilterParams> obj) {
+ std::unordered_map<std::string, unsigned> threshold;
+ std::vector<ov::auto_plugin::DeviceInformation> devices;
+ ov::auto_plugin::DeviceInformation selectedDeviceInfo;
+ std::map<std::string, float> deviceUtilization;
+ std::tie(threshold, devices, deviceUtilization, selectedDeviceInfo) = obj.param;
+ std::ostringstream result;
+ // Sort threshold keys for deterministic test naming
+ std::vector<std::string> sorted_keys;
+ for (const auto& item : threshold) {
+ sorted_keys.push_back(item.first);
+ }
+ std::sort(sorted_keys.begin(), sorted_keys.end());
+ for (const auto& key : sorted_keys) {
+ result << key << "_utilizationThreshold_" << threshold.at(key) << "_";
+ }
+ result << "candidateDeviceList_";
+ for (auto dev : devices)
+ result << dev.device_name << "_priority_" << dev.device_priority << "_";
+
+ result << "deviceUtilization_";
+ for (auto item : deviceUtilization) {
+ result << item.first << "_" << item.second << "_";
+ }
+
+ result << "expectedSelectedDevice_";
+ result << selectedDeviceInfo.device_name << "_priority_" << selectedDeviceInfo.device_priority << "_";
+
+ auto sanitize_for_gtest = [](std::string name) {
+ for (char& ch : name) {
+ const unsigned char c = static_cast<unsigned char>(ch);
+ if (!std::isalnum(c) && ch != '_') {
+ ch = '_';
+ }
+ }
+ return name;
+ };
+
+ return sanitize_for_gtest(result.str());
+ }
+
+ void compare(DeviceInformation& a, DeviceInformation& b) {
+ EXPECT_EQ(a.device_name, b.device_name);
+ EXPECT_EQ(a.unique_name, b.unique_name);
+ EXPECT_EQ(a.default_device_id, b.default_device_id);
+ }
+
+ void SetUp() override {
+ std::tie(threshold, devices, deviceUtilization, selectedDeviceInfo) = GetParam();
+ std::map<std::string, unsigned> properties_thresholds(threshold.begin(), threshold.end());
+ std::vector<std::string> npuCapability = {"FP32", "FP16", "INT8", "BIN"};
+ ON_CALL(*core, get_property(StrEq(ov::test::utils::DEVICE_NPU), StrEq(ov::device::capabilities.name()), _))
+ .WillByDefault(RETURN_MOCK_VALUE(npuCapability));
+ ov::AnyMap config = {};
+ ON_CALL(*plugin, get_property(StrEq(ov::intel_auto::devices_utilization_threshold.name()), config))
+ .WillByDefault(Return(ov::Any(properties_thresholds)));
+ ON_CALL(*core,
+ get_property(StrEq(ov::test::utils::DEVICE_AUTO),
+ StrEq(ov::intel_auto::devices_utilization_threshold.name()),
+ _))
+ .WillByDefault(Return(ov::Any(properties_thresholds)));
+ ON_CALL(*plugin, get_device_utilization)
+ .WillByDefault([this](const std::string& device_name, const std::string& device_type) -> std::optional<float> {
+ const auto it = deviceUtilization.find(device_name);
+ if (it == deviceUtilization.end()) {
+ return std::nullopt;
+ }
+ return it->second;
+ });
+ ON_CALL(*plugin, get_valid_device)
+ .WillByDefault([this](const std::vector<DeviceInformation>& metaDevices, const std::string& netPrecision) {
+ return plugin->Plugin::get_valid_device(metaDevices, netPrecision);
+ });
+ }
+
+protected:
+ std::unordered_map<std::string, unsigned> threshold;
+ std::vector<ov::auto_plugin::DeviceInformation> devices;
+ ov::auto_plugin::DeviceInformation selectedDeviceInfo;
+ std::map<std::string, float> deviceUtilization;
+};
+
+TEST_P(SelectDeviceWithUtilizationTest, selectDeviceWithUtilization) {
+ // get Parameter
+ std::string netPrecision = "FP32";
+ auto result = plugin->select_device(devices, netPrecision, 0, threshold);
+ compare(result, selectedDeviceInfo);
+}
+
+const std::unordered_map<std::string, unsigned> testUtilizThreshold_15 = {{"CPU", 15},
+ {"GPU", 15},
+ {"GPU.0", 15},
+ {"GPU.1", 15},
+ {"NPU", 15}};
+const std::unordered_map<std::string, unsigned> testUtilizThreshold_80 = {{"CPU", 80},
+ {"GPU", 80},
+ {"GPU.0", 80},
+ {"GPU.1", 80},
+ {"NPU", 80}};
+const std::unordered_map<std::string, unsigned> testUtilizThreshold_100 = {{"CPU", 100},
+ {"GPU", 100},
+ {"GPU.0", 100},
+ {"GPU.1", 100},
+ {"NPU", 100}};
+const std::vector<ConfigFilterParams> testValidConfigs = {
+ ConfigFilterParams{testUtilizThreshold_80, // utilization threshold
+ {{"CPU", {}, -1, "01", "CPU_01", 0}}, // device candidates list
+ {{"CPU", 15.3f}}, // device utilization
+ {"CPU", {}, -1, "01", "CPU_01", 0}}, // expected list of device candidates after filtering
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0}},
+ {{"CPU", 85.2f}},
+ {"CPU", {}, -1, "01", "CPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0}, {"GPU", {}, -1, "01", "GPU", 0}},
+ {{"CPU", 15.3f}, {"GPU", 20.5f}},
+ {"GPU", {}, -1, "01", "GPU", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0}, {"NPU", {}, -1, "01", "NPU", 0}},
+ {{"CPU", 15.3f}, {"NPU", 20.5f}},
+ {"NPU", {}, -1, "01", "NPU", 0}},
+ ConfigFilterParams{
+ testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0}, {"GPU", {}, -1, "01", "GPU", 0}, {"NPU", {}, -1, "01", "NPU", 0}},
+ {{"CPU", 85.2f}, {"GPU", 20.5f}, {"NPU", 20.5f}},
+ {"GPU", {}, -1, "01", "GPU", 0}},
+ ConfigFilterParams{testUtilizThreshold_15,
+ {{"CPU", {}, -1, "01", "CPU_01", 0}, {"GPU", {}, -1, "01", "GPU", 0}},
+ {{"CPU", 85.2f}, {"GPU", 20.5f}},
+ {"GPU", {}, -1, "01", "GPU", 0}},
+ ConfigFilterParams{testUtilizThreshold_15,
+ {{"CPU", {}, -1, "01", "CPU_01", 0}, {"GPU", {}, -1, "01", "GPU", 0}},
+ {{"CPU", 10.5f}, {"GPU", 20.5f}},
+ {"CPU", {}, -1, "01", "CPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 1}, {"GPU", {}, -1, "01", "GPU", 2}},
+ {{"CPU", 25.5f}, {"GPU", 20.5f}},
+ {"CPU", {}, -1, "01", "CPU_01", 1}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 1}, {"GPU", {}, -1, "01", "GPU", 2}},
+ {{"CPU", 90.5f}, {"GPU", 25.5f}},
+ {"GPU", {}, -1, "01", "GPU", 2}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 1}, {"NPU", {}, -1, "01", "NPU", 2}},
+ {{"CPU", 85.5f}, {"NPU", 20.5f}},
+ {"NPU", {}, -1, "01", "NPU", 2}},
+ ConfigFilterParams{testUtilizThreshold_15,
+ {{"CPU", {}, -1, "01", "CPU_01", 1}, {"GPU", {}, -1, "01", "GPU", 2}},
+ {{"CPU", 85.5f}, {"GPU", 20.5f}},
+ {"CPU", {}, -1, "01", "CPU_01", 1}},
+ ConfigFilterParams{testUtilizThreshold_15,
+ {{"CPU", {}, -1, "01", "CPU_01", 0}, {"GPU.0", {}, -1, "01", "iGPU_01", 0}},
+ {{"CPU", 85.5f}, {"GPU.0", 20.5f}},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_15,
+ {{"CPU", {}, -1, "01", "CPU_01", 0},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 0},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0}},
+ {{"CPU", 85.5f}, {"GPU.0", 20.5f}, {"GPU.1", 50.5f}},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 0},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0},
+ {"NPU", {}, -1, "01", "NPU", 0}},
+ {{"CPU", 85.5f}, {"GPU.0", 20.5f}, {"GPU.1", 50.5f}, {"NPU", 30.5f}},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 0},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0},
+ {"NPU", {}, -1, "01", "NPU", 0}},
+ {{"CPU", 85.5f}, {"GPU.0", 82.5f}, {"GPU.1", 50.5f}, {"NPU", 30.5f}},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 0},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0}},
+ {{"CPU", 15.5f}, {"GPU.0", 90.5f}, {"GPU.1", 50.5f}},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 0},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 0},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 0}},
+ {{"CPU", 15.5f}, {"GPU.0", 10.5f}, {"GPU.1", 90.5f}},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 0}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 1},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 2},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 3}},
+ {{"CPU", 15.5f}, {"GPU.0", 10.5f}, {"GPU.1", 90.5f}},
+ {"CPU", {}, -1, "01", "CPU_01", 1}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 1},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 2},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 3},
+ {"NPU", {}, -1, "01", "NPU", 4}},
+ {{"CPU", 15.5f}, {"GPU.0", 10.5f}, {"GPU.1", 90.5f}, {"NPU", 88.5f}},
+ {"CPU", {}, -1, "01", "CPU_01", 1}},
+ ConfigFilterParams{testUtilizThreshold_100,
+ {{"CPU", {}, -1, "01", "CPU_01", 1},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 2},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 3},
+ {"NPU", {}, -1, "01", "NPU", 4}},
+ {{"CPU", 200.0f}, {"GPU.0", 200.0f}, {"GPU.1", 200.0f}, {"NPU", 200.0f}},
+ {"CPU", {}, -1, "01", "CPU_01", 1}},
+ ConfigFilterParams{testUtilizThreshold_80,
+ {{"CPU", {}, -1, "01", "CPU_01", 1},
+ {"GPU.0", {}, -1, "01", "iGPU_01", 2},
+ {"GPU.1", {}, -1, "01", "dGPU_01", 3}},
+ {{"CPU", 15.0f}, {"GPU.0", 90.0f}, {"GPU.1", 10.0f}},
+ {"CPU", {}, -1, "01", "CPU_01", 1}}};
+
+INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,
+ SelectDeviceWithUtilizationTest,
+ ::testing::ValuesIn(testValidConfigs),
+ SelectDeviceWithUtilizationTest::getTestCaseName);
diff --git a/src/plugins/auto/tests/unit/set_log_level_test.cpp b/src/plugins/auto/tests/unit/set_log_level_test.cpp
index cedfe981952..47cb8177322 100644
--- a/src/plugins/auto/tests/unit/set_log_level_test.cpp
+++ b/src/plugins/auto/tests/unit/set_log_level_test.cpp
@@ -40,7 +40,7 @@ public:
std::list<DeviceInformation> devices(metaDevices.begin(), metaDevices.end());
return devices;
});
- ON_CALL(*plugin, select_device(_, _, _)).WillByDefault(Return(metaDevices[1]));
+ ON_CALL(*plugin, select_device(_, _, _, _)).WillByDefault(Return(metaDevices[1]));
}
void TearDown() override {
diff --git a/src/plugins/auto/tests/unit/startup_fallback_property_test.cpp b/src/plugins/auto/tests/unit/startup_fallback_property_test.cpp
index 05770b0d102..20ddcec6aa8 100644
--- a/src/plugins/auto/tests/unit/startup_fallback_property_test.cpp
+++ b/src/plugins/auto/tests/unit/startup_fallback_property_test.cpp
@@ -56,7 +56,7 @@ public:
std::list<DeviceInformation> devices(metaDevices.begin(), metaDevices.end());
return devices;
});
- ON_CALL(*plugin, select_device(_, _, _)).WillByDefault(Return(metaDevices[1]));
+ ON_CALL(*plugin, select_device(_, _, _, _)).WillByDefault(Return(metaDevices[1]));
}
};
diff --git a/src/plugins/auto/tests/unit/stateful_model_test.cpp b/src/plugins/auto/tests/unit/stateful_model_test.cpp
index 598475e6c8d..a839eaf09ba 100644
--- a/src/plugins/auto/tests/unit/stateful_model_test.cpp
+++ b/src/plugins/auto/tests/unit/stateful_model_test.cpp
@@ -226,6 +226,10 @@ TEST_P(StatefulModelSupportedTest, CanFilterOutCorrectTargetDeviceWithStatefulMo
std::this_thread::sleep_for(std::chrono::milliseconds(500));
EXPECT_EQ(exeNetwork->get_property(ov::execution_devices.name()).as<std::string>(), expectedExecuteDev);
}
+ // clean up
+ for (auto& item : metaDevices) {
+ plugin->unregister_priority(item.device_priority, item.unique_name);
+ }
}
const std::vector<StatefulModelConfigParams> testConfigs = {
diff --git a/src/plugins/auto/thirdparty/CMakeLists.txt b/src/plugins/auto/thirdparty/CMakeLists.txt
new file mode 100644
index 00000000000..4077b7bbe9e
--- /dev/null
+++ b/src/plugins/auto/thirdparty/CMakeLists.txt
@@ -0,0 +1,55 @@
+# Copyright (C) 2018-2026 Intel Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+
+# Intel Platform Framework (IPF) telemetry client from submodule (MSVC only).
+# ClientApi requires dynamic CRT (/MD); static CRT toolchain sets
+# ENABLE_IPF_CLIENT_API=OFF.
+# Only ClientApi shared library is linked via ClientApiC.h.
+
+set(_ipf_ef_dir "${CMAKE_CURRENT_SOURCE_DIR}/ipf/IPF_EF")
+
+if(NOT ENABLE_IPF_CLIENT_API)
+ message(STATUS "[AUTO] IPF: disabled by ENABLE_IPF_CLIENT_API=OFF")
+ return()
+endif()
+
+if(NOT MSVC)
+ message(STATUS "[AUTO] IPF: non-MSVC toolchain, device utilization monitoring disabled")
+ return()
+endif()
+
+if(NOT EXISTS "${_ipf_ef_dir}/CMakeLists.txt")
+ message(STATUS "[AUTO] IPF: submodule not found at ${_ipf_ef_dir}, device utilization monitoring disabled. "
+ "Run 'git submodule update --init --recursive' to enable it.")
+ return()
+endif()
+
+if(TARGET nlohmann_json::nlohmann_json OR TARGET nlohmann_json)
+ message(STATUS "[AUTO] IPF: reusing existing nlohmann_json target, skipping IPF's bundled FetchContent copy")
+ set_property(GLOBAL PROPERTY _FetchContent_nlohmann_json_populated TRUE)
+endif()
+
+add_subdirectory("${_ipf_ef_dir}" "${CMAKE_CURRENT_BINARY_DIR}/ipf" EXCLUDE_FROM_ALL)
+
+if(NOT TARGET ClientApi)
+ message(STATUS "[AUTO] IPF: ClientApi target not produced by submodule, device utilization monitoring disabled")
+ return()
+endif()
+
+set_target_properties(ClientApi PROPERTIES EXPORT_NAME ipf_client_api)
+add_library(openvino::ipf_client_api ALIAS ClientApi)
+
+if(NOT BUILD_SHARED_LIBS)
+ install(TARGETS ClientApi EXPORT OpenVINOTargets
+ RUNTIME DESTINATION ${OV_CPACK_PLUGINSDIR} COMPONENT ${OV_CPACK_COMP_CORE} ${OV_CPACK_COMP_CORE_EXCLUDE_ALL}
+ ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${OV_CPACK_COMP_CORE_DEV} ${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})
+ export(TARGETS ClientApi NAMESPACE openvino::
+ APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
+else()
+ install(TARGETS ClientApi
+ RUNTIME DESTINATION ${OV_CPACK_PLUGINSDIR} COMPONENT ${OV_CPACK_COMP_CORE} ${OV_CPACK_COMP_CORE_EXCLUDE_ALL}
+ ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${OV_CPACK_COMP_CORE_DEV} ${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})
+endif()
+
+message(STATUS "[AUTO] IPF: successfully configured")
diff --git a/src/plugins/auto/thirdparty/ipf b/src/plugins/auto/thirdparty/ipf
new file mode 160000
index 00000000000..860be26b399
--- /dev/null
+++ b/src/plugins/auto/thirdparty/ipf
@@ -0,0 +1 @@
+Subproject commit 860be26b399e85a608dbca962c2ff21f680a9486