OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[AUTO] Add low_power_device property for dynamic device selection via IPF/DTT (#37384)
guozhong wang1e8aa7c0ee86
diff --git a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp b/src/bindings/python/src/pyopenvino/core/properties/properties.cppindex d6de8ec96b1..17def3e17b1 100644--- a/src/bindings/python/src/pyopenvino/core/properties/properties.cpp+++ b/src/bindings/python/src/pyopenvino/core/properties/properties.cpp@@ -340,6 +340,7 @@ void regmodule_properties(py::module m) {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");+ wrap_property_RW(m_intel_auto, ov::intel_auto::low_power_device, "low_power_device");// Submodule npupy::module m_intel_npu =diff --git a/src/bindings/python/tests/test_runtime/test_properties.py b/src/bindings/python/tests/test_runtime/test_properties.pyindex a14e067787a..330b678884c 100644--- a/src/bindings/python/tests/test_runtime/test_properties.py+++ b/src/bindings/python/tests/test_runtime/test_properties.py@@ -615,6 +615,14 @@ def test_properties_devices_utilization_threshold():assert "incompatible function arguments" in str(e.value)+def test_properties_low_power_device():+ assert intel_auto.low_power_device == "LOW_POWER_DEVICE"++ property_tuple = intel_auto.low_power_device("NPU")+ assert property_tuple[0] == "LOW_POWER_DEVICE"+ assert property_tuple[1].value == "NPU"++def test_properties_streams():# Test extra Num classassert streams.Num().to_integer() == -1diff --git a/src/inference/include/openvino/runtime/auto/properties.hpp b/src/inference/include/openvino/runtime/auto/properties.hppindex eb6415aae11..60727a661f8 100644--- a/src/inference/include/openvino/runtime/auto/properties.hpp+++ b/src/inference/include/openvino/runtime/auto/properties.hpp@@ -81,5 +81,16 @@ static constexpr Property<SchedulePolicy> schedule_policy{"SCHEDULE_POLICY"};*/static constexpr Property<std::map<std::string, unsigned>> devices_utilization_threshold{"DEVICES_UTILIZATION_THRESHOLD"};++/**+ * @brief Name of the device AUTO should prefer while the platform is in low power mode+ * (as reported by IPF/DTT). Takes precedence over+ * devices_utilization_threshold when the platform is in low power mode. The value must exactly+ * match a candidate DeviceInformation::device_name, for example "CPU", "NPU", or "GPU.0".+ * On builds without OV_AUTO_ENABLE_IPF, the telemetry backend always returns unknown, so this+ * property has no effect.+ * @ingroup ov_runtime_cpp_prop_api+ */+static constexpr Property<std::string> low_power_device{"LOW_POWER_DEVICE"};} // namespace intel_auto-} // namespace ov\ No newline at end of file+} // namespace ovdiff --git a/src/plugins/auto/src/auto_schedule.cpp b/src/plugins/auto/src/auto_schedule.cppindex 962b3e50f57..f619b6121f3 100644--- a/src/plugins/auto/src/auto_schedule.cpp+++ b/src/plugins/auto/src/auto_schedule.cpp@@ -54,7 +54,8 @@ bool AutoSchedule::select_other_device(const std::string& cur_dev_name) {m_plugin->select_device(m_context->m_device_priorities,m_compile_context[FALLBACKDEVICE].m_model_precision,m_context->m_model_priority,- m_context->m_utilization_thresholds);+ m_context->m_utilization_thresholds,+ m_context->m_low_power_device);try {m_compile_context[FALLBACKDEVICE].m_task();// FALLBACKDEVICE need to be load again if infer failed, so reset promise here@@ -98,7 +99,8 @@ void AutoSchedule::init() {m_plugin->select_device(m_context->m_device_priorities,m_compile_context[ACTUALDEVICE].m_model_precision,m_context->m_model_priority,- m_context->m_utilization_thresholds);+ m_context->m_utilization_thresholds,+ m_context->m_low_power_device);auto load_device_task = [&](AutoCompileContext* context_ptr, const std::shared_ptr<ov::Model>& model) {try_to_compile_model(*context_ptr, model);@@ -369,7 +371,8 @@ void AutoSchedule::try_to_compile_model(AutoCompileContext& context, const std::context.m_device_info = m_plugin->select_device(device_list,context.m_model_precision,m_context->m_model_priority,- m_context->m_utilization_thresholds);+ m_context->m_utilization_thresholds,+ m_context->m_low_power_device);} catch (const ov::Exception&) {return;}diff --git a/src/plugins/auto/src/common.hpp b/src/plugins/auto/src/common.hppindex 9e3db79163d..aac03b0c602 100644--- a/src/plugins/auto/src/common.hpp+++ b/src/plugins/auto/src/common.hpp@@ -223,6 +223,7 @@ public:SoCompiledModel m_hw_compiled_model;std::string m_model_precision;std::unordered_map<std::string, unsigned> m_utilization_thresholds;+ std::string m_low_power_device;// 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.cppindex 6e7a471d239..804d690cff0 100644--- a/src/plugins/auto/src/plugin.cpp+++ b/src/plugins/auto/src/plugin.cpp@@ -5,6 +5,7 @@///////////////////////////////////////////////////////////////////////////////////////////////////#include "plugin.hpp"+#include <algorithm>#include <map>#include <memory>#include <string>@@ -485,6 +486,10 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model_impl(const std::filesyauto_s_context->m_utilization_thresholds.insert(device_utilization_thresholds.begin(),device_utilization_thresholds.end());}+ auto low_power_device = load_config.get_property(ov::intel_auto::low_power_device);+ if (!low_power_device.empty()) {+ auto_s_context->m_low_power_device = low_power_device;+ }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@@ -593,6 +598,13 @@ std::optional<float> Plugin::get_device_utilization(const std::string& device_nareturn result;}+std::optional<bool> Plugin::get_low_power_mode() {+ std::call_once(m_telemetry_client_init_once, [this]() {+ m_telemetry_client = std::make_unique<device_monitor::TelemetryClient>();+ });+ return m_telemetry_client->is_low_power_mode();+}+std::list<DeviceInformation> Plugin::get_valid_device(const std::vector<DeviceInformation>& meta_devices,const std::string& model_precision) const {if (meta_devices.empty()) {@@ -684,7 +696,8 @@ std::list<DeviceInformation> Plugin::get_valid_device(const std::vector<DeviceInDeviceInformation Plugin::select_device(const std::vector<DeviceInformation>& meta_devices,const std::string& model_precision,unsigned int priority,- const std::unordered_map<std::string, unsigned>& utilization_thresholds) {+ const std::unordered_map<std::string, unsigned>& utilization_thresholds,+ const std::string& low_power_device) {OV_ITT_SCOPED_TASK(itt::domains::AutoPlugin, "Plugin::SelectDevice");std::list<DeviceInformation> valid_devices = get_valid_device(meta_devices, model_precision);@@ -718,76 +731,92 @@ DeviceInformation Plugin::select_device(const std::vector<DeviceInformation>& me}DeviceInformation* ptr_select_device = nullptr;+ // low_power_device (driven by IPF/DTT OnEpoGearChanged) takes precedence over+ // devices_utilization_threshold whenever the platform is in low power mode.+ auto find_low_power_device = [&]() -> DeviceInformation* {+ if (low_power_device.empty()) {+ return nullptr;+ }+ auto it = std::find_if(valid_devices.begin(), valid_devices.end(), [&](const DeviceInformation& device) {+ return device.device_name == low_power_device;+ });+ if (it == valid_devices.end() || !get_low_power_mode().value_or(false)) {+ return nullptr;+ }+ return &(*it);+ };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 if (auto* low_power_selected = find_low_power_device()) {+ ptr_select_device = low_power_selected;} 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.- 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;+ 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.+ 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 = "";+ 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]",+ 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(),- std::to_string(device_utilization_threshold).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;+ if (is_excluded) {+ // Remove the excluded candidate at the front in O(1).+ valid_devices.erase(valid_devices.begin());+ } else {+ ptr_select_device = device;+ }}}}diff --git a/src/plugins/auto/src/plugin.hpp b/src/plugins/auto/src/plugin.hppindex a31cc5a5873..57167e7bb6e 100644--- a/src/plugins/auto/src/plugin.hpp+++ b/src/plugins/auto/src/plugin.hpp@@ -61,7 +61,8 @@ public: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 = {});+ const std::unordered_map<std::string, unsigned>& utilization_thresholds = {},+ const std::string& low_power_device = {});void unregister_priority(const unsigned int& priority, const std::string& device_name);void register_priority(const unsigned int& priority, const std::string& device_name);@@ -79,6 +80,9 @@ public:MOCKTESTMACRO std::optional<float> get_device_utilization(const std::string& device_name,const std::string& device_type = "");+ // Whether the platform is currently in low power mode; see device_monitor::TelemetryClient.+ MOCKTESTMACRO std::optional<bool> get_low_power_mode();+std::shared_ptr<ov::ICompiledModel> import_model(const ov::Tensor& model,const ov::AnyMap& properties) const override;diff --git a/src/plugins/auto/src/plugin_config.cpp b/src/plugins/auto/src/plugin_config.cppindex 9e85b2c35b9..b63283a3fab 100644--- a/src/plugins/auto/src/plugin_config.cpp+++ b/src/plugins/auto/src/plugin_config.cpp@@ -28,6 +28,7 @@ void PluginConfig::set_default() {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()),+ std::make_tuple(ov::intel_auto::low_power_device, std::string{}),// RO for register onlystd::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.hppindex 11da1369077..f9e883ab766 100644--- a/src/plugins/auto/src/plugin_config.hpp+++ b/src/plugins/auto/src/plugin_config.hpp@@ -10,8 +10,10 @@#include "utils/log.hpp"#include "utils/log_util.hpp"#include "openvino/runtime/device_id_parser.hpp"+#include <algorithm>#include <string>#include <map>+#include <set>#include <vector>namespace ov {@@ -176,6 +178,9 @@ public: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());+ multi_supported_configKeys.erase(std::remove(+ multi_supported_configKeys.begin(), multi_supported_configKeys.end(), ov::intel_auto::low_power_device.name()),+ multi_supported_configKeys.end());return plugin_name == "AUTO" ? supported_configKeys : multi_supported_configKeys;}@@ -195,6 +200,10 @@ public:multi_supported_properties.end(),ov::intel_auto::devices_utilization_threshold),multi_supported_properties.end());+ multi_supported_properties.erase(std::remove(multi_supported_properties.begin(),+ multi_supported_properties.end(),+ ov::intel_auto::low_power_device),+ 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.cppindex 15cca0bc23b..53d620bf0f7 100644--- a/src/plugins/auto/src/utils/device_telemetry.cpp+++ b/src/plugins/auto/src/utils/device_telemetry.cpp@@ -6,7 +6,10 @@#ifdef OV_AUTO_ENABLE_IPF+# include <atomic># include <cmath>+# include <memory>+# include <mutex># include <vector># include "ClientApiC.h"@@ -21,6 +24,16 @@ inline std::string get_log_tag() {return "[IPF]";}+// IPF namespace/paths confirmed against the DttSampleEfApp sample (Demo.cpp / Constants.h) and+// DTT team feedback. Note the registered event path ends in "OnEpoGearChanged", not+// "OnGearChanged"; the event's own eventPath argument is delivered as the parent node+// ("...Policy.EPO"), with the real event name/value inside the JSON payload instead.+constexpr const char* k_dtt_version_path = "Platform.Features.DTT.Software.Version";+constexpr const char* k_dtt_current_gear_path = "Platform.Features.DTT.Policy.EPO.CurrentGear";+constexpr const char* k_dtt_gear_changed_path = "Platform.Features.DTT.Policy.EPO.OnEpoGearChanged";++void gear_changed_callback(const char* path, const char* event, void* context);+namespace {std::optional<float> parse_utilization_from_aiselector_json_impl(const std::string& json_str,@@ -78,20 +91,46 @@ std::optional<float> parse_utilization_from_aiselector_json_impl(const std::stri} // namespace// Calls into ClientApi.dll through the plain-C ABI (ClientApiC.h).+// The callback context is a heap-allocated shared_ptr<atomic<int>>; Impl deletes it only after+// IpfUnregisterEvent returns, ensuring no in-flight callback can outlive the pointed-to memory.class TelemetryClient::Impl {public:+ static void handle_gear_changed_event(void* context, const std::string& gear_str) {+ auto* sp = static_cast<std::shared_ptr<std::atomic<int>>*>(context);+ if (sp == nullptr || !*sp) {+ return;+ }+ try {+ (*sp)->store(std::stoi(gear_str));+ } catch (const std::exception&) {+ LOG_WARNING_TAG("TelemetryClient: EPO gear value is not an integer: %s", gear_str.c_str());+ }+ }+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");+ return;}+ LOG_INFO_TAG("TelemetryClient: IPF ClientApi initialized successfully");}~Impl() {if (m_handle != nullptr) {+ if (m_gear_event_registered) {+ const ipf_err_t unreg_status =+ IpfUnregisterEvent(m_handle, k_dtt_gear_changed_path, gear_changed_callback);+ if (unreg_status == IpfError::IPF_ERR_OK) {+ m_callback_context.reset();+ } else {+ // Unregister failed: intentionally leak context to prevent use-after-free.+ LOG_WARNING_TAG("TelemetryClient: IpfUnregisterEvent failed: %s, leaking callback context",+ ipf_ef_error_str(unreg_status));+ (void)m_callback_context.release();+ }+ }IpfDestroy(m_handle);m_handle = nullptr;}@@ -116,19 +155,60 @@ public:return parse_utilization_from_aiselector_json_impl(json_str, metric_key, metric_key_view, device_name);}+ std::optional<bool> is_low_power_mode() {+ if (m_handle == nullptr) {+ return std::nullopt;+ }+ std::call_once(m_low_power_init_once, [this]() {+ m_shared_gear = std::make_shared<std::atomic<int>>(-1);+ log_dtt_version();+ log_current_gear();+ // Context is kept alive here; raw pointer passed to IPF and freed only after confirmed unregister.+ m_callback_context = std::make_unique<std::shared_ptr<std::atomic<int>>>(m_shared_gear);+ const ipf_err_t reg_status =+ IpfRegisterEvent(m_handle, k_dtt_gear_changed_path, gear_changed_callback, m_callback_context.get());+ if (reg_status != IpfError::IPF_ERR_OK) {+ LOG_WARNING_TAG("TelemetryClient: failed to register for %s: %s",+ k_dtt_gear_changed_path,+ ipf_ef_error_str(reg_status));+ m_callback_context.reset();+ } else {+ m_gear_event_registered = true;+ LOG_INFO_TAG("TelemetryClient: registered for %s", k_dtt_gear_changed_path);+ }+ });+ // After first init, this is an atomic read; the call_once body does not re-run.+ const int gear = m_shared_gear->load();+ if (gear < 0) {+ return std::nullopt;+ }+ return is_low_power_gear(gear);+ }++ void on_gear_changed(const std::string& gear_str) {+ try {+ const int gear = std::stoi(gear_str);+ m_shared_gear->store(gear);+ } catch (const std::exception&) {+ LOG_WARNING_TAG("TelemetryClient: EPO gear value is not an integer: %s", gear_str.c_str());+ }+ }+private:- // Query IPF node data with the two-call buffer-size protocol.- std::string get_node(const char* path) {+ using IpfQueryFn = ipf_err_t (*)(void*, const char*, char*, size_t*);++ // Query IPF node/value data with the two-call buffer-size protocol.+ std::string query_ipf_string(IpfQueryFn query_fn, const char* path) {size_t len = 0;- ipf_err_t status = IpfGetNode(m_handle, path, nullptr, &len);+ ipf_err_t status = query_fn(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));+ LOG_WARNING_TAG("TelemetryClient: IPF query(%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);+ status = query_fn(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));+ LOG_WARNING_TAG("TelemetryClient: IPF query(%s) failed: %s", path, ipf_ef_error_str(status));return {};}std::string result(buf.data(), len);@@ -138,9 +218,76 @@ private:return result;}+ std::string get_node(const char* path) {+ return query_ipf_string(&IpfGetNode, path);+ }++ std::string get_value(const char* path) {+ return query_ipf_string(&IpfGetValue, path);+ }++ // Best-effort one-shot reads; failures are already logged by query_ipf_string/get_value.+ void log_dtt_version() {+ const std::string json_str = get_value(k_dtt_version_path);+ if (json_str.empty()) {+ return;+ }+ try {+ const auto parsed = nlohmann::json::parse(json_str);+ const std::string version = parsed.is_string() ? parsed.get<std::string>() : parsed.dump();+ LOG_INFO_TAG("TelemetryClient: DTT version = %s", version.c_str());+ } catch (const nlohmann::json::exception& e) {+ LOG_WARNING_TAG("TelemetryClient: failed to parse DTT version: %s", e.what());+ }+ }++ void log_current_gear() {+ const std::string json_str = get_value(k_dtt_current_gear_path);+ if (json_str.empty()) {+ return;+ }+ try {+ const auto parsed = nlohmann::json::parse(json_str);+ const std::string gear_str = parsed.is_string() ? parsed.get<std::string>() : parsed.dump();+ LOG_INFO_TAG("TelemetryClient: current EPO gear = %s", gear_str.c_str());+ on_gear_changed(gear_str);+ } catch (const nlohmann::json::exception& e) {+ LOG_WARNING_TAG("TelemetryClient: failed to parse current EPO gear: %s", e.what());+ }+ }+void* m_handle = nullptr;+ bool m_gear_event_registered = false;+ std::once_flag m_low_power_init_once;+ std::shared_ptr<std::atomic<int>> m_shared_gear;+ // Owns the heap-allocated shared_ptr passed to IpfRegisterEvent; freed only after confirmed unregister.+ std::unique_ptr<std::shared_ptr<std::atomic<int>>> m_callback_context;};+void gear_changed_callback(const char* path, const char* event, void* context) {+ if (event == nullptr) {+ LOG_WARNING_TAG("TelemetryClient: received null event payload from %s", path != nullptr ? path : "<null>");+ return;+ }+ LOG_DEBUG_TAG("TelemetryClient: received event from %s. Event data: %s",+ path != nullptr ? path : "<null>",+ event);+ try {+ const auto data = nlohmann::json::parse(event);+ if (!data.is_object() || data.empty()) {+ LOG_WARNING_TAG("TelemetryClient: gear-changed payload must be a non-empty JSON object");+ return;+ }+ const auto event_name = data.begin().key();+ const auto& event_value = data.begin().value();+ const std::string gear_str = event_value.is_string() ? event_value.get<std::string>() : event_value.dump();+ LOG_DEBUG_TAG("TelemetryClient: event name=%s, EPO gear=%s", event_name.c_str(), gear_str.c_str());+ TelemetryClient::Impl::handle_gear_changed_event(context, gear_str);+ } catch (const nlohmann::json::exception& e) {+ LOG_WARNING_TAG("TelemetryClient: failed to parse gear-changed event data: %s", e.what());+ }+}+TelemetryClient::TelemetryClient() : m_impl(std::make_unique<Impl>()) {}TelemetryClient::~TelemetryClient() = default;@@ -149,6 +296,10 @@ std::optional<float> TelemetryClient::utilization(const std::string& device_namereturn m_impl->utilization(device_name, device_type);}+std::optional<bool> TelemetryClient::is_low_power_mode() {+ return m_impl->is_low_power_mode();+}+#ifdef MULTIUNITTESTstd::optional<float> parse_utilization_from_aiselector_json_for_test(const std::string& json_str,const std::string& device_name,@@ -184,6 +335,10 @@ std::optional<float> TelemetryClient::utilization(const std::string&, const std:return std::nullopt;}+std::optional<bool> TelemetryClient::is_low_power_mode() {+ return std::nullopt;+}+} // namespace device_monitor} // namespace auto_plugin} // namespace ovdiff --git a/src/plugins/auto/src/utils/device_telemetry.hpp b/src/plugins/auto/src/utils/device_telemetry.hppindex a41b9be09fb..afb29abb204 100644--- a/src/plugins/auto/src/utils/device_telemetry.hpp+++ b/src/plugins/auto/src/utils/device_telemetry.hpp@@ -15,6 +15,10 @@ namespace ov {namespace auto_plugin {namespace device_monitor {+#ifdef OV_AUTO_ENABLE_IPF+void gear_changed_callback(const char* path, const char* event, void* context);+#endif+class TelemetryClient {public:TelemetryClient();@@ -22,7 +26,15 @@ public:std::optional<float> utilization(const std::string& device_name, const std::string& device_type = "");+ // Whether the platform is currently in low power mode, based on startup CurrentGear state and+ // any later IPF/DTT OnEpoGearChanged notifications. std::nullopt means the mode is unknown.+ // Lazy-initializes DTT version/gear queries and event registration on first call.+ std::optional<bool> is_low_power_mode();+private:+#ifdef OV_AUTO_ENABLE_IPF+ friend void gear_changed_callback(const char* path, const char* event, void* context);+#endifclass Impl;std::unique_ptr<Impl> m_impl;};@@ -33,6 +45,12 @@ inline constexpr std::string_view k_igpu_utilization_metric = "IGPUUtilization";inline constexpr std::string_view k_igpu_utilization_fallback_metric = "GPUUtilization";inline constexpr std::string_view k_dgpu_utilization_metric = "DGPUUtilization";inline constexpr std::string_view k_npu_utilization_metric = "NPUUtilization";+inline constexpr int k_low_power_mode_min_gear = 1;++// EPO gear 0 is baseline; positive gears request reduced-power operation.+inline constexpr bool is_low_power_gear(int gear) {+ return gear >= k_low_power_mode_min_gear;+}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;diff --git a/src/plugins/auto/tests/unit/auto_unit_test.cpp b/src/plugins/auto/tests/unit/auto_unit_test.cppindex 7a22c0f9217..0197d10e450 100644--- a/src/plugins/auto/tests/unit/auto_unit_test.cpp+++ b/src/plugins/auto/tests/unit/auto_unit_test.cpp@@ -121,8 +121,9 @@ ov::mock_auto_plugin::tests::BaseTest::BaseTest(const MODELTYPE modelType) {.WillByDefault([this](const std::vector<DeviceInformation>& metaDevices,const std::string& netPrecision,unsigned int priority,- const std::unordered_map<std::string, unsigned>& utilization_thresholds) {- return plugin->Plugin::select_device(metaDevices, netPrecision, priority, utilization_thresholds);+ const std::unordered_map<std::string, unsigned>& utilization_thresholds,+ const std::string& low_power_device) {+ return plugin->Plugin::select_device(metaDevices, netPrecision, priority, utilization_thresholds, low_power_device);});ON_CALL(*plugin, get_valid_device)diff --git a/src/plugins/auto/tests/unit/compile_model_metric_test.cpp b/src/plugins/auto/tests/unit/compile_model_metric_test.cppindex 433fae80a52..35bc3c50602 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_REQUESmetaDevices.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_REQUESreturn 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_tmetaDevices.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_treturn 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.cppindex e8afddec06c..83fcfb89378 100644--- a/src/plugins/auto/tests/unit/device_telemetry_test.cpp+++ b/src/plugins/auto/tests/unit/device_telemetry_test.cpp@@ -56,6 +56,22 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,::testing::ValuesIn(deviceMonitorKeyConfigs),DeviceMonitorKeyTest::getTestCaseName);+TEST(DeviceMonitorTest, low_power_mode_gear_mapping_matches_expected_policy) {+ EXPECT_FALSE(device_monitor::is_low_power_gear(-1));+ EXPECT_FALSE(device_monitor::is_low_power_gear(0));+ EXPECT_TRUE(device_monitor::is_low_power_gear(1));+ EXPECT_TRUE(device_monitor::is_low_power_gear(2));+}++TEST(DeviceMonitorTest, telemetry_client_low_power_mode_is_safe) {+ device_monitor::TelemetryClient client;+ std::optional<bool> low_power_mode;+ ASSERT_NO_THROW(low_power_mode = client.is_low_power_mode());+#ifndef OV_AUTO_ENABLE_IPF+ EXPECT_FALSE(low_power_mode.has_value());+#endif+}+// 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.diff --git a/src/plugins/auto/tests/unit/include/gmock_plugin.hpp b/src/plugins/auto/tests/unit/include/gmock_plugin.hppindex 710829fb69a..d9a6ce40be5 100644--- a/src/plugins/auto/tests/unit/include/gmock_plugin.hpp+++ b/src/plugins/auto/tests/unit/include/gmock_plugin.hpp@@ -22,6 +22,7 @@ public:get_device_utilization,((const std::string&), (const std::string&)),(override));+ MOCK_METHOD((std::optional<bool>), get_low_power_mode, (), (override));MOCK_METHOD((std::string),get_device_list,((ov::AnyMap&), const std::shared_ptr<const ov::Model>&, const std::filesystem::path&),@@ -36,7 +37,8 @@ public:((const std::vector<DeviceInformation>&),const std::string&,unsigned int,- (const std::unordered_map<std::string, unsigned>&)),+ (const std::unordered_map<std::string, unsigned>&),+ const std::string&),(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.cppindex 89352d5b3a8..54199b3fa9b 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 Mapfor (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.cppindex 62e80e2fa1f..c8ba6877b02 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, getPropertyTestAfterReleasstd::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.cppindex f525586db70..1214cfde7e0 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.cppindex 9be0822c366..60399335960 100644--- a/src/plugins/auto/tests/unit/select_device_test.cpp+++ b/src/plugins/auto/tests/unit/select_device_test.cpp@@ -200,8 +200,9 @@ public:.WillByDefault([this](const std::vector<DeviceInformation>& metaDevices,const std::string& netPrecision,unsigned int priority,- const std::unordered_map<std::string, unsigned>& utilization_thresholds) {- return plugin->Plugin::select_device(metaDevices, netPrecision, priority, utilization_thresholds);+ const std::unordered_map<std::string, unsigned>& utilization_thresholds,+ const std::string& low_power_device) {+ return plugin->Plugin::select_device(metaDevices, netPrecision, priority, utilization_thresholds, low_power_device);});ON_CALL(*plugin, get_valid_device).WillByDefault([this](const std::vector<DeviceInformation>& metaDevices, const std::string& netPrecision) {@@ -213,7 +214,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 {@@ -221,9 +222,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);}}@@ -325,7 +326,7 @@ protected:TEST_P(SelectDeviceWithUtilizationTest, selectDeviceWithUtilization) {// get Parameterstd::string netPrecision = "FP32";- auto result = plugin->select_device(devices, netPrecision, 0, threshold);+ auto result = plugin->select_device(devices, netPrecision, 0, threshold, {});compare(result, selectedDeviceInfo);}@@ -457,3 +458,83 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests,SelectDeviceWithUtilizationTest,::testing::ValuesIn(testValidConfigs),SelectDeviceWithUtilizationTest::getTestCaseName);++// -----------------------------------------------------------------------------------+// ov::intel_auto::low_power_device must take precedence over+// devices_utilization_threshold whenever the platform is reported as being in low power mode.+// get_low_power_mode() is mocked directly to keep this suite deterministic and independent+// from runtime IPF/DTT event delivery.+// -----------------------------------------------------------------------------------+class SelectDeviceWithLowPowerDevicePrecedenceTest : public tests::AutoTest, public ::testing::Test {+public:+ void SetUp() override {+ 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));+ 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);+ });+ }++ void TearDown() override {+ // m_priority_map is process-wide static state; clean up to avoid leaking into other suites.+ if (!selectedUniqueName.empty()) {+ plugin->unregister_priority(0, selectedUniqueName);+ }+ }++protected:+ std::string netPrecision = "FP32";+ std::vector<DeviceInformation> devices = {{"CPU", {}, -1, "01", "CPU_01", 0}, {"NPU", {}, -1, "01", "NPU_01", 0}};+ // NPU exceeds this threshold and is excluded by threshold logic; only low_power_device can pick it.+ std::unordered_map<std::string, unsigned> thresholds = {{"NPU", 50}};+ std::map<std::string, float> deviceUtilization = {{"CPU", 10.f}, {"NPU", 90.f}};+ std::string selectedUniqueName;+};++TEST_F(SelectDeviceWithLowPowerDevicePrecedenceTest, lowPowerDeviceOverridesThreshold) {+ EXPECT_CALL(*plugin, get_low_power_mode()).WillOnce(Return(true));+ auto result = plugin->select_device(devices, netPrecision, 0, thresholds, "NPU");+ selectedUniqueName = result.unique_name;+ EXPECT_EQ(result.unique_name, "NPU_01");+}++TEST_F(SelectDeviceWithLowPowerDevicePrecedenceTest, fallsBackToThresholdWhenNotInLowPowerMode) {+ EXPECT_CALL(*plugin, get_low_power_mode()).WillOnce(Return(false));+ auto result = plugin->select_device(devices, netPrecision, 0, thresholds, "NPU");+ selectedUniqueName = result.unique_name;+ // threshold logic excludes the over-utilized NPU once low_power_device is not applicable.+ EXPECT_EQ(result.unique_name, "CPU_01");+}++TEST_F(SelectDeviceWithLowPowerDevicePrecedenceTest, unknownLowPowerModeTreatedAsNotLowPower) {+ EXPECT_CALL(*plugin, get_low_power_mode()).WillOnce(Return(std::nullopt));+ auto result = plugin->select_device(devices, netPrecision, 0, thresholds, "NPU");+ selectedUniqueName = result.unique_name;+ EXPECT_EQ(result.unique_name, "CPU_01");+}++TEST_F(SelectDeviceWithLowPowerDevicePrecedenceTest, lowPowerDeviceNotInCandidateListFallsThrough) {+ // get_low_power_mode() is not called when the preferred device is not a candidate.+ EXPECT_CALL(*plugin, get_low_power_mode()).Times(0);+ auto result = plugin->select_device(devices, netPrecision, 0, thresholds, "GPU.0");+ selectedUniqueName = result.unique_name;+ EXPECT_EQ(result.unique_name, "CPU_01");+}++TEST_F(SelectDeviceWithLowPowerDevicePrecedenceTest, getLowPowerModeNotQueriedWhenLowPowerDeviceUnset) {+ // Guarantees zero behavior/perf impact on all pre-existing callers that leave low_power_device empty.+ EXPECT_CALL(*plugin, get_low_power_mode()).Times(0);+ auto result = plugin->select_device(devices, netPrecision, 0, thresholds, {});+ selectedUniqueName = result.unique_name;+ EXPECT_EQ(result.unique_name, "CPU_01");+}diff --git a/src/plugins/auto/tests/unit/set_log_level_test.cpp b/src/plugins/auto/tests/unit/set_log_level_test.cppindex 47cb8177322..dd32bd5ad33 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.cppindex 20ddcec6aa8..cfa398e251a 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]));}};@@ -122,4 +122,4 @@ const std::vector<ConfigParams> testCacheConfigs = {INSTANTIATE_TEST_SUITE_P(smoke_Auto_disableCachingForCPUPlugin,AutoLoadExeNetworkCacheDirSettingTest,::testing::ValuesIn(testCacheConfigs),- AutoLoadExeNetworkCacheDirSettingTest::getTestCaseNameCacheTest);\ No newline at end of file+ AutoLoadExeNetworkCacheDirSettingTest::getTestCaseNameCacheTest);