Skip to content

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

[AUTO] Enhance passthrough logic by adding initial device string support (#33722)

Wang, Yang921aa5a60477
diff --git a/src/plugins/auto/src/auto_schedule.cpp b/src/plugins/auto/src/auto_schedule.cpp
index 86a600e0bab..d3b9e89ff87 100644
--- a/src/plugins/auto/src/auto_schedule.cpp
+++ b/src/plugins/auto/src/auto_schedule.cpp
@@ -264,7 +264,8 @@ void AutoSchedule::init() {
}
};
m_executor->run(std::move(recycleTask));
- } else if (m_context->m_device_priorities.size() != 1 && m_context->m_runtime_fallback) {
+ } else if (m_context->m_device_priorities.size() != 1 && m_context->m_str_devices_initial.size() != 1 &&
+ m_context->m_runtime_fallback) {
// The performance will has some drop then m_passthrough_compiled_model when enable ENABLE_RUNTIME_FALLBACK
for (auto&& device : m_context->m_device_priorities) {
// initialize containers before run async task
@@ -274,7 +275,9 @@ void AutoSchedule::init() {
}
m_compile_context[ACTUALDEVICE].m_task();
} else {
- // only one device need to compile model, do not need to compile it async
+ // Only one device, or multiple devices of the same type (e.g., all GPU devices, including iGPU and dGPU), can
+ // use passthrough model; no need to compile asynchronously
+ LOG_INFO_TAG("Only one device or multiple devices of the same type will use passthrough compiled model");
m_compile_context[ACTUALDEVICE].m_task();
m_passthrough_compiled_model = m_compile_context[ACTUALDEVICE].m_compiled_model;
if (!m_context->m_bind_buffer) {
diff --git a/src/plugins/auto/src/common.hpp b/src/plugins/auto/src/common.hpp
index 3c0a3fa7a8f..da65cbbefd2 100644
--- a/src/plugins/auto/src/common.hpp
+++ b/src/plugins/auto/src/common.hpp
@@ -213,6 +213,7 @@ public:
std::string m_model_path;
std::shared_ptr<const ov::IPlugin> m_plugin;
std::string m_str_devices;
+ std::vector<std::string> m_str_devices_initial;
unsigned int m_model_priority = 0;
ov::Any m_performance_hint;
ov::Any m_schedule_policy = ov::intel_auto::SchedulePolicy::DEFAULT;
diff --git a/src/plugins/auto/src/plugin.cpp b/src/plugins/auto/src/plugin.cpp
index 021fc8318df..9e23fdff17f 100644
--- a/src/plugins/auto/src/plugin.cpp
+++ b/src/plugins/auto/src/plugin.cpp
@@ -186,7 +186,7 @@ std::vector<DeviceInformation> Plugin::parse_meta_devices(const std::string& pri
}
};
auto check_priority_config = [&] (const std::string& pri_string) {
- if (pri_string.empty())
+ if (pri_string.empty() || pri_string.find(",") == std::string::npos)
return false;
std::string::size_type pos = 0;
std::string::size_type endpos = 0;
@@ -487,6 +487,10 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model_impl(const std::string
auto_s_context->m_device_priorities = support_devices;
auto_s_context->m_device_priorities_initial = std::move(support_devices);
auto_s_context->m_str_devices = std::move(str_devices);
+ auto_s_context->m_str_devices_initial = m_plugin_config.parse_priorities_devices(priorities);
+ LOG_INFO_TAG("Original device list(%s) size to load the model: %d",
+ priorities.c_str(),
+ auto_s_context->m_str_devices_initial.size());
auto_s_context->m_plugin = shared_from_this();
auto_s_context->m_ov_core = get_core();
OPENVINO_ASSERT(auto_s_context->m_ov_core);
diff --git a/src/plugins/auto/tests/unit/parse_meta_device_test.cpp b/src/plugins/auto/tests/unit/parse_meta_device_test.cpp
index 34c10c1bfe2..a9abc189654 100644
--- a/src/plugins/auto/tests/unit/parse_meta_device_test.cpp
+++ b/src/plugins/auto/tests/unit/parse_meta_device_test.cpp
@@ -159,6 +159,14 @@ const std::vector<ConfigParams> testConfigs = {
ConfigParams{"CPU(-1),GPU,OTHER", {}, true, 0},
ConfigParams{"CPU(NA),GPU,OTHER", {}, true, 0},
ConfigParams{"INVALID_DEVICE", {}, false, 0},
+ // GPU will be expanded to GPU.0 and GPU.1 with same device priority(0).
+ ConfigParams{"GPU",
+ {
+ {"GPU.0", {}, -1, "", std::string(igpuFullDeviceName) + "_0", 0},
+ {"GPU.1", {}, -1, "", std::string(dgpuFullDeviceName) + "_1", 0},
+ },
+ false,
+ 2},
ConfigParams{"INVALID_DEVICE,CPU", {{"CPU", {}, -1, "", "CPU_", 1}}, false, 2},
ConfigParams{"CPU(3),GPU.1,OTHER",