Skip to content

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

[core]Align naming of members and function in core_impl (#32659)

Pawel Raasz19a16f132a3f
diff --git a/src/inference/src/cpp/core.cpp b/src/inference/src/cpp/core.cpp
index 1f394b27da5..b9e9c182578 100644
--- a/src/inference/src/cpp/core.cpp
+++ b/src/inference/src/cpp/core.cpp
@@ -104,7 +104,7 @@ std::shared_ptr<ov::Model> Core::read_model(const std::string& model, const ov::
CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model, const AnyMap& config) {
OV_ITT_SCOPED_REGION_BASE(ov::itt::domains::OV, "Compile model");
- return compile_model(model, ov::DEFAULT_DEVICE_NAME, config);
+ return compile_model(model, ov::default_device_name, config);
}
CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model,
@@ -119,7 +119,7 @@ CompiledModel Core::compile_model(const std::shared_ptr<const ov::Model>& model,
CompiledModel Core::compile_model(const std::string& model_path, const AnyMap& config) {
OV_ITT_SCOPED_REGION_BASE(ov::itt::domains::OV, "Compile model");
- return compile_model(model_path, ov::DEFAULT_DEVICE_NAME, config);
+ return compile_model(model_path, ov::default_device_name, config);
}
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
@@ -279,8 +279,8 @@ RemoteContext Core::create_context(const std::string& device_name, const AnyMap&
OPENVINO_ASSERT(device_name.find("BATCH") != 0, "BATCH device does not support remote context");
OV_CORE_CALL_STATEMENT({
- auto parsed = parseDeviceNameIntoConfig(device_name, params);
- auto remoteContext = _impl->get_plugin(parsed._deviceName).create_context(parsed._config);
+ auto parsed = parse_device_name_into_config(device_name, params);
+ auto remoteContext = _impl->get_plugin(parsed.m_device_name).create_context(parsed.m_config);
return {remoteContext._ptr, remoteContext._so};
});
}
@@ -292,8 +292,8 @@ RemoteContext Core::get_default_context(const std::string& device_name) {
OPENVINO_ASSERT(device_name.find("BATCH") != 0, "BATCH device does not support default remote context");
OV_CORE_CALL_STATEMENT({
- auto parsed = parseDeviceNameIntoConfig(device_name, AnyMap{});
- auto remoteContext = _impl->get_plugin(parsed._deviceName).get_default_context(parsed._config);
+ auto parsed = parse_device_name_into_config(device_name, AnyMap{});
+ auto remoteContext = _impl->get_plugin(parsed.m_device_name).get_default_context(parsed.m_config);
return {remoteContext._ptr, remoteContext._so};
});
}
diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp
index 554ade50307..6637d839618 100644
--- a/src/inference/src/dev/core_impl.cpp
+++ b/src/inference/src/dev/core_impl.cpp
@@ -195,12 +195,12 @@ DevicePriority get_device_priority_property(const std::string& device_name) {
DevicePriority{ov::device::id.name(), MatchType::SUBSTR};
}
-void clean_batch_properties(const std::string& deviceName, ov::AnyMap& config, const ov::PropertyName& property_name) {
+void clean_batch_properties(const std::string& device_name, ov::AnyMap& config, const ov::PropertyName& property_name) {
// auto-batching is not applicable, if there is auto_batch_timeout, delete it
- if (deviceName.find("BATCH") == std::string::npos) {
+ if (device_name.find("BATCH") == std::string::npos) {
const auto& batch_timeout_mode = config.find(property_name);
if (batch_timeout_mode != config.end()) {
- if (!ov::is_virtual_device(deviceName))
+ if (!ov::is_virtual_device(device_name))
config.erase(batch_timeout_mode);
}
}
@@ -287,15 +287,16 @@ bool ov::is_config_applicable(const std::string& user_device_name, const std::st
if (user_device_name == subprop_device_name)
return true;
- auto parsed_user_device_name = ov::parseDeviceNameIntoConfig(user_device_name);
- auto parsed_subprop_device_name = ov::parseDeviceNameIntoConfig(subprop_device_name);
+ auto parsed_user_device_name = ov::parse_device_name_into_config(user_device_name);
+ auto parsed_subprop_device_name = ov::parse_device_name_into_config(subprop_device_name);
// if device name is matched, check additional condition
auto is_matched = [&](const std::string& key, MatchType match_type) -> bool {
- const auto& user_value =
- parsed_user_device_name._config.count(key) ? parsed_user_device_name._config.at(key).as<std::string>() : "";
- const auto& subprop_value = parsed_subprop_device_name._config.count(key)
- ? parsed_subprop_device_name._config.at(key).as<std::string>()
+ const auto& user_value = parsed_user_device_name.m_config.count(key)
+ ? parsed_user_device_name.m_config.at(key).as<std::string>()
+ : "";
+ const auto& subprop_value = parsed_subprop_device_name.m_config.count(key)
+ ? parsed_subprop_device_name.m_config.at(key).as<std::string>()
: "";
if (!user_value.empty() && subprop_value.empty()) {
@@ -306,8 +307,8 @@ bool ov::is_config_applicable(const std::string& user_device_name, const std::st
return false;
};
- if (parsed_user_device_name._deviceName == parsed_subprop_device_name._deviceName) {
- auto device_priority = get_device_priority_property(parsed_user_device_name._deviceName);
+ if (parsed_user_device_name.m_device_name == parsed_subprop_device_name.m_device_name) {
+ auto device_priority = get_device_priority_property(parsed_user_device_name.m_device_name);
return is_matched(device_priority.prop_name, device_priority.match_type);
}
@@ -348,8 +349,8 @@ ov::Parsed parse_device_config(const std::string& device_name,
* 'flatten_sub_properties' call to have proper behavior
*/
ov::Parsed parsed{device_name, flatten_sub_properties(device_name, properties), core_config};
- auto& updated_device_name = parsed._deviceName;
- auto& updated_config = parsed._config;
+ auto& updated_device_name = parsed.m_device_name;
+ auto& updated_config = parsed.m_config;
std::string parsed_device_priority;
@@ -383,7 +384,7 @@ ov::Parsed parse_device_config(const std::string& device_name,
}
};
- parsed._core_config.set(updated_config);
+ parsed.m_core_config.set(updated_config);
// keep batch property only when called from query_supported_property
if (!keep_auto_batch_property) {
for (const auto& name : auto_batch_properties_names) {
@@ -394,22 +395,22 @@ ov::Parsed parse_device_config(const std::string& device_name,
}
} // namespace
-ov::Parsed ov::parseDeviceNameIntoConfig(const std::string& deviceName,
- const AnyMap& config,
- const bool keep_auto_batch_property) {
- return parseDeviceNameIntoConfig(deviceName, CoreConfig{}, config, keep_auto_batch_property);
+ov::Parsed ov::parse_device_name_into_config(const std::string& device_name,
+ const AnyMap& config,
+ const bool keep_auto_batch_property) {
+ return parse_device_name_into_config(device_name, CoreConfig{}, config, keep_auto_batch_property);
}
-ov::Parsed ov::parseDeviceNameIntoConfig(const std::string& deviceName,
- const CoreConfig& coreConfig,
- const AnyMap& config,
- const bool keep_auto_batch_property) {
- auto parsed = parse_device_config(deviceName, coreConfig, config, keep_auto_batch_property);
+ov::Parsed ov::parse_device_name_into_config(const std::string& device_name,
+ const CoreConfig& core_config,
+ const AnyMap& config,
+ const bool keep_auto_batch_property) {
+ auto parsed = parse_device_config(device_name, core_config, config, keep_auto_batch_property);
// remove core properties for HW devices
- if (!ov::is_virtual_device(parsed._deviceName)) {
+ if (!ov::is_virtual_device(parsed.m_device_name)) {
// note: ov::cache_dir kept as plugin may require it
- CoreConfig::remove_core_skip_cache_dir(parsed._config);
+ CoreConfig::remove_core_skip_cache_dir(parsed.m_config);
}
return parsed;
}
@@ -418,7 +419,7 @@ ov::CoreImpl::CoreImpl() {
add_mutex(""); // Register global mutex
m_executor_manager = ov::threading::executor_manager();
for (const auto& it : ov::get_available_opsets()) {
- opsetNames.insert(it.first);
+ m_opset_names.insert(it.first);
}
}
@@ -427,9 +428,9 @@ bool ov::CoreImpl::is_proxy_device(const ov::Plugin& plugin) const {
}
bool ov::CoreImpl::is_proxy_device(const std::string& dev_name) const {
#ifdef PROXY_PLUGIN_ENABLED
- std::string real_name = ov::parseDeviceNameIntoConfig(dev_name)._deviceName;
- return pluginRegistry.find(real_name) != pluginRegistry.end() &&
- pluginRegistry.at(real_name).pluginCreateFunc == ov::proxy::create_plugin;
+ std::string real_name = ov::parse_device_name_into_config(dev_name).m_device_name;
+ return m_plugin_registry.find(real_name) != m_plugin_registry.end() &&
+ m_plugin_registry.at(real_name).m_plugin_create_func == ov::proxy::create_plugin;
#else
return false;
#endif
@@ -438,25 +439,25 @@ bool ov::CoreImpl::is_proxy_device(const std::string& dev_name) const {
void ov::CoreImpl::register_plugin_in_registry_unsafe(const std::string& device_name, PluginDescriptor& desc) {
#ifdef PROXY_PLUGIN_ENABLED
// Update proxy plugin config
- const auto& fill_config = [](ov::AnyMap& defaultConfig, const ov::AnyMap& config, const std::string& dev_name) {
+ const auto& fill_config = [](ov::AnyMap& m_default_config, const ov::AnyMap& config, const std::string& dev_name) {
// Configure aliases for proxy plugin
auto it = config.find(ov::proxy::configuration::alias.name());
std::string alias;
if (it != config.end()) {
alias = it->second.as<std::string>();
- if (defaultConfig.find(ov::proxy::alias_for.name()) == defaultConfig.end()) {
- defaultConfig[ov::proxy::alias_for.name()] = std::vector<std::string>();
+ if (m_default_config.find(ov::proxy::alias_for.name()) == m_default_config.end()) {
+ m_default_config[ov::proxy::alias_for.name()] = std::vector<std::string>();
}
- defaultConfig[ov::proxy::alias_for.name()].as<std::vector<std::string>>().emplace_back(dev_name);
+ m_default_config[ov::proxy::alias_for.name()].as<std::vector<std::string>>().emplace_back(dev_name);
}
// Configure device order for proxy_plugin
it = config.find(ov::proxy::configuration::priority.name());
if (it != config.end()) {
- if (defaultConfig.find(ov::proxy::device_priorities.name()) == defaultConfig.end()) {
- defaultConfig[ov::proxy::device_priorities.name()] = std::vector<std::string>();
+ if (m_default_config.find(ov::proxy::device_priorities.name()) == m_default_config.end()) {
+ m_default_config[ov::proxy::device_priorities.name()] = std::vector<std::string>();
}
- defaultConfig[ov::proxy::device_priorities.name()].as<std::vector<std::string>>().emplace_back(
+ m_default_config[ov::proxy::device_priorities.name()].as<std::vector<std::string>>().emplace_back(
dev_name + ":" + it->second.as<std::string>());
}
@@ -468,10 +469,11 @@ void ov::CoreImpl::register_plugin_in_registry_unsafe(const std::string& device_
if (it != config.end()) {
auto fallback = it->second.as<std::string>();
// Change fallback name if fallback is configured to the HW plugin under the proxy with the same name
- if (defaultConfig.find(ov::device::priorities.name()) == defaultConfig.end()) {
- defaultConfig[ov::device::priorities.name()] = std::vector<std::string>{dev_name, std::move(fallback)};
+ if (m_default_config.find(ov::device::priorities.name()) == m_default_config.end()) {
+ m_default_config[ov::device::priorities.name()] =
+ std::vector<std::string>{dev_name, std::move(fallback)};
} else {
- auto dev_order = defaultConfig[ov::device::priorities.name()].as<std::vector<std::string>>();
+ auto dev_order = m_default_config[ov::device::priorities.name()].as<std::vector<std::string>>();
auto begin_it = std::find(dev_order.begin(), dev_order.end(), dev_name);
auto end_it = std::find(dev_order.begin(), dev_order.end(), fallback);
OPENVINO_ASSERT(begin_it == dev_order.end() && end_it == dev_order.end(),
@@ -487,7 +489,7 @@ void ov::CoreImpl::register_plugin_in_registry_unsafe(const std::string& device_
// Insert primary device before the fallback device
dev_order.insert(end_it, dev_name);
}
- defaultConfig[ov::device::priorities.name()] = dev_order;
+ m_default_config[ov::device::priorities.name()] = dev_order;
}
}
};
@@ -495,7 +497,7 @@ void ov::CoreImpl::register_plugin_in_registry_unsafe(const std::string& device_
std::string dev_name = device_name;
#ifdef PROXY_PLUGIN_ENABLED
- auto&& config = desc.defaultConfig;
+ auto&& config = desc.m_default_config;
// Register proxy plugin
if (config.find(ov::proxy::configuration::alias.name()) != config.end()) {
// Create proxy plugin for alias
@@ -503,36 +505,36 @@ void ov::CoreImpl::register_plugin_in_registry_unsafe(const std::string& device_
if (alias == device_name)
dev_name = get_internal_plugin_name(dev_name, config);
// Alias can be registered by several plugins
- if (pluginRegistry.find(alias) == pluginRegistry.end()) {
+ if (m_plugin_registry.find(alias) == m_plugin_registry.end()) {
// Register new plugin
PluginDescriptor desc = PluginDescriptor(ov::proxy::create_plugin);
// Add internal name for proxy in order to modify fallback order before the initialization
if (alias == device_name)
- desc.defaultConfig[ov::proxy::configuration::internal_name.name()] = dev_name;
+ desc.m_default_config[ov::proxy::configuration::internal_name.name()] = dev_name;
- fill_config(desc.defaultConfig, config, dev_name);
- pluginRegistry[alias] = std::move(desc);
+ fill_config(desc.m_default_config, config, dev_name);
+ m_plugin_registry[alias] = std::move(desc);
add_mutex(alias);
} else {
// Update registered plugin
- auto& plugin = pluginRegistry.at(alias);
+ auto& plugin = m_plugin_registry.at(alias);
// Error if we have an alias for HW plugin
- OPENVINO_ASSERT(plugin.pluginCreateFunc == ov::proxy::create_plugin,
+ OPENVINO_ASSERT(plugin.m_plugin_create_func == ov::proxy::create_plugin,
"Cannot register plugin for ",
dev_name,
" plugin with the same name already registered!");
// Add internal name for proxy in order to modify fallback order before the initialization
if (alias == device_name)
- plugin.defaultConfig[ov::proxy::configuration::internal_name.name()] = dev_name;
- fill_config(plugin.defaultConfig, config, dev_name);
+ plugin.m_default_config[ov::proxy::configuration::internal_name.name()] = dev_name;
+ fill_config(plugin.m_default_config, config, dev_name);
}
} else if (config.find(ov::proxy::configuration::fallback.name()) != config.end()) {
// Fallback without alias means that we need to replace original plugin to proxy
dev_name = get_internal_plugin_name(dev_name, config);
PluginDescriptor desc = PluginDescriptor(ov::proxy::create_plugin);
- desc.defaultConfig[ov::proxy::configuration::internal_name.name()] = dev_name;
- fill_config(desc.defaultConfig, config, dev_name);
- pluginRegistry[device_name] = std::move(desc);
+ desc.m_default_config[ov::proxy::configuration::internal_name.name()] = dev_name;
+ fill_config(desc.m_default_config, config, dev_name);
+ m_plugin_registry[device_name] = std::move(desc);
add_mutex(device_name);
}
@@ -543,14 +545,14 @@ void ov::CoreImpl::register_plugin_in_registry_unsafe(const std::string& device_
// Register real plugin
for (const auto& proxy_prop : proxy_conf_properties) {
- auto it = desc.defaultConfig.find(proxy_prop);
- if (it != desc.defaultConfig.end()) {
- desc.defaultConfig.erase(it);
+ auto it = desc.m_default_config.find(proxy_prop);
+ if (it != desc.m_default_config.end()) {
+ desc.m_default_config.erase(it);
}
}
#endif
- pluginRegistry[dev_name] = desc;
+ m_plugin_registry[dev_name] = desc;
add_mutex(dev_name);
}
@@ -567,23 +569,23 @@ void ov::CoreImpl::register_compile_time_plugins() {
const decltype(::get_compiled_plugins_registry())& plugins = get_compiled_plugins_registry();
for (const auto& plugin : plugins) {
- const auto& deviceName = plugin.first;
- if (deviceName.find('.') != std::string::npos) {
+ const auto& device_name = plugin.first;
+ if (device_name.find('.') != std::string::npos) {
OPENVINO_THROW("Device name must not contain dot '.' symbol");
}
#ifdef OPENVINO_STATIC_LIBRARY
- if (pluginRegistry.find(deviceName) == pluginRegistry.end()) {
+ if (m_plugin_registry.find(device_name) == m_plugin_registry.end()) {
const auto& value = plugin.second;
ov::AnyMap config = any_copy(value.m_default_config);
PluginDescriptor desc{value.m_create_plugin_func, config, value.m_create_extensions_func};
- register_plugin_in_registry_unsafe(deviceName, desc);
+ register_plugin_in_registry_unsafe(device_name, desc);
}
#else
const auto& pluginPath = ov::util::get_compiled_plugin_path(plugin.second.m_plugin_path);
- if (pluginRegistry.find(deviceName) == pluginRegistry.end() && ov::util::file_exists(pluginPath)) {
+ if (m_plugin_registry.find(device_name) == m_plugin_registry.end() && ov::util::file_exists(pluginPath)) {
ov::AnyMap config = any_copy(plugin.second.m_default_config);
PluginDescriptor desc{pluginPath, config};
- register_plugin_in_registry_unsafe(deviceName, desc);
+ register_plugin_in_registry_unsafe(device_name, desc);
}
#endif
}
@@ -596,19 +598,19 @@ void ov::CoreImpl::register_plugins_in_registry(const std::string& xml_config_fi
OPENVINO_THROW(parse_result.error_msg);
}
- pugi::xml_document& xmlDoc = *parse_result.xml;
+ pugi::xml_document& xml_doc = *parse_result.xml;
- pugi::xml_node ieNode = xmlDoc.document_element();
- pugi::xml_node devicesNode = ieNode.child("plugins");
+ pugi::xml_node ie_node = xml_doc.document_element();
+ pugi::xml_node devices_node = ie_node.child("plugins");
std::lock_guard<std::mutex> lock(get_mutex());
- FOREACH_CHILD (pluginNode, devicesNode, "plugin") {
- std::string deviceName = pugixml::get_str_attr(pluginNode, "name");
- if (pluginRegistry.find(deviceName) != pluginRegistry.end()) {
- OPENVINO_THROW("Device with \"", deviceName, "\" is already registered in the OpenVINO Runtime");
+ FOREACH_CHILD (pluginNode, devices_node, "plugin") {
+ std::string device_name = pugixml::get_str_attr(pluginNode, "name");
+ if (m_plugin_registry.find(device_name) != m_plugin_registry.end()) {
+ OPENVINO_THROW("Device with \"", device_name, "\" is already registered in the OpenVINO Runtime");
}
- if (deviceName.find('.') != std::string::npos) {
+ if (device_name.find('.') != std::string::npos) {
OPENVINO_THROW("Device name must not contain dot '.' symbol");
}
@@ -641,45 +643,45 @@ void ov::CoreImpl::register_plugins_in_registry(const std::string& xml_config_fi
// fill value in plugin registry for later lazy initialization
{
PluginDescriptor desc{pluginPath, config, listOfExtentions};
- register_plugin_in_registry_unsafe(deviceName, desc);
+ register_plugin_in_registry_unsafe(device_name, desc);
}
}
}
-ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
+ov::Plugin ov::CoreImpl::get_plugin(const std::string& plugin_name) const {
OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::LoadTime, "CoreImpl::get_plugin");
- auto deviceName = pluginName;
- if (deviceName == ov::DEFAULT_DEVICE_NAME)
- deviceName = "AUTO";
- if (deviceName == "(CPU)")
- deviceName = "CPU";
- stripDeviceName(deviceName, "-");
+ auto device_name = plugin_name;
+ if (device_name == ov::default_device_name)
+ device_name = "AUTO";
+ if (device_name == "(CPU)")
+ device_name = "CPU";
+ stripDeviceName(device_name, "-");
std::map<std::string, PluginDescriptor>::const_iterator it;
{
// Global lock to find plugin.
- // Always use global mutex if iterate over plugins or pluginRegistry
+ // Always use global mutex if iterate over plugins or m_plugin_registry
std::lock_guard<std::mutex> g_lock(get_mutex());
// Plugin is not created, check that plugin is registered
- it = pluginRegistry.find(deviceName);
- if (it == pluginRegistry.end()) {
- if (pluginName == ov::DEFAULT_DEVICE_NAME)
+ it = m_plugin_registry.find(device_name);
+ if (it == m_plugin_registry.end()) {
+ if (plugin_name == ov::default_device_name)
OPENVINO_THROW("No device is provided, so AUTO device is used by default, which is not registered in "
"the OpenVINO Runtime.");
else
- OPENVINO_THROW("Device with \"", deviceName, "\" name is not registered in the OpenVINO Runtime");
+ OPENVINO_THROW("Device with \"", device_name, "\" name is not registered in the OpenVINO Runtime");
}
}
- std::lock_guard<std::mutex> lock(get_mutex(deviceName));
+ std::lock_guard<std::mutex> lock(get_mutex(device_name));
PluginDescriptor desc;
{
// Global lock to find plugin.
- // Always use global mutex if iterate over plugins or pluginRegistry
+ // Always use global mutex if iterate over plugins or m_plugin_registry
std::lock_guard<std::mutex> g_lock(get_mutex());
- auto it_plugin = plugins.find(deviceName);
- if (it_plugin != plugins.end())
+ auto it_plugin = m_plugins.find(device_name);
+ if (it_plugin != m_plugins.end())
return it_plugin->second;
desc = it->second;
@@ -689,22 +691,22 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
try {
ov::Plugin plugin;
- if (desc.pluginCreateFunc) { // static OpenVINO case or proxy plugin
+ if (desc.m_plugin_create_func) { // static OpenVINO case or proxy plugin
std::shared_ptr<ov::IPlugin> plugin_impl;
- desc.pluginCreateFunc(plugin_impl);
+ desc.m_plugin_create_func(plugin_impl);
plugin = Plugin{plugin_impl, {}};
} else {
- so = ov::util::load_shared_object(desc.libraryLocation.c_str());
+ so = ov::util::load_shared_object(desc.m_lib_location.c_str());
std::shared_ptr<ov::IPlugin> plugin_impl;
reinterpret_cast<ov::CreatePluginFunc*>(ov::util::get_symbol(so, ov::create_plugin_function))(plugin_impl);
const auto& plugin_name = plugin_impl->get_device_name();
// Check that device plugin name is the same as requested for HW plugins
if (!plugin_name.empty() && !ov::is_virtual_device(plugin_name)) {
- OPENVINO_ASSERT(deviceName.find(plugin_name) != std::string::npos,
- desc.libraryLocation,
+ OPENVINO_ASSERT(device_name.find(plugin_name) != std::string::npos,
+ desc.m_lib_location,
" is used for ",
- deviceName,
+ device_name,
" , while it contains implementation for ",
plugin_name);
}
@@ -712,7 +714,7 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
}
{
- plugin.set_name(deviceName);
+ plugin.set_name(device_name);
// Set Core class reference to plugins
std::weak_ptr<ov::ICore> mutableCore =
@@ -725,26 +727,26 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
#ifdef PROXY_PLUGIN_ENABLED
// Initial setup for proxy plugin.
// It is needed for future initialization to initialize low level plugin
- if (desc.pluginCreateFunc == ov::proxy::create_plugin) {
+ if (desc.m_plugin_create_func == ov::proxy::create_plugin) {
ov::AnyMap initial_config;
- auto it = desc.defaultConfig.find(ov::proxy::alias_for.name());
- if (it != desc.defaultConfig.end()) {
+ auto it = desc.m_default_config.find(ov::proxy::alias_for.name());
+ if (it != desc.m_default_config.end()) {
initial_config[it->first] = it->second;
}
- it = desc.defaultConfig.find(ov::proxy::device_priorities.name());
- if (it != desc.defaultConfig.end()) {
+ it = desc.m_default_config.find(ov::proxy::device_priorities.name());
+ if (it != desc.m_default_config.end()) {
initial_config[it->first] = it->second;
}
- it = desc.defaultConfig.find(ov::device::priorities.name());
- if (it != desc.defaultConfig.end()) {
+ it = desc.m_default_config.find(ov::device::priorities.name());
+ if (it != desc.m_default_config.end()) {
// Fix fallback names in case if proxy plugin got a conflict in the process of plugins registration
auto priorities = it->second.as<std::vector<std::string>>();
- auto internal_name = desc.defaultConfig.find(ov::proxy::configuration::internal_name.name());
+ auto internal_name = desc.m_default_config.find(ov::proxy::configuration::internal_name.name());
for (auto&& priority : priorities) {
- if (priority == deviceName) {
- OPENVINO_ASSERT(internal_name != desc.defaultConfig.end(),
+ if (priority == device_name) {
+ OPENVINO_ASSERT(internal_name != desc.m_default_config.end(),
"Cannot create proxy device ",
- deviceName,
+ device_name,
". Device has incorrect configuration.");
priority = internal_name->second.as<std::string>();
}
@@ -756,7 +758,7 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
plugin.get_property(ov::available_devices);
} catch (const ov::Exception& ex) {
OPENVINO_THROW("Failed to create plugin for device ",
- deviceName,
+ device_name,
"\nPlease, check your environment\n",
ex.what());
}
@@ -767,13 +769,13 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
{
OPENVINO_SUPPRESS_DEPRECATED_START
if (device_supports_cache_dir(plugin)) {
- auto cacheConfig = coreConfig.get_cache_config_for_device(plugin);
- if (cacheConfig._cacheManager) {
- desc.defaultConfig[ov::cache_dir.name()] = cacheConfig._cacheDir;
+ auto cache_config = m_core_config.get_cache_config_for_device(plugin);
+ if (cache_config.m_cache_manager) {
+ desc.m_default_config[ov::cache_dir.name()] = cache_config.m_cache_dir;
}
- } else if (desc.defaultConfig.count(ov::cache_dir.name()) > 0) {
+ } else if (desc.m_default_config.count(ov::cache_dir.name()) > 0) {
// Remove "CACHE_DIR" from config if it is not supported by plugin
- desc.defaultConfig.erase(ov::cache_dir.name());
+ desc.m_default_config.erase(ov::cache_dir.name());
}
OPENVINO_SUPPRESS_DEPRECATED_END
}
@@ -791,20 +793,20 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
// device IDs
{
std::unique_lock<std::mutex> g_lock(get_mutex());
- for (auto pluginDesc : pluginRegistry) {
+ for (auto pluginDesc : m_plugin_registry) {
ov::DeviceIDParser parser(pluginDesc.first);
- if (pluginDesc.first.find(deviceName) != std::string::npos &&
+ if (pluginDesc.first.find(device_name) != std::string::npos &&
!parser.get_device_id().empty()) {
g_lock.unlock();
- pluginDesc.second.defaultConfig[deviceKey] = parser.get_device_id();
- plugin.set_property(pluginDesc.second.defaultConfig);
+ pluginDesc.second.m_default_config[deviceKey] = parser.get_device_id();
+ plugin.set_property(pluginDesc.second.m_default_config);
}
}
}
}
// set global device-id independent settings to plugin
- plugin.set_property(desc.defaultConfig);
+ plugin.set_property(desc.m_default_config);
});
}
@@ -812,23 +814,23 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {
std::lock_guard<std::mutex> g_lock(get_mutex());
std::vector<ov::Extension::Ptr> ext;
- if (desc.extensionCreateFunc) { // static OpenVINO case
+ if (desc.m_extension_create_func) { // static OpenVINO case
try {
- desc.extensionCreateFunc(ext);
+ desc.m_extension_create_func(ext);
} catch (const ov::Exception&) {
// the same extension can be registered multiple times - ignore it!
}
} else {
- ext = try_get_extensions(desc.libraryLocation);
+ ext = try_get_extensions(desc.m_lib_location);
}
- std::move(ext.begin(), ext.end(), std::back_inserter(pluginRegistry.at(deviceName).extensions));
+ std::move(ext.begin(), ext.end(), std::back_inserter(m_plugin_registry.at(device_name).m_extensions));
- return plugins.emplace(deviceName, plugin).first->second;
+ return m_plugins.emplace(device_name, plugin).first->second;
} catch (const ov::Exception& ex) {
OPENVINO_THROW("Failed to create plugin ",
- desc.libraryLocation,
+ desc.m_lib_location,
" for device ",
- deviceName,
+ device_name,
"\n",
"Please, check your environment\n",
ex.what(),
@@ -845,23 +847,24 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
// if auto-batching is applicable, the below function will patch the device name and config accordingly:
const auto model = apply_auto_batching(model_, patched_device_name, config_with_batch);
- auto parsed = parseDeviceNameIntoConfig(patched_device_name,
- coreConfig,
- config_with_batch,
- is_proxy_device(patched_device_name));
- auto plugin = get_plugin(parsed._deviceName);
+ auto parsed = parse_device_name_into_config(patched_device_name,
+ m_core_config,
+ config_with_batch,
+ is_proxy_device(patched_device_name));
+ auto plugin = get_plugin(parsed.m_device_name);
// will consume ov::cache_dir if plugin not support it
- const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;
- auto res = import_compiled_model(plugin, {}, parsed._config, model);
+ const auto cache_manager =
+ parsed.m_core_config.get_cache_config_for_device(plugin, parsed.m_config).m_cache_manager;
+ auto res = import_compiled_model(plugin, {}, parsed.m_config, model);
// Skip caching for proxy plugin. HW plugin will load network from the cache
if (res) {
// hint::compiled_blob is set and imported skip compilation
- } else if (cache_manager && device_supports_model_caching(plugin, parsed._config) && !is_proxy_device(plugin)) {
+ } else if (cache_manager && device_supports_model_caching(plugin, parsed.m_config) && !is_proxy_device(plugin)) {
CacheContent cache_content{cache_manager,
- parsed._core_config.get_enable_mmap(),
+ parsed.m_core_config.get_enable_mmap(),
get_cache_model_path(config).string()};
- const auto compiled_config = create_compile_config(plugin, parsed._config);
- cache_content.blobId = ModelCache::compute_hash(model, cache_content.modelPath, compiled_config);
+ const auto compiled_config = create_compile_config(plugin, parsed.m_config);
+ cache_content.m_blob_id = ModelCache::compute_hash(model, cache_content.m_model_path, compiled_config);
cache_content.model = model;
const auto& cache_mode_it = config.find(cache_mode.name());
@@ -869,16 +872,16 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
const auto& rt_info = model->get_rt_info();
auto weights_path = rt_info.find("__weights_path");
if (weights_path != rt_info.end()) {
- parsed._config[ov::weights_path.name()] = weights_path->second;
+ parsed.m_config[ov::weights_path.name()] = weights_path->second;
}
}
- const auto lock = cacheGuard.get_hash_lock(cache_content.blobId);
- res = load_model_from_cache(cache_content, plugin, parsed._config, {}, [&]() {
- return compile_model_and_cache(plugin, model, parsed._config, {}, cache_content);
+ const auto lock = m_cache_guard.get_hash_lock(cache_content.m_blob_id);
+ res = load_model_from_cache(cache_content, plugin, parsed.m_config, {}, [&]() {
+ return compile_model_and_cache(plugin, model, parsed.m_config, {}, cache_content);
});
} else {
- res = plugin.compile_model(model, parsed._config);
+ res = plugin.compile_model(model, parsed.m_config);
}
return res;
}
@@ -894,26 +897,28 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
// if auto-batching is applicable, the below function will patch the device name and config accordingly:
const auto model = apply_auto_batching(model_, device_name, config_with_batch);
- auto parsed = parseDeviceNameIntoConfig(device_name, coreConfig, config_with_batch, is_proxy_device(device_name));
- auto plugin = get_plugin(parsed._deviceName);
+ auto parsed =
+ parse_device_name_into_config(device_name, m_core_config, config_with_batch, is_proxy_device(device_name));
+ auto plugin = get_plugin(parsed.m_device_name);
// will consume ov::cache_dir if plugin not support it
- const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;
- auto res = import_compiled_model(plugin, context, parsed._config, model);
+ const auto cache_manager =
+ parsed.m_core_config.get_cache_config_for_device(plugin, parsed.m_config).m_cache_manager;
+ auto res = import_compiled_model(plugin, context, parsed.m_config, model);
// Skip caching for proxy plugin. HW plugin will load network from the cache
if (res) {
// hint::compiled_blob is set and imported skip compilation
- } else if (cache_manager && device_supports_model_caching(plugin, parsed._config) && !is_proxy_device(plugin)) {
+ } else if (cache_manager && device_supports_model_caching(plugin, parsed.m_config) && !is_proxy_device(plugin)) {
CacheContent cache_content{cache_manager,
- parsed._core_config.get_enable_mmap(),
+ parsed.m_core_config.get_enable_mmap(),
get_cache_model_path(config).string()};
- const auto compiled_config = create_compile_config(plugin, parsed._config);
- cache_content.blobId = ModelCache::compute_hash(model, cache_content.modelPath, compiled_config);
+ const auto compiled_config = create_compile_config(plugin, parsed.m_config);
+ cache_content.m_blob_id = ModelCache::compute_hash(model, cache_content.m_model_path, compiled_config);
cache_content.model = model;
- res = load_model_from_cache(cache_content, plugin, parsed._config, context, [&]() {
- return compile_model_and_cache(plugin, model, parsed._config, context, cache_content);
+ res = load_model_from_cache(cache_content, plugin, parsed.m_config, context, [&]() {
+ return compile_model_and_cache(plugin, model, parsed.m_config, context, cache_content);
});
} else {
- res = plugin.compile_model(model, context, parsed._config);
+ res = plugin.compile_model(model, context, parsed.m_config);
}
return res;
}
@@ -922,28 +927,30 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::string& mod
const std::string& device_name,
const ov::AnyMap& config) const {
OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::LoadTime, "Core::compile_model::Path");
- auto parsed = parse_device_config(device_name, coreConfig, config, false);
+ auto parsed = parse_device_config(device_name, m_core_config, config, false);
// in case of compile_model(file_name), we need to clear-up core-level properties
- auto plugin = get_plugin(parsed._deviceName);
+ auto plugin = get_plugin(parsed.m_device_name);
// will consume ov::cache_dir if plugin not support it
- const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;
- auto compiled_model = import_compiled_model(plugin, {}, parsed._config, model_path);
+ const auto cache_manager =
+ parsed.m_core_config.get_cache_config_for_device(plugin, parsed.m_config).m_cache_manager;
+ auto compiled_model = import_compiled_model(plugin, {}, parsed.m_config, model_path);
if (compiled_model) {
// hint::compiled_blob is set and imported skip compilation
- } else if (cache_manager && device_supports_model_caching(plugin, parsed._config) && !is_proxy_device(plugin)) {
+ } else if (cache_manager && device_supports_model_caching(plugin, parsed.m_config) && !is_proxy_device(plugin)) {
// Skip caching for proxy plugin. HW plugin will load network from the cache
- CoreConfig::remove_core_skip_cache_dir(parsed._config);
- CacheContent cache_content{cache_manager, parsed._core_config.get_enable_mmap(), model_path};
- cache_content.blobId = ov::ModelCache::compute_hash(model_path, create_compile_config(plugin, parsed._config));
- const auto lock = cacheGuard.get_hash_lock(cache_content.blobId);
- compiled_model = load_model_from_cache(cache_content, plugin, parsed._config, {}, [&]() {
+ CoreConfig::remove_core_skip_cache_dir(parsed.m_config);
+ CacheContent cache_content{cache_manager, parsed.m_core_config.get_enable_mmap(), model_path};
+ cache_content.m_blob_id =
+ ov::ModelCache::compute_hash(model_path, create_compile_config(plugin, parsed.m_config));
+ const auto lock = m_cache_guard.get_hash_lock(cache_content.m_blob_id);
+ compiled_model = load_model_from_cache(cache_content, plugin, parsed.m_config, {}, [&]() {
const auto model =
- util::read_model(model_path, "", get_extensions_copy(), parsed._core_config.get_enable_mmap());
- return compile_model_and_cache(plugin, model, parsed._config, {}, cache_content);
+ util::read_model(model_path, "", get_extensions_copy(), parsed.m_core_config.get_enable_mmap());
+ return compile_model_and_cache(plugin, model, parsed.m_config, {}, cache_content);
});
} else {
- compiled_model = plugin.compile_model(model_path, parsed._config);
+ compiled_model = plugin.compile_model(model_path, parsed.m_config);
}
return compiled_model;
}
@@ -953,26 +960,27 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::string& mod
const std::string& device_name,
const ov::AnyMap& config) const {
OV_ITT_SCOPED_TASK(ov::itt::domains::OV, "Core::compile_model::from_memory");
- auto parsed = parseDeviceNameIntoConfig(device_name, coreConfig, config);
- auto plugin = get_plugin(parsed._deviceName);
+ auto parsed = parse_device_name_into_config(device_name, m_core_config, config);
+ auto plugin = get_plugin(parsed.m_device_name);
// will consume ov::cache_dir if plugin not support it
- const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;
- auto compiled_model = import_compiled_model(plugin, {}, parsed._config);
+ const auto cache_manager =
+ parsed.m_core_config.get_cache_config_for_device(plugin, parsed.m_config).m_cache_manager;
+ auto compiled_model = import_compiled_model(plugin, {}, parsed.m_config);
// Skip caching for proxy plugin. HW plugin will load network from the cache
if (compiled_model) {
// hint::compiled_blob is set and imported skip compilation
- } else if (cache_manager && device_supports_model_caching(plugin, parsed._config) && !is_proxy_device(plugin)) {
- CacheContent cache_content{cache_manager, parsed._core_config.get_enable_mmap()};
- cache_content.blobId =
- ov::ModelCache::compute_hash(model_str, weights, create_compile_config(plugin, parsed._config));
- const auto lock = cacheGuard.get_hash_lock(cache_content.blobId);
- compiled_model = load_model_from_cache(cache_content, plugin, parsed._config, {}, [&]() {
+ } else if (cache_manager && device_supports_model_caching(plugin, parsed.m_config) && !is_proxy_device(plugin)) {
+ CacheContent cache_content{cache_manager, parsed.m_core_config.get_enable_mmap()};
+ cache_content.m_blob_id =
+ ov::ModelCache::compute_hash(model_str, weights, create_compile_config(plugin, parsed.m_config));
+ const auto lock = m_cache_guard.get_hash_lock(cache_content.m_blob_id);
+ compiled_model = load_model_from_cache(cache_content, plugin, parsed.m_config, {}, [&]() {
const auto model = read_model(model_str, weights);
- return compile_model_and_cache(plugin, model, parsed._config, {}, cache_content);
+ return compile_model_and_cache(plugin, model, parsed.m_config, {}, cache_content);
});
} else {
const auto model = read_model(model_str, weights);
- compiled_model = plugin.compile_model(model, parsed._config);
+ compiled_model = plugin.compile_model(model, parsed.m_config);
}
return compiled_model;
}
@@ -981,8 +989,8 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::import_model(std::istream& model,
const std::string& device_name,
const ov::AnyMap& config) const {
OV_ITT_SCOPED_TASK(ov::itt::domains::OV, "Core::import_model");
- auto parsed = parseDeviceNameIntoConfig(device_name, config);
- return get_plugin(parsed._deviceName).import_model(model, parsed._config);
+ auto parsed = parse_device_name_into_config(device_name, config);
+ return get_plugin(parsed.m_device_name).import_model(model, parsed.m_config);
}
ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::import_model(std::istream& modelStream,
@@ -990,16 +998,16 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::import_model(std::istream& modelStre
const ov::AnyMap& config) const {
OV_ITT_SCOPED_TASK(ov::itt::domains::OV, "Core::import_model");
OPENVINO_ASSERT(context, "Remote context must not be empty.");
- const auto parsed = parseDeviceNameIntoConfig(context->get_device_name(), config);
- return get_plugin(parsed._deviceName).import_model(modelStream, context, parsed._config);
+ const auto parsed = parse_device_name_into_config(context->get_device_name(), config);
+ return get_plugin(parsed.m_device_name).import_model(modelStream, context, parsed.m_config);
}
ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::import_model(const ov::Tensor& compiled_blob,
const std::string& device_name,
const ov::AnyMap& config) const {
OV_ITT_SCOPED_TASK(ov::itt::domains::OV, "Core::import_model");
- const auto parsed = parseDeviceNameIntoConfig(device_name, config);
- return get_plugin(parsed._deviceName).import_model(compiled_blob, parsed._config);
+ const auto parsed = parse_device_name_into_config(device_name, config);
+ return get_plugin(parsed.m_device_name).import_model(compiled_blob, parsed.m_config);
}
ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::import_model(const ov::Tensor& compiled_blob,
@@ -1007,25 +1015,25 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::import_model(const ov::Tensor& compi
const ov::AnyMap& config) const {
OV_ITT_SCOPED_TASK(ov::itt::domains::OV, "Core::import_model");
OPENVINO_ASSERT(context, "Remote context must not be empty.");
- const auto parsed = parseDeviceNameIntoConfig(context->get_device_name(), config);
- return get_plugin(parsed._deviceName).import_model(compiled_blob, context, parsed._config);
+ const auto parsed = parse_device_name_into_config(context->get_device_name(), config);
+ return get_plugin(parsed.m_device_name).import_model(compiled_blob, context, parsed.m_config);
}
ov::SupportedOpsMap ov::CoreImpl::query_model(const std::shared_ptr<const ov::Model>& model,
const std::string& device_name,
const ov::AnyMap& config) const {
OV_ITT_SCOPED_TASK(ov::itt::domains::OV, "Core::query_model");
- const auto parsed = parseDeviceNameIntoConfig(device_name, config);
- return get_plugin(parsed._deviceName).query_model(model, parsed._config);
+ const auto parsed = parse_device_name_into_config(device_name, config);
+ return get_plugin(parsed.m_device_name).query_model(model, parsed.m_config);
}
bool ov::CoreImpl::is_hidden_device(const std::string& device_name) const {
#ifdef PROXY_PLUGIN_ENABLED
std::lock_guard<std::mutex> lock(get_mutex());
// Alias hides the device
- for (auto&& it : pluginRegistry) {
- auto it_priority = it.second.defaultConfig.find(ov::proxy::alias_for.name());
- if (it.first == device_name || it_priority == it.second.defaultConfig.end())
+ for (auto&& it : m_plugin_registry) {
+ auto it_priority = it.second.m_default_config.find(ov::proxy::alias_for.name());
+ if (it.first == device_name || it_priority == it.second.m_default_config.end())
continue;
auto devices = it_priority->second.as<std::vector<std::string>>();
for (const auto& dev : devices) {
@@ -1041,34 +1049,34 @@ std::vector<std::string> ov::CoreImpl::get_available_devices() const {
std::vector<std::string> devices;
const std::string propertyName = ov::available_devices.name();
- for (auto&& deviceName : get_registered_devices()) {
+ for (auto&& device_name : get_registered_devices()) {
std::vector<std::string> devicesIDs;
// Skip hidden devices
- if (is_hidden_device(deviceName))
+ if (is_hidden_device(device_name))
continue;
try {
- devicesIDs = get_property(deviceName, ov::available_devices.name(), {}).as<std::vector<std::string>>();
+ devicesIDs = get_property(device_name, ov::available_devices.name(), {}).as<std::vector<std::string>>();
} catch (const ov::Exception&) {
// plugin is not created by e.g. invalid env
} catch (const std::runtime_error&) {
// plugin is not created by e.g. invalid env
} catch (const std::exception& ex) {
OPENVINO_THROW("An exception is thrown while trying to create the ",
- deviceName,
+ device_name,
" device and call GetMetric: ",
ex.what());
} catch (...) {
OPENVINO_THROW("Unknown exception is thrown while trying to create the ",
- deviceName,
+ device_name,
" device and call GetMetric");
}
if (devicesIDs.size() > 1) {
for (auto&& deviceID : devicesIDs) {
- devices.push_back(deviceName + '.' + deviceID);
+ devices.push_back(device_name + '.' + deviceID);
}
} else if (!devicesIDs.empty()) {
- devices.push_back(deviceName);
+ devices.push_back(device_name);
}
}
@@ -1076,8 +1084,8 @@ std::vector<std::string> ov::CoreImpl::get_available_devices() const {
}
ov::SoPtr<ov::IRemoteContext> ov::CoreImpl::create_context(const std::string& device_name, const AnyMap& params) const {
- auto parsed = ov::parseDeviceNameIntoConfig(device_name, params);
- return get_plugin(parsed._deviceName).create_context(parsed._config);
+ auto parsed = ov::parse_device_name_into_config(device_name, params);
+ return get_plugin(parsed.m_device_name).create_context(parsed.m_config);
}
ov::AnyMap ov::CoreImpl::get_supported_property(const std::string& full_device_name,
@@ -1104,8 +1112,8 @@ ov::AnyMap ov::CoreImpl::get_supported_property(const std::string& full_device_n
}
const auto flattened = parse_device_config(full_device_name, {}, user_properties, keep_core_property);
- const auto& flattened_config = flattened._config;
- const auto& device_name = flattened._deviceName;
+ const auto& flattened_config = flattened.m_config;
+ const auto& device_name = flattened.m_device_name;
// virtual plugins should bypass core-level properties to HW plugins
// so, we need to report them as supported
@@ -1148,25 +1156,25 @@ ov::AnyMap ov::CoreImpl::get_supported_property(const std::string& full_device_n
}
ov::SoPtr<ov::IRemoteContext> ov::CoreImpl::get_default_context(const std::string& device_name) const {
- auto parsed = ov::parseDeviceNameIntoConfig(device_name);
- return get_plugin(parsed._deviceName).get_default_context(parsed._config);
+ auto parsed = ov::parse_device_name_into_config(device_name);
+ return get_plugin(parsed.m_device_name).get_default_context(parsed.m_config);
}
std::shared_ptr<const ov::Model> ov::CoreImpl::apply_auto_batching(const std::shared_ptr<const ov::Model>& model,
- std::string& deviceName,
+ std::string& device_name,
ov::AnyMap& config) const {
std::string deviceNameWithBatchSize, deviceNameWithoutBatch;
// fully strict dims tracking by default (Auto-Batching is enabled implicitly)
bool strictly_check_dims = true;
- if (deviceName.find("BATCH") != std::string::npos) {
+ if (device_name.find("BATCH") != std::string::npos) {
// explicitly enabled Auto-Batching
- auto pos = deviceName.find_first_of(":");
+ auto pos = device_name.find_first_of(":");
if (pos == std::string::npos)
return model; // BATCH device is already configured via the config
- deviceNameWithBatchSize = deviceName.substr(pos + 1);
+ deviceNameWithBatchSize = device_name.substr(pos + 1);
deviceNameWithoutBatch = ov::DeviceIDParser::get_batch_device(deviceNameWithBatchSize);
- if (deviceName.find("(") == std::string::npos) {
+ if (device_name.find("(") == std::string::npos) {
auto supported_properties = ICore::get_property(deviceNameWithoutBatch, ov::supported_properties, {});
if (std::find(supported_properties.begin(), supported_properties.end(), ov::optimal_batch_size) ==
supported_properties.end())
@@ -1191,28 +1199,28 @@ std::shared_ptr<const ov::Model> ov::CoreImpl::apply_auto_batching(const std::sh
// e.g. to deduce the #requests correctly
// proxy plugin should also keep the config
// otherwise, no need for this config key in the rest of loading
- if (!ov::is_virtual_device(deviceName) && !is_proxy_device(deviceName))
+ if (!ov::is_virtual_device(device_name) && !is_proxy_device(device_name))
config.erase(batch_mode);
if (disabled)
return model;
}
// check whether if the Auto-Batching is applicable to the device
- auto parsed = ov::parseDeviceNameIntoConfig(deviceName);
+ auto parsed = ov::parse_device_name_into_config(device_name);
// Do not apply auto batch for proxy device
- if (is_proxy_device(parsed._deviceName))
+ if (is_proxy_device(parsed.m_device_name))
return model;
- deviceNameWithoutBatch = deviceName;
- auto metrics = get_plugin(parsed._deviceName)
- .get_property(ov::supported_properties.name(), parsed._config)
+ deviceNameWithoutBatch = device_name;
+ auto metrics = get_plugin(parsed.m_device_name)
+ .get_property(ov::supported_properties.name(), parsed.m_config)
.as<std::vector<ov::PropertyName>>();
auto it = std::find(metrics.begin(), metrics.end(), ov::optimal_batch_size.name());
if (metrics.end() == it)
return model;
// if applicable, the Auto-Batching is implicitly enabled via the performance hints
- bool bTputInPlg = get_plugin(parsed._deviceName)
- .get_property(ov::hint::performance_mode.name(), parsed._config)
+ bool bTputInPlg = get_plugin(parsed.m_device_name)
+ .get_property(ov::hint::performance_mode.name(), parsed.m_config)
.as<ov::hint::PerformanceMode>() == ov::hint::PerformanceMode::THROUGHPUT;
const auto& mode = config.find(ov::hint::performance_mode.name());
bool bTputInLoadCfg = (mode != config.end() &&
@@ -1228,10 +1236,10 @@ std::shared_ptr<const ov::Model> ov::CoreImpl::apply_auto_batching(const std::sh
case ov::details::NetworkBatchAbility::NO:
return model;
case ov::details::NetworkBatchAbility::AS_IS:
- deviceName = "BATCH:" + batchConfig;
+ device_name = "BATCH:" + batchConfig;
break;
case ov::details::NetworkBatchAbility::WITH_HETERO:
- deviceName = "HETERO:BATCH," + deviceNameWithoutBatch;
+ device_name = "HETERO:BATCH," + deviceNameWithoutBatch;
config.insert(ov::device::properties("BATCH", ov::device::priorities(batchConfig)));
break;
}
@@ -1257,7 +1265,7 @@ void ov::CoreImpl::set_property(const std::string& device_name, const AnyMap& pr
for (auto&& config : properties) {
const auto is_secondary_property = config.first.find(ov::device::properties.name()) != std::string::npos;
// It is valid change for proxy plugin, proxy plugin allows to set properties for low level fallback devices
- const auto is_proxy = is_proxy_device(ov::parseDeviceNameIntoConfig(device_name)._deviceName);
+ const auto is_proxy = is_proxy_device(ov::parse_device_name_into_config(device_name).m_device_name);
OPENVINO_ASSERT(!is_secondary_property || is_proxy,
"set_property do not support ov::device::propreties. "
"You can configure the devices through the compile_model()/query_model() API.");
@@ -1270,9 +1278,9 @@ ov::Any ov::CoreImpl::get_property_for_core(const std::string& name) const {
const auto flag = ov::threading::executor_manager()->get_property(name).as<bool>();
return decltype(ov::force_tbb_terminate)::value_type(flag);
} else if (name == ov::cache_dir.name()) {
- return ov::Any(coreConfig.get_cache_dir());
+ return ov::Any(m_core_config.get_cache_dir());
} else if (name == ov::enable_mmap.name()) {
- const auto flag = coreConfig.get_enable_mmap();
+ const auto flag = m_core_config.get_enable_mmap();
return decltype(ov::enable_mmap)::value_type(flag);
}
@@ -1295,24 +1303,24 @@ ov::Any ov::CoreImpl::get_property(const std::string& device_name,
"You can only get_property of the BATCH itself (without devices). "
"get_property is also possible for the individual devices before creating the BATCH on top.");
- auto parsed = parseDeviceNameIntoConfig(device_name, options);
+ auto parsed = parse_device_name_into_config(device_name, options);
- if (parsed._deviceName.empty()) {
+ if (parsed.m_device_name.empty()) {
return get_property_for_core(name);
} else if (name == ov::cache_dir.name()) {
- return coreConfig.get_cache_config_for_device(get_plugin(parsed._deviceName))._cacheDir;
+ return m_core_config.get_cache_config_for_device(get_plugin(parsed.m_device_name)).m_cache_dir;
}
- return get_plugin(parsed._deviceName).get_property(name, parsed._config);
+ return get_plugin(parsed.m_device_name).get_property(name, parsed.m_config);
}
-void ov::CoreImpl::unload_plugin(const std::string& deviceName) {
+void ov::CoreImpl::unload_plugin(const std::string& device_name) {
std::lock_guard<std::mutex> lock(get_mutex());
- auto it = plugins.find(deviceName);
- if (it == plugins.end()) {
- OPENVINO_THROW("Device with \"", deviceName, "\" name is not registered in the OpenVINO Runtime");
+ auto it = m_plugins.find(device_name);
+ if (it == m_plugins.end()) {
+ OPENVINO_THROW("Device with \"", device_name, "\" name is not registered in the OpenVINO Runtime");
}
- pluginRegistry[deviceName].extensions.clear();
- plugins.erase(deviceName);
+ m_plugin_registry[device_name].m_extensions.clear();
+ m_plugins.erase(device_name);
}
void ov::CoreImpl::register_plugin(const std::string& plugin,
@@ -1320,9 +1328,9 @@ void ov::CoreImpl::register_plugin(const std::string& plugin,
const ov::AnyMap& properties) {
std::lock_guard<std::mutex> lock(get_mutex());
- auto it = pluginRegistry.find(device_name);
+ auto it = m_plugin_registry.find(device_name);
// Proxy plugins can be configured in the runtime
- if (it != pluginRegistry.end() && !is_proxy_device(device_name)) {
+ if (it != m_plugin_registry.end() && !is_proxy_device(device_name)) {
OPENVINO_THROW("Device with \"", device_name, "\" is already registered in the OpenVINO Runtime");
}
@@ -1342,7 +1350,7 @@ std::vector<std::string> ov::CoreImpl::get_registered_devices() const {
std::lock_guard<std::mutex> lock(get_mutex());
std::vector<std::string> listOfDevices;
- for (auto&& pluginDesc : pluginRegistry) {
+ for (auto&& pluginDesc : m_plugin_registry) {
listOfDevices.push_back(pluginDesc.first);
}
@@ -1351,80 +1359,83 @@ std::vector<std::string> ov::CoreImpl::get_registered_devices() const {
/**
* @brief Sets property values for a plugin or set of plugins
- * @param deviceName A device name to set config to
+ * @param device_name A device name to set config to
* If empty, config is set for all the plugins / plugin's meta-data
- * @note `deviceName` is not allowed in form of MULTI:CPU, HETERO:GPU,CPU, AUTO:CPU
+ * @note `device_name` is not allowed in form of MULTI:CPU, HETERO:GPU,CPU, AUTO:CPU
* just simple forms like CPU, GPU, MULTI, GPU.0, etc
*/
-void ov::CoreImpl::set_property_for_device(const ov::AnyMap& configMap, const std::string& deviceName) {
- auto config = configMap;
- if (config.empty()) {
+void ov::CoreImpl::set_property_for_device(const ov::AnyMap& config, const std::string& device_name) {
+ auto cfg_copy = config;
+ if (cfg_copy.empty()) {
return;
}
- ov::DeviceIDParser parser(deviceName);
- std::string clearDeviceName = parser.get_device_name();
+ ov::DeviceIDParser parser(device_name);
+ std::string clear_device_name = parser.get_device_name();
std::vector<std::pair<std::string, ov::Plugin>> created_plugins;
{
std::lock_guard<std::mutex> lock(get_mutex());
- created_plugins.reserve(plugins.size());
+ created_plugins.reserve(m_plugins.size());
// TODO: keep only:
- // coreConfig.set_and_update(config);
+ // core_config.set_and_update(config);
// once GPU remove support of ov::cache_dir
// CoreConfg::set_and_update will drop CACHE_DIR from config map
// and updates core config with new ov::cache_dir
- if (deviceName.empty()) {
- coreConfig.set_and_update(config);
+ if (device_name.empty()) {
+ m_core_config.set_and_update(cfg_copy);
} else {
OPENVINO_SUPPRESS_DEPRECATED_START
- auto cache_it = config.find(ov::cache_dir.name());
- if (cache_it != config.end()) {
- coreConfig.set_cache_dir_for_device((cache_it->second).as<std::string>(), clearDeviceName);
- config.erase(cache_it);
+ auto cache_it = cfg_copy.find(ov::cache_dir.name());
+ if (cache_it != cfg_copy.end()) {
+ m_core_config.set_cache_dir_for_device((cache_it->second).as<std::string>(), clear_device_name);
+ cfg_copy.erase(cache_it);
}
OPENVINO_SUPPRESS_DEPRECATED_END
// apply and remove core properties
- auto it = config.find(ov::force_tbb_terminate.name());
- if (it != config.end()) {
+ auto it = cfg_copy.find(ov::force_tbb_terminate.name());
+ if (it != cfg_copy.end()) {
auto flag = it->second.as<bool>();
ov::threading::executor_manager()->set_property({{it->first, flag}});
- config.erase(it);
+ cfg_copy.erase(it);
}
- it = config.find(ov::enable_mmap.name());
- if (it != config.end()) {
- config.erase(it);
+ it = cfg_copy.find(ov::enable_mmap.name());
+ if (it != cfg_copy.end()) {
+ cfg_copy.erase(it);
}
}
- if (!config.empty()) {
- auto base_desc = pluginRegistry.find(clearDeviceName);
- if (pluginRegistry.find(deviceName) == pluginRegistry.end() && base_desc != pluginRegistry.end()) {
- PluginDescriptor desc{base_desc->second.libraryLocation, config, base_desc->second.listOfExtentions};
- pluginRegistry[deviceName] = std::move(desc);
+ if (!cfg_copy.empty()) {
+ auto base_desc = m_plugin_registry.find(clear_device_name);
+ if (m_plugin_registry.find(device_name) == m_plugin_registry.end() &&
+ base_desc != m_plugin_registry.end()) {
+ PluginDescriptor desc{base_desc->second.m_lib_location,
+ cfg_copy,
+ base_desc->second.m_list_of_extensions};
+ m_plugin_registry[device_name] = std::move(desc);
}
// set config for plugins in registry
bool configIsSet = false;
- for (auto& desc : pluginRegistry) {
- if (deviceName.empty() || deviceName == desc.first) {
- for (auto&& conf : config) {
- desc.second.defaultConfig[conf.first] = conf.second;
+ for (auto& desc : m_plugin_registry) {
+ if (device_name.empty() || device_name == desc.first) {
+ for (auto&& conf : cfg_copy) {
+ desc.second.m_default_config[conf.first] = conf.second;
}
configIsSet = true;
}
}
- if (!configIsSet && !deviceName.empty()) {
- OPENVINO_THROW("Device with \"", deviceName, "\" name is not registered in the OpenVINO Runtime");
+ if (!configIsSet && !device_name.empty()) {
+ OPENVINO_THROW("Device with \"", device_name, "\" name is not registered in the OpenVINO Runtime");
}
}
// set config for already created plugins
- for (auto& plugin : plugins) {
- if (deviceName.empty() || clearDeviceName == plugin.first) {
+ for (auto& plugin : m_plugins) {
+ if (device_name.empty() || clear_device_name == plugin.first) {
created_plugins.emplace_back(std::pair<std::string, ov::Plugin>{plugin.first, plugin.second});
}
}
@@ -1433,15 +1444,16 @@ void ov::CoreImpl::set_property_for_device(const ov::AnyMap& configMap, const st
for (auto& plugin : created_plugins) {
allowNotImplemented([&]() {
std::lock_guard<std::mutex> lock(get_mutex(plugin.first));
- auto configCopy = config;
+ auto config_copy = cfg_copy;
// TODO: remove once GPU remove explicit support of ov::cache_dir
{
OPENVINO_SUPPRESS_DEPRECATED_START
if (device_supports_cache_dir(plugin.second)) {
- configCopy[ov::cache_dir.name()] = coreConfig.get_cache_config_for_device(plugin.second)._cacheDir;
- } else if (configCopy.count(ov::cache_dir.name()) > 0) {
+ config_copy[ov::cache_dir.name()] =
+ m_core_config.get_cache_config_for_device(plugin.second).m_cache_dir;
+ } else if (config_copy.count(ov::cache_dir.name()) > 0) {
// Remove "CACHE_DIR" from config if it is not supported by plugin
- configCopy.erase(ov::cache_dir.name());
+ config_copy.erase(ov::cache_dir.name());
}
OPENVINO_SUPPRESS_DEPRECATED_END
}
@@ -1452,22 +1464,22 @@ void ov::CoreImpl::set_property_for_device(const ov::AnyMap& configMap, const st
device_supports_internal_property(plugin.second, ov::internal::config_device_id.name())
? ov::internal::config_device_id.name()
: ov::device::id.name();
- configCopy[deviceKey] = parser.get_device_id();
+ config_copy[deviceKey] = parser.get_device_id();
}
}
- plugin.second.set_property(configCopy);
+ plugin.second.set_property(config_copy);
});
}
}
void ov::CoreImpl::add_extensions_unsafe(const std::vector<ov::Extension::Ptr>& exts) const {
for (const auto& ext : exts) {
- extensions.emplace_back(ext);
+ m_extensions.emplace_back(ext);
auto ext_obj = ext;
if (auto so_ext = std::dynamic_pointer_cast<ov::detail::SOExtension>(ext_obj))
ext_obj = so_ext->extension();
if (auto op_base_ext = std::dynamic_pointer_cast<ov::BaseOpExtension>(ext_obj)) {
for (const auto& attached_ext : op_base_ext->get_attached_extensions()) {
- extensions.emplace_back(attached_ext);
+ m_extensions.emplace_back(attached_ext);
}
}
}
@@ -1475,10 +1487,10 @@ void ov::CoreImpl::add_extensions_unsafe(const std::vector<ov::Extension::Ptr>&
std::vector<ov::Extension::Ptr> ov::CoreImpl::get_extensions_copy() const {
std::lock_guard<std::mutex> lock(get_mutex());
- auto only_extensions = extensions;
+ auto only_extensions = m_extensions;
auto ext_it = std::back_inserter(only_extensions);
- for (const auto& [_, plugin_desc] : pluginRegistry) {
- std::copy(plugin_desc.extensions.begin(), plugin_desc.extensions.end(), ext_it);
+ for (const auto& [_, plugin_desc] : m_plugin_registry) {
+ std::copy(plugin_desc.m_extensions.begin(), plugin_desc.m_extensions.end(), ext_it);
}
return only_extensions;
};
@@ -1489,8 +1501,8 @@ void ov::CoreImpl::add_extension(const std::vector<ov::Extension::Ptr>& extensio
}
bool ov::CoreImpl::device_supports_model_caching(const std::string& device_name) const {
- auto parsed = parseDeviceNameIntoConfig(device_name);
- return device_supports_model_caching(get_plugin(parsed._deviceName));
+ auto parsed = parse_device_name_into_config(device_name);
+ return device_supports_model_caching(get_plugin(parsed.m_device_name));
}
bool ov::CoreImpl::device_supports_property(const ov::Plugin& plugin, const ov::PropertyName& key) const {
@@ -1523,7 +1535,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model_and_cache(ov::Plugin&
OV_ITT_SCOPED_TASK(ov::itt::domains::OV, "CoreImpl::compile_model_and_cache");
ov::SoPtr<ov::ICompiledModel> compiled_model =
context ? plugin.compile_model(model, context, parsedConfig) : plugin.compile_model(model, parsedConfig);
- if (cacheContent.cacheManager && device_supports_model_caching(plugin)) {
+ if (cacheContent.m_cache_manager && device_supports_model_caching(plugin)) {
try {
// need to export network for further import from "cache"
OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::LoadTime, "Core::compile_model::Export");
@@ -1532,7 +1544,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model_and_cache(ov::Plugin&
compiled_model_runtime_properties =
plugin.get_property(ov::internal::compiled_model_runtime_properties.name(), {}).as<std::string>();
}
- cacheContent.cacheManager->write_cache_entry(cacheContent.blobId, [&](std::ostream& networkStream) {
+ cacheContent.m_cache_manager->write_cache_entry(cacheContent.m_blob_id, [&](std::ostream& networkStream) {
uint32_t header_size_alignment{};
if (device_supports_internal_property(plugin, ov::internal::cache_header_alignment.name())) {
header_size_alignment =
@@ -1540,14 +1552,14 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model_and_cache(ov::Plugin&
}
networkStream << ov::CompiledBlobHeader(ov::get_openvino_version().buildNumber,
- ov::ModelCache::calculate_file_info(cacheContent.modelPath),
+ ov::ModelCache::calculate_file_info(cacheContent.m_model_path),
compiled_model_runtime_properties,
header_size_alignment);
compiled_model->export_model(networkStream);
});
} catch (...) {
- cacheContent.cacheManager->remove_cache_entry(cacheContent.blobId);
+ cacheContent.m_cache_manager->remove_cache_entry(cacheContent.m_blob_id);
throw;
}
}
@@ -1563,13 +1575,13 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::load_model_from_cache(
ov::SoPtr<ov::ICompiledModel> compiled_model;
struct HeaderException {};
- OPENVINO_ASSERT(cacheContent.cacheManager != nullptr);
+ OPENVINO_ASSERT(cacheContent.m_cache_manager != nullptr);
try {
- cacheContent.cacheManager->read_cache_entry(
- cacheContent.blobId,
- cacheContent.mmap_enabled && ov::util::contains(plugin.get_property(ov::internal::supported_properties),
- ov::internal::caching_with_mmap),
+ cacheContent.m_cache_manager->read_cache_entry(
+ cacheContent.m_blob_id,
+ cacheContent.m_mmap_enabled && ov::util::contains(plugin.get_property(ov::internal::supported_properties),
+ ov::internal::caching_with_mmap),
[&](ICacheManager::CompiledBlobVariant& compiled_blob) {
OV_ITT_SCOPE(FIRST_INFERENCE,
ov::itt::domains::LoadTime,
@@ -1588,7 +1600,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::load_model_from_cache(
}};
std::visit(header_reader, compiled_blob);
- if (header.get_file_info() != ov::ModelCache::calculate_file_info(cacheContent.modelPath)) {
+ if (header.get_file_info() != ov::ModelCache::calculate_file_info(cacheContent.m_model_path)) {
// Original file is changed, don't use cache
OPENVINO_THROW("Original model file is changed");
}
@@ -1627,7 +1639,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::load_model_from_cache(
path_hint != update_config.end()) {
weights_path = path_hint->second.as<std::string>();
} else if (weights_path = extract_weight_path(header.get_runtime_info()); weights_path.empty()) {
- weights_path = cacheContent.modelPath;
+ weights_path = cacheContent.m_model_path;
}
weights_path.replace_extension(".bin");
@@ -1652,9 +1664,9 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::load_model_from_cache(
});
} catch (const HeaderException&) {
// For these exceptions just remove old cache and set that import didn't work
- cacheContent.cacheManager->remove_cache_entry(cacheContent.blobId);
+ cacheContent.m_cache_manager->remove_cache_entry(cacheContent.m_blob_id);
} catch (...) {
- cacheContent.cacheManager->remove_cache_entry(cacheContent.blobId);
+ cacheContent.m_cache_manager->remove_cache_entry(cacheContent.m_blob_id);
// TODO: temporary disabled by #54335. In future don't throw only for new 'blob_outdated' exception
// throw;
}
@@ -1705,21 +1717,21 @@ ov::AnyMap ov::CoreImpl::create_compile_config(const ov::Plugin& plugin, const o
ov::CoreConfig::CoreConfig(const CoreConfig& other) {
{
- std::lock_guard<std::mutex> lock(other._cacheConfigMutex);
- _cacheConfig = other._cacheConfig;
- _cacheConfigPerDevice = other._cacheConfigPerDevice;
+ std::lock_guard<std::mutex> lock(other.m_cache_config_mutex);
+ m_cache_config = other.m_cache_config;
+ m_devices_cache_config = other.m_devices_cache_config;
}
- _flag_enable_mmap = other._flag_enable_mmap;
+ m_flag_enable_mmap = other.m_flag_enable_mmap;
}
void ov::CoreConfig::set(const ov::AnyMap& config) {
auto it = config.find(ov::cache_dir.name());
if (it != config.end()) {
- std::lock_guard<std::mutex> lock(_cacheConfigMutex);
+ std::lock_guard<std::mutex> lock(m_cache_config_mutex);
// fill global cache config
- _cacheConfig = CoreConfig::CacheConfig::create(it->second.as<std::string>());
+ m_cache_config = CoreConfig::CacheConfig::create(it->second.as<std::string>());
// sets cache config per-device if it's not set explicitly before
- for (auto& deviceCfg : _cacheConfigPerDevice) {
+ for (auto& deviceCfg : m_devices_cache_config) {
deviceCfg.second = CoreConfig::CacheConfig::create(it->second.as<std::string>());
}
}
@@ -1733,7 +1745,7 @@ void ov::CoreConfig::set(const ov::AnyMap& config) {
it = config.find(ov::enable_mmap.name());
if (it != config.end()) {
auto flag = it->second.as<bool>();
- _flag_enable_mmap = flag;
+ m_flag_enable_mmap = flag;
}
}
@@ -1755,17 +1767,17 @@ void ov::CoreConfig::remove_core_skip_cache_dir(ov::AnyMap& config) {
}
void ov::CoreConfig::set_cache_dir_for_device(const std::string& dir, const std::string& name) {
- std::lock_guard<std::mutex> lock(_cacheConfigMutex);
- _cacheConfigPerDevice[name] = CoreConfig::CacheConfig::create(dir);
+ std::lock_guard<std::mutex> lock(m_cache_config_mutex);
+ m_devices_cache_config[name] = CoreConfig::CacheConfig::create(dir);
}
std::string ov::CoreConfig::get_cache_dir() const {
- std::lock_guard<std::mutex> lock(_cacheConfigMutex);
- return _cacheConfig._cacheDir;
+ std::lock_guard<std::mutex> lock(m_cache_config_mutex);
+ return m_cache_config.m_cache_dir;
}
bool ov::CoreConfig::get_enable_mmap() const {
- return _flag_enable_mmap;
+ return m_flag_enable_mmap;
}
// Creating thread-safe copy of config including shared_ptr to ICacheManager
@@ -1789,38 +1801,39 @@ ov::CoreConfig::CacheConfig ov::CoreConfig::get_cache_config_for_device(const ov
}
ov::CoreConfig::CacheConfig ov::CoreConfig::get_cache_config_for_device(const ov::Plugin& plugin) const {
- std::lock_guard<std::mutex> lock(_cacheConfigMutex);
- return _cacheConfigPerDevice.count(plugin.get_name()) ? _cacheConfigPerDevice.at(plugin.get_name()) : _cacheConfig;
+ std::lock_guard<std::mutex> lock(m_cache_config_mutex);
+ return m_devices_cache_config.count(plugin.get_name()) ? m_devices_cache_config.at(plugin.get_name())
+ : m_cache_config;
}
ov::CoreConfig::CacheConfig ov::CoreConfig::CacheConfig::create(const std::string& dir) {
CacheConfig cache_config{dir, nullptr};
if (!dir.empty()) {
ov::util::create_directory_recursive(ov::util::make_path(dir));
- cache_config._cacheManager = std::make_shared<ov::FileStorageCacheManager>(dir);
+ cache_config.m_cache_manager = std::make_shared<ov::FileStorageCacheManager>(dir);
}
return cache_config;
}
std::mutex& ov::CoreImpl::get_mutex(const std::string& dev_name) const {
- std::lock_guard<std::mutex> lock(global_mutex);
+ std::lock_guard<std::mutex> lock(m_global_mutex);
try {
- return dev_mutexes.at(dev_name);
+ return m_dev_mutexes.at(dev_name);
} catch (const std::out_of_range&) {
OPENVINO_THROW("Cannot get mutex for device: ", dev_name);
}
}
void ov::CoreImpl::add_mutex(const std::string& dev_name) {
- std::lock_guard<std::mutex> lock(global_mutex);
- dev_mutexes[dev_name];
+ std::lock_guard<std::mutex> lock(m_global_mutex);
+ m_dev_mutexes[dev_name];
}
std::shared_ptr<ov::Model> ov::CoreImpl::read_model(const std::string& modelPath,
const std::string& binPath,
const AnyMap& properties) const {
OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::ReadTime, "CoreImpl::read_model from file");
- auto local_core_config = coreConfig;
+ auto local_core_config = m_core_config;
local_core_config.set(properties);
return ov::util::read_model(modelPath, binPath, get_extensions_copy(), local_core_config.get_enable_mmap());
}
@@ -1838,38 +1851,38 @@ std::shared_ptr<ov::Model> ov::CoreImpl::read_model(const std::shared_ptr<Aligne
return ov::util::read_model(model, weights, get_extensions_copy());
}
-std::map<std::string, ov::Version> ov::CoreImpl::get_versions(const std::string& deviceName) const {
+std::map<std::string, ov::Version> ov::CoreImpl::get_versions(const std::string& device_name) const {
std::map<std::string, ov::Version> versions;
std::vector<std::string> deviceNames;
{
// for compatibility with samples / demo
- if (deviceName.find("HETERO") == 0) {
- auto pos = deviceName.find_first_of(":");
+ if (device_name.find("HETERO") == 0) {
+ auto pos = device_name.find_first_of(":");
if (pos != std::string::npos) {
- deviceNames = ov::DeviceIDParser::get_hetero_devices(deviceName.substr(pos + 1));
+ deviceNames = ov::DeviceIDParser::get_hetero_devices(device_name.substr(pos + 1));
}
deviceNames.push_back("HETERO");
- } else if (deviceName.find("MULTI") == 0) {
- auto pos = deviceName.find_first_of(":");
+ } else if (device_name.find("MULTI") == 0) {
+ auto pos = device_name.find_first_of(":");
if (pos != std::string::npos) {
- deviceNames = ov::DeviceIDParser::get_multi_devices(deviceName.substr(pos + 1));
+ deviceNames = ov::DeviceIDParser::get_multi_devices(device_name.substr(pos + 1));
}
deviceNames.push_back("MULTI");
- } else if (deviceName.find("AUTO") == 0) {
- auto pos = deviceName.find_first_of(":");
+ } else if (device_name.find("AUTO") == 0) {
+ auto pos = device_name.find_first_of(":");
if (pos != std::string::npos) {
- deviceNames = ov::DeviceIDParser::get_multi_devices(deviceName.substr(pos + 1));
+ deviceNames = ov::DeviceIDParser::get_multi_devices(device_name.substr(pos + 1));
}
deviceNames.emplace_back("AUTO");
- } else if (deviceName.find("BATCH") == 0) {
- auto pos = deviceName.find_first_of(":");
+ } else if (device_name.find("BATCH") == 0) {
+ auto pos = device_name.find_first_of(":");
if (pos != std::string::npos) {
- deviceNames = {ov::DeviceIDParser::get_batch_device(deviceName.substr(pos + 1))};
+ deviceNames = {ov::DeviceIDParser::get_batch_device(device_name.substr(pos + 1))};
}
deviceNames.push_back("BATCH");
} else {
- deviceNames.push_back(deviceName);
+ deviceNames.push_back(device_name);
}
}
diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hpp
index bfec8715c11..1dea47b0a18 100644
--- a/src/inference/src/dev/core_impl.hpp
+++ b/src/inference/src/dev/core_impl.hpp
@@ -20,8 +20,7 @@ namespace ov {
using CreateExtensionFunc = void(std::vector<::ov::Extension::Ptr>&);
using CreatePluginEngineFunc = void(std::shared_ptr<::ov::IPlugin>&);
-const std::string DEFAULT_DEVICE_NAME = "DEFAULT_DEVICE";
-
+static const std::string default_device_name = "DEFAULT_DEVICE";
class CoreConfig final {
public:
CoreConfig() = default;
@@ -29,8 +28,8 @@ public:
CoreConfig& operator=(const CoreConfig&) = delete;
struct CacheConfig {
- std::string _cacheDir;
- std::shared_ptr<ov::ICacheManager> _cacheManager;
+ std::string m_cache_dir;
+ std::shared_ptr<ov::ICacheManager> m_cache_manager;
static CacheConfig create(const std::string& dir);
};
@@ -50,7 +49,7 @@ public:
bool get_enable_mmap() const;
- CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, ov::AnyMap& parsedConfig) const;
+ CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, ov::AnyMap& parsed_config) const;
// Creating thread-safe copy of global config including shared_ptr to ICacheManager
CacheConfig get_cache_config_for_device(const ov::Plugin& plugin) const;
@@ -60,16 +59,16 @@ public:
static void remove_core_skip_cache_dir(ov::AnyMap& config);
private:
- mutable std::mutex _cacheConfigMutex;
- CacheConfig _cacheConfig;
- std::map<std::string, CacheConfig> _cacheConfigPerDevice;
- bool _flag_enable_mmap = true;
+ mutable std::mutex m_cache_config_mutex{};
+ CacheConfig m_cache_config{};
+ std::map<std::string, CacheConfig> m_devices_cache_config{};
+ bool m_flag_enable_mmap{true};
};
struct Parsed {
- std::string _deviceName;
- AnyMap _config;
- CoreConfig _core_config;
+ std::string m_device_name;
+ AnyMap m_config;
+ CoreConfig m_core_config;
};
/**
@@ -79,7 +78,7 @@ struct Parsed {
* The core properties are removed from user configuration for HW devices only.
* @note The `CACHE_DIR` is not removed from compiled configuration.
*
- * @param deviceName Device name to be parsed
+ * @param device_name Device name to be parsed
* @param config User configuration to be parsed.
* @param keep_auto_batch_property If set keep auto batch properties in compile properties.
* @return Parsed:
@@ -87,9 +86,9 @@ struct Parsed {
* - compile properties
* - core configuration
*/
-Parsed parseDeviceNameIntoConfig(const std::string& deviceName,
- const AnyMap& config = {},
- const bool keep_auto_batch_property = false);
+Parsed parse_device_name_into_config(const std::string& device_name,
+ const AnyMap& config = {},
+ const bool keep_auto_batch_property = false);
/**
* @brief Provides Parsed device name and configuration.
@@ -98,8 +97,8 @@ Parsed parseDeviceNameIntoConfig(const std::string& deviceName,
* The core properties are removed from user configuration for HW devices only.
* @note The `CACHE_DIR` is not removed from compiled configuration.
*
- * @param deviceName Device name to be parsed
- * @param coreConfig Core configuration used as base for parsed output.
+ * @param device_name Device name to be parsed
+ * @param core_config Core configuration used as base for parsed output.
* @param config User configuration to be parsed.
* @param keep_auto_batch_property If set keep auto batch properties in compile properties.
* @return Parsed:
@@ -107,10 +106,10 @@ Parsed parseDeviceNameIntoConfig(const std::string& deviceName,
* - compile properties
* - core configuration
*/
-Parsed parseDeviceNameIntoConfig(const std::string& deviceName,
- const CoreConfig& coreConfig,
- const AnyMap& config = {},
- const bool keep_auto_batch_property = false);
+Parsed parse_device_name_into_config(const std::string& device_name,
+ const CoreConfig& core_config,
+ const AnyMap& config = {},
+ const bool keep_auto_batch_property = false);
/**
* @brief Checks whether config is applicable for device with 'device_name'
@@ -138,12 +137,12 @@ bool is_virtual_device(const std::string& device_name);
class CoreImpl : public ov::ICore, public std::enable_shared_from_this<ov::ICore> {
private:
- mutable std::map<std::string, ov::Plugin> plugins;
+ mutable std::map<std::string, ov::Plugin> m_plugins;
// Mutex is needed to prevent changes of dev mutexes map from different threads
- mutable std::mutex global_mutex;
- // Global mutex "" locks parallel access to pluginRegistry and plugins
+ mutable std::mutex m_global_mutex;
+ // Global mutex "" locks parallel access to m_plugin_registry and plugins
// Plugin mutexes "plugin_name" lock access to code which changes configuration of particular plugin
- mutable std::unordered_map<std::string, std::mutex> dev_mutexes;
+ mutable std::unordered_map<std::string, std::mutex> m_dev_mutexes;
std::mutex& get_mutex(const std::string& dev_name = "") const;
void add_mutex(const std::string& dev_name);
@@ -155,70 +154,70 @@ private:
explicit CacheContent(const std::shared_ptr<ov::ICacheManager>& cache_manager,
bool mmap_enabled = false,
const std::string model_path = {})
- : cacheManager(cache_manager),
- modelPath(model_path),
- mmap_enabled{mmap_enabled} {}
- std::shared_ptr<ov::ICacheManager> cacheManager;
- std::string blobId = {};
- std::string modelPath = {};
+ : m_cache_manager(cache_manager),
+ m_model_path(model_path),
+ m_mmap_enabled{mmap_enabled} {}
+ std::shared_ptr<ov::ICacheManager> m_cache_manager{};
+ std::string m_blob_id{};
+ std::string m_model_path{};
std::shared_ptr<const ov::Model> model{};
- bool mmap_enabled = false;
+ bool m_mmap_enabled{};
};
// Core settings (cache config, etc)
- CoreConfig coreConfig;
+ CoreConfig m_core_config;
Any get_property_for_core(const std::string& name) const;
- mutable ov::CacheGuard cacheGuard;
+ mutable ov::CacheGuard m_cache_guard;
struct PluginDescriptor {
- ov::util::Path libraryLocation;
- ov::AnyMap defaultConfig;
- std::vector<ov::util::FilePath> listOfExtentions;
- CreatePluginEngineFunc* pluginCreateFunc = nullptr;
- CreateExtensionFunc* extensionCreateFunc = nullptr;
- mutable std::vector<Extension::Ptr> extensions; // mutable because of lazy init
+ ov::util::Path m_lib_location{};
+ ov::AnyMap m_default_config{};
+ std::vector<ov::util::FilePath> m_list_of_extensions{};
+ CreatePluginEngineFunc* m_plugin_create_func = nullptr;
+ CreateExtensionFunc* m_extension_create_func = nullptr;
+ mutable std::vector<Extension::Ptr> m_extensions{}; // mutable because of lazy init
PluginDescriptor() = default;
- PluginDescriptor(const ov::util::FilePath& libraryLocation,
- const ov::AnyMap& defaultConfig = {},
- const std::vector<ov::util::FilePath>& listOfExtentions = {}) {
- this->libraryLocation = libraryLocation;
- this->defaultConfig = defaultConfig;
- this->listOfExtentions = listOfExtentions;
- }
-
- PluginDescriptor(CreatePluginEngineFunc* pluginCreateFunc,
- const ov::AnyMap& defaultConfig = {},
- CreateExtensionFunc* extensionCreateFunc = nullptr) {
- this->pluginCreateFunc = pluginCreateFunc;
- this->defaultConfig = defaultConfig;
- this->extensionCreateFunc = extensionCreateFunc;
- }
+ PluginDescriptor(const ov::util::FilePath& lib_location,
+ const ov::AnyMap& default_config = {},
+ const std::vector<ov::util::FilePath>& list_of_extentions = {})
+ : m_lib_location(lib_location),
+ m_default_config(default_config),
+ m_list_of_extensions(list_of_extentions) {}
+
+ PluginDescriptor(CreatePluginEngineFunc* plugin_create_func,
+ const ov::AnyMap& default_config = {},
+ CreateExtensionFunc* extension_create_func = nullptr)
+ : m_lib_location(),
+ m_default_config(default_config),
+ m_list_of_extensions(),
+ m_plugin_create_func(plugin_create_func),
+ m_extension_create_func(extension_create_func) {}
};
std::shared_ptr<ov::threading::ExecutorManager> m_executor_manager;
- mutable std::unordered_set<std::string> opsetNames;
- mutable std::vector<Extension::Ptr> extensions;
+ mutable std::unordered_set<std::string> m_opset_names;
+ mutable std::vector<Extension::Ptr> m_extensions;
- std::map<std::string, PluginDescriptor> pluginRegistry;
+ std::map<std::string, PluginDescriptor> m_plugin_registry;
ov::SoPtr<ov::ICompiledModel> compile_model_and_cache(ov::Plugin& plugin,
const std::shared_ptr<const ov::Model>& model,
- const ov::AnyMap& parsedConfig,
+ const ov::AnyMap& parsed_config,
const ov::SoPtr<ov::IRemoteContext>& context,
- const CacheContent& cacheContent) const;
+ const CacheContent& cache_content) const;
ov::SoPtr<ov::ICompiledModel> load_model_from_cache(
- const CacheContent& cacheContent,
+ const CacheContent& cache_content,
ov::Plugin& plugin,
const ov::AnyMap& config,
const ov::SoPtr<ov::IRemoteContext>& context,
std::function<ov::SoPtr<ov::ICompiledModel>()> compile_model_lambda) const;
- bool device_supports_model_caching(const ov::Plugin& plugin, const ov::AnyMap& origConfig = {}) const;
+ bool device_supports_model_caching(const ov::Plugin& plugin, const ov::AnyMap& orig_config = {}) const;
bool device_supports_property(const ov::Plugin& plugin, const ov::PropertyName& key) const;
bool device_supports_internal_property(const ov::Plugin& plugin, const ov::PropertyName& key) const;
@@ -226,9 +225,9 @@ private:
OPENVINO_DEPRECATED("Don't use this method, it will be removed soon")
bool device_supports_cache_dir(const ov::Plugin& plugin) const;
- ov::AnyMap create_compile_config(const ov::Plugin& plugin, const ov::AnyMap& origConfig) const;
- ov::AnyMap create_compile_config(const std::string& device_name, const ov::AnyMap& origConfig) const override {
- return create_compile_config(get_plugin(device_name), origConfig);
+ ov::AnyMap create_compile_config(const ov::Plugin& plugin, const ov::AnyMap& orig_config) const;
+ ov::AnyMap create_compile_config(const std::string& device_name, const ov::AnyMap& orig_config) const override {
+ return create_compile_config(get_plugin(device_name), orig_config);
}
bool is_hidden_device(const std::string& device_name) const;
@@ -253,7 +252,7 @@ public:
void register_plugins_in_registry(const std::string& xml_config_file, const bool& by_abs_path = false);
std::shared_ptr<const ov::Model> apply_auto_batching(const std::shared_ptr<const ov::Model>& model,
- std::string& deviceName,
+ std::string& device_name,
ov::AnyMap& config) const;
/*
@@ -265,16 +264,16 @@ public:
/**
* @brief Returns reference to CPP plugin wrapper by a device name
- * @param pluginName A name of device
+ * @param plugin_name A name of device
* @return Reference to a CPP plugin wrapper
*/
- ov::Plugin get_plugin(const std::string& pluginName) const;
+ ov::Plugin get_plugin(const std::string& plugin_name) const;
/**
* @brief Unload plugin for specified device, but plugin meta-data is still in plugin registry
- * @param deviceName A name of device
+ * @param device_name A name of device
*/
- void unload_plugin(const std::string& deviceName);
+ void unload_plugin(const std::string& device_name);
/**
* @brief Registers plugin meta-data in registry for specified device
@@ -293,12 +292,12 @@ public:
/**
* @brief Sets config values for a plugin or set of plugins
- * @param deviceName A device name to set config to
+ * @param device_name A device name to set config to
* If empty, config is set for all the plugins / plugin's meta-data
- * @note `deviceName` is not allowed in form of MULTI:CPU, HETERO:GPU,CPU, AUTO:CPU
+ * @note `device_name` is not allowed in form of MULTI:CPU, HETERO:GPU,CPU, AUTO:CPU
* just simple forms like CPU, GPU, MULTI, GPU.0, etc
*/
- void set_property_for_device(const ov::AnyMap& configMap, const std::string& deviceName);
+ void set_property_for_device(const ov::AnyMap& config, const std::string& device_name);
void add_extension(const std::vector<ov::Extension::Ptr>& extensions);
@@ -363,7 +362,7 @@ public:
ov::SoPtr<ov::IRemoteContext> get_default_context(const std::string& device_name) const override;
- std::map<std::string, ov::Version> get_versions(const std::string& deviceName) const;
+ std::map<std::string, ov::Version> get_versions(const std::string& device_name) const;
/**
* @brief Sets properties for a device, acceptable keys can be found in openvino/runtime/properties.hpp.
diff --git a/src/inference/tests/unit/core.cpp b/src/inference/tests/unit/core.cpp
index ce59703eef8..64c4270819d 100644
--- a/src/inference/tests/unit/core.cpp
+++ b/src/inference/tests/unit/core.cpp
@@ -247,9 +247,9 @@ TEST(CoreTests_parse_device_config, get_device_config) {
const ov::AnyMap& config,
const std::string& expected_device,
const ov::AnyMap& expected_config) {
- auto parsed = ov::parseDeviceNameIntoConfig(device, config);
- ASSERT_EQ(parsed._deviceName, expected_device);
- ASSERT_EQ(ov::Any(parsed._config).as<std::string>(), ov::Any(expected_config).as<std::string>());
+ auto parsed = ov::parse_device_name_into_config(device, config);
+ ASSERT_EQ(parsed.m_device_name, expected_device);
+ ASSERT_EQ(ov::Any(parsed.m_config).as<std::string>(), ov::Any(expected_config).as<std::string>());
};
// Single device
check_parsed_config("DEVICE.0", ov::AnyMap{}, "DEVICE", ov::AnyMap{ov::device::id("0")});
@@ -306,7 +306,7 @@ TEST(CoreTests_parse_device_config, get_device_config) {
ov::AnyMap{ov::device::id("0.1"), ov::log::level(ov::log::Level::INFO)});
// device ID mismatch
- EXPECT_THROW(ov::parseDeviceNameIntoConfig("DEVICE.X", ov::AnyMap{ov::device::id("Y")}), ov::Exception);
+ EXPECT_THROW(ov::parse_device_name_into_config("DEVICE.X", ov::AnyMap{ov::device::id("Y")}), ov::Exception);
// HETERO
check_parsed_config("HETERO:DEVICE", ov::AnyMap{}, "HETERO", ov::AnyMap{ov::device::priorities("DEVICE")});
@@ -342,8 +342,9 @@ TEST(CoreTests_parse_device_config, get_device_config) {
ov::AnyMap{ov::device::priorities("DEVICE"),
ov::device::properties(ov::AnyMap{{"DEVICE", ov::AnyMap{ov::log::level(ov::log::Level::ERR)}}})});
// device priorities mismatch
- EXPECT_THROW(ov::parseDeviceNameIntoConfig("HETERO:DEVICE", ov::AnyMap{ov::device::priorities("ANOTHER_DEVICE")}),
- ov::Exception);
+ EXPECT_THROW(
+ ov::parse_device_name_into_config("HETERO:DEVICE", ov::AnyMap{ov::device::priorities("ANOTHER_DEVICE")}),
+ ov::Exception);
// MULTI
check_parsed_config("MULTI:DEVICE", ov::AnyMap{}, "MULTI", ov::AnyMap{ov::device::priorities("DEVICE")});
@@ -427,9 +428,9 @@ TEST(CoreTests_parse_device_config, get_device_config) {
ov::device::properties(ov::AnyMap{{"MULTI", ov::AnyMap{ov::device::priorities("DEVICE")}}})});
// invalid device name with characters after parenthesis except comma
- EXPECT_THROW(ov::parseDeviceNameIntoConfig("DEVICE(0)ov", ov::AnyMap{}), ov::Exception);
- EXPECT_THROW(ov::parseDeviceNameIntoConfig("MULTI:DEVICE(0)ov,DEVICE(1)", ov::AnyMap{}), ov::Exception);
- EXPECT_THROW(ov::parseDeviceNameIntoConfig("MULTI:DEVICE(0),DEVICE(1),", ov::AnyMap{}), ov::Exception);
+ EXPECT_THROW(ov::parse_device_name_into_config("DEVICE(0)ov", ov::AnyMap{}), ov::Exception);
+ EXPECT_THROW(ov::parse_device_name_into_config("MULTI:DEVICE(0)ov,DEVICE(1)", ov::AnyMap{}), ov::Exception);
+ EXPECT_THROW(ov::parse_device_name_into_config("MULTI:DEVICE(0),DEVICE(1),", ov::AnyMap{}), ov::Exception);
}
TEST(CoreTests_parse_device_config, get_batch_device_name) {