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
[core] Split configuration for device and others in compile model (#26977)
Pawel Raasz747d0e7e105c
diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cppindex 673f6fd569a..f332c7c999a 100644--- a/src/inference/src/dev/core_impl.cpp+++ b/src/inference/src/dev/core_impl.cpp@@ -38,6 +38,18 @@ov::ICore::~ICore() = default;+namespace ov {+namespace util {+template <class T = void, class... Args>+constexpr std::array<+ typename std::conditional<std::is_void<T>::value, typename std::common_type<Args...>::type, T>::type,+ sizeof...(Args)>+make_array(Args&&... args) {+ return {std::forward<Args>(args)...};+}+} // namespace util+} // namespace ov+namespace {#ifdef PROXY_PLUGIN_ENABLED@@ -205,6 +217,18 @@ void clean_batch_properties(const std::string& deviceName, ov::AnyMap& config, c}}}++static const auto core_properties_names =+ ov::util::make_array(ov::cache_dir.name(), ov::enable_mmap.name(), ov::force_tbb_terminate.name());++static const auto auto_batch_properties_names =+ ov::util::make_array(ov::auto_batch_timeout.name(), ov::hint::allow_auto_batching.name());++void remove_core_properties(ov::AnyMap& properties) {+ for (const auto& name : core_properties_names) {+ properties.erase(name);+ }+}} // namespacebool ov::is_config_applicable(const std::string& user_device_name, const std::string& subprop_device_name) {@@ -239,22 +263,21 @@ bool ov::is_config_applicable(const std::string& user_device_name, const std::streturn false;}-ov::Parsed ov::parseDeviceNameIntoConfig(const std::string& deviceName,- const AnyMap& config,- const bool keep_core_property) {+namespace {+ov::Parsed parse_device_config(const std::string& device_name,+ const ov::CoreConfig& core_config,+ const ov::AnyMap& properties,+ const bool keep_auto_batch_property) {// check to the validity of device name- auto bracket_pos = deviceName.find(")");+ auto bracket_pos = device_name.find(")");while (bracket_pos != std::string::npos) {- if (bracket_pos < deviceName.length() - 1 &&- (deviceName[bracket_pos + 1] != ',' || bracket_pos + 1 == deviceName.length() - 1)) {- OPENVINO_THROW("Device with \"", deviceName, "\" name is illegal in the OpenVINO Runtime");+ if (bracket_pos < device_name.length() - 1 &&+ (device_name[bracket_pos + 1] != ',' || bracket_pos + 1 == device_name.length() - 1)) {+ OPENVINO_THROW("Device with \"", device_name, "\" name is illegal in the OpenVINO Runtime");}- bracket_pos = deviceName.find(")", bracket_pos + 1);+ bracket_pos = device_name.find(")", bracket_pos + 1);}- auto updated_config = config;- auto updated_device_name = deviceName;-/** Note: auto-batching is already applied by this time, so the call:* core.compile_model("GPU", ov::device::properties("BATCH", ov::auto_batch_timeout(400)));* is transformed and we have here:@@ -268,17 +291,19 @@ ov::Parsed ov::parseDeviceNameIntoConfig(const std::string& deviceName,* So, if one day, we want to add more options in form of ov::allow_<hetero, etc>, we need to apply it before* '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;- updated_config = flatten_sub_properties(deviceName, updated_config);std::string parsed_device_priority;// try to find ':' to extract name of virtual device- auto pos = deviceName.find_first_of(':');+ auto pos = device_name.find_first_of(':');if (pos != std::string::npos) {- updated_device_name = deviceName.substr(0, pos);- parsed_device_priority = deviceName.substr(pos + 1);+ updated_device_name = device_name.substr(0, pos);+ parsed_device_priority = device_name.substr(pos + 1);} else {- ov::DeviceIDParser parser(deviceName);+ ov::DeviceIDParser parser(device_name);updated_device_name = parser.get_device_name();parsed_device_priority = parser.get_device_id();}@@ -295,20 +320,44 @@ ov::Parsed ov::parseDeviceNameIntoConfig(const std::string& deviceName,OPENVINO_THROW("Device priority / ID mismatch: ",parsed_device_priority," (from ",- deviceName,+ device_name,") vs ",it->second.as<std::string>()," (from config)");}};+ parsed._core_config.set(updated_config);// keep batch property only when called from query_supported_property- if (!keep_core_property) {- clean_batch_properties(updated_device_name, updated_config, ov::hint::allow_auto_batching);- clean_batch_properties(updated_device_name, updated_config, ov::auto_batch_timeout);+ if (!keep_auto_batch_property) {+ for (const auto& name : auto_batch_properties_names) {+ clean_batch_properties(updated_device_name, updated_config, name);+ }}+ return parsed;+}+} // 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);+}- return {std::move(updated_device_name), std::move(updated_config)};+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);++ // remove core properties for HW devices+ if (!is_virtual_device(parsed._deviceName)) {+ for (const auto& name : {ov::enable_mmap.name(), ov::force_tbb_terminate.name()}) {+ // note: ov::cache_dir kept as plugin may require it+ parsed._config.erase(name);+ }+ }+ return parsed;}ov::CoreImpl::CoreImpl() {@@ -663,8 +712,7 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const {{OPENVINO_SUPPRESS_DEPRECATED_STARTif (device_supports_cache_dir(plugin)) {- ov::AnyMap empty_map;- auto cacheConfig = coreConfig.get_cache_config_for_device(plugin, empty_map);+ auto cacheConfig = coreConfig.get_cache_config_for_device(plugin);if (cacheConfig._cacheManager) {desc.defaultConfig[ov::cache_dir.name()] = cacheConfig._cacheDir;}@@ -737,13 +785,14 @@ 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:auto model = apply_auto_batching(model_, deviceName, config_with_batch);- auto parsed = parseDeviceNameIntoConfig(deviceName, config_with_batch, is_proxy_device(device_name));+ auto parsed = parseDeviceNameIntoConfig(deviceName, coreConfig, config_with_batch, is_proxy_device(deviceName));auto plugin = get_plugin(parsed._deviceName);ov::SoPtr<ov::ICompiledModel> res;- auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager;+ // will consume ov::cache_dir if plugin not support it+ auto cacheManager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;// Skip caching for proxy plugin. HW plugin will load network from the cacheif (cacheManager && device_supports_model_caching(plugin) && !is_proxy_device(plugin)) {- CacheContent cacheContent{cacheManager};+ CacheContent cacheContent{cacheManager, parsed._core_config.get_enable_mmap()};cacheContent.blobId = ov::ModelCache::compute_hash(model, create_compile_config(plugin, parsed._config));std::unique_ptr<CacheGuardEntry> lock = cacheGuard.get_hash_lock(cacheContent.blobId);res = load_model_from_cache(cacheContent, plugin, parsed._config, ov::SoPtr<ov::IRemoteContext>{}, [&]() {@@ -770,13 +819,14 @@ 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:auto model = apply_auto_batching(model_, deviceName, config_with_batch);- auto parsed = parseDeviceNameIntoConfig(deviceName, config_with_batch, is_proxy_device(deviceName));+ auto parsed = parseDeviceNameIntoConfig(deviceName, coreConfig, config_with_batch, is_proxy_device(deviceName));auto plugin = get_plugin(parsed._deviceName);ov::SoPtr<ov::ICompiledModel> res;- auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager;+ // will consume ov::cache_dir if plugin not support it+ auto cacheManager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;// Skip caching for proxy plugin. HW plugin will load network from the cacheif (cacheManager && device_supports_model_caching(plugin) && !is_proxy_device(plugin)) {- CacheContent cacheContent{cacheManager};+ CacheContent cacheContent{cacheManager, parsed._core_config.get_enable_mmap()};cacheContent.blobId = ov::ModelCache::compute_hash(model, create_compile_config(plugin, parsed._config));std::unique_ptr<CacheGuardEntry> lock = cacheGuard.get_hash_lock(cacheContent.blobId);res = load_model_from_cache(cacheContent, plugin, parsed._config, context, [&]() {@@ -792,21 +842,22 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::string& modconst std::string& device_name,const ov::AnyMap& config) const {OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::LoadTime, "Core::compile_model::Path");- auto parsed = parseDeviceNameIntoConfig(device_name, config);+ auto parsed = parseDeviceNameIntoConfig(device_name, coreConfig, config);// in case of compile_model(file_name), we need to clear-up core-level propertiesauto plugin = get_plugin(parsed._deviceName);ov::SoPtr<ov::ICompiledModel> compiled_model;-- auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager;+ // will consume ov::cache_dir if plugin not support it+ auto cacheManager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;if (cacheManager && device_supports_model_caching(plugin) && !is_proxy_device(plugin)) {// Skip caching for proxy plugin. HW plugin will load network from the cache- CacheContent cacheContent{cacheManager, model_path};+ CacheContent cacheContent{cacheManager, parsed._core_config.get_enable_mmap(), model_path};cacheContent.blobId = ov::ModelCache::compute_hash(model_path, create_compile_config(plugin, parsed._config));std::unique_ptr<CacheGuardEntry> lock = cacheGuard.get_hash_lock(cacheContent.blobId);compiled_model =load_model_from_cache(cacheContent, plugin, parsed._config, ov::SoPtr<ov::IRemoteContext>{}, [&]() {- auto model = read_model(model_path, std::string{});+ auto model =+ ov::util::read_model(model_path, std::string{}, extensions, parsed._core_config.get_enable_mmap());return compile_model_and_cache(plugin, model, parsed._config, {}, cacheContent);});} else {@@ -820,15 +871,14 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::string& modconst 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, config);- // in case of compile_model(file_name), we need to clear-up core-level properties+ auto parsed = parseDeviceNameIntoConfig(device_name, coreConfig, config);auto plugin = get_plugin(parsed._deviceName);ov::SoPtr<ov::ICompiledModel> compiled_model;-- auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager;+ // will consume ov::cache_dir if plugin not support it+ auto cacheManager = parsed._core_config.get_cache_config_for_device(plugin, parsed._config)._cacheManager;// Skip caching for proxy plugin. HW plugin will load network from the cacheif (cacheManager && device_supports_model_caching(plugin) && !is_proxy_device(plugin)) {- CacheContent cacheContent{cacheManager};+ CacheContent cacheContent{cacheManager, parsed._core_config.get_enable_mmap()};cacheContent.blobId =ov::ModelCache::compute_hash(model_str, weights, create_compile_config(plugin, parsed._config));std::unique_ptr<CacheGuardEntry> lock = cacheGuard.get_hash_lock(cacheContent.blobId);@@ -948,7 +998,7 @@ ov::AnyMap ov::CoreImpl::get_supported_property(const std::string& full_device_n// ov::device::priority cannot be shared, because it's specific for current virtual// plugin. So, we need to remove ov::device::priorities from the list, because it's// supposed to be set for current virtual plugin and cannot be propagated down- ov::AnyMap return_properties = user_properties;+ auto return_properties = user_properties;auto device_priorities_it = return_properties.find(ov::device::priorities.name());if (device_priorities_it != return_properties.end()) {return_properties.erase(device_priorities_it);@@ -957,30 +1007,24 @@ ov::AnyMap ov::CoreImpl::get_supported_property(const std::string& full_device_nreturn return_properties;}- static const std::vector<std::string> core_level_properties = {- ov::cache_dir.name(),- ov::force_tbb_terminate.name(),- // auto-batch properties are also treated as core-level- ov::auto_batch_timeout.name(),- ov::hint::allow_auto_batching.name(),- };-- const auto flattened = ov::parseDeviceNameIntoConfig(full_device_name, user_properties, true);- const std::string& device_name = flattened._deviceName;+ 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;// virtual plugins should bypass core-level properties to HW plugins// so, we need to report them as supportedstd::vector<std::string> supported_config_keys;+ auto key_inserter = std::back_inserter(supported_config_keys);if (keep_core_property) {- supported_config_keys = core_level_properties;+ key_inserter = std::copy(core_properties_names.begin(), core_properties_names.end(), key_inserter);+ key_inserter = std::copy(auto_batch_properties_names.begin(), auto_batch_properties_names.end(), key_inserter);}// try to search against OV API 2.0' mutable supported_propertiestry {for (auto&& property : ICore::get_property(device_name, ov::supported_properties, {})) {if (property.is_mutable()) {- supported_config_keys.emplace_back(std::move(property));+ *key_inserter = std::move(property);}}} catch (ov::Exception&) {@@ -990,7 +1034,7 @@ ov::AnyMap ov::CoreImpl::get_supported_property(const std::string& full_device_ntry {for (auto&& property : ICore::get_property(device_name, ov::internal::supported_properties, {})) {if (property.is_mutable()) {- supported_config_keys.emplace_back(std::move(property));+ *key_inserter = std::move(property);}}} catch (ov::Exception&) {@@ -1160,8 +1204,7 @@ ov::Any ov::CoreImpl::get_property(const std::string& device_name,if (parsed._deviceName.empty()) {return get_property_for_core(name);} else if (name == ov::cache_dir.name()) {- ov::AnyMap empty_map;- return coreConfig.get_cache_config_for_device(get_plugin(parsed._deviceName), empty_map)._cacheDir;+ return coreConfig.get_cache_config_for_device(get_plugin(parsed._deviceName))._cacheDir;}return get_plugin(parsed._deviceName).get_property(name, parsed._config);}@@ -1299,9 +1342,7 @@ void ov::CoreImpl::set_property_for_device(const ov::AnyMap& configMap, const st{OPENVINO_SUPPRESS_DEPRECATED_STARTif (device_supports_cache_dir(plugin.second)) {- ov::AnyMap empty_map = {};- configCopy[ov::cache_dir.name()] =- coreConfig.get_cache_config_for_device(plugin.second, empty_map)._cacheDir;+ configCopy[ov::cache_dir.name()] = coreConfig.get_cache_config_for_device(plugin.second)._cacheDir;} else if (configCopy.count(ov::cache_dir.name()) > 0) {// Remove "CACHE_DIR" from config if it is not supported by pluginconfigCopy.erase(ov::cache_dir.name());@@ -1411,8 +1452,8 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::load_model_from_cache(try {cacheContent.cacheManager->read_cache_entry(cacheContent.blobId,- coreConfig.get_enable_mmap() && ov::util::contains(plugin.get_property(ov::internal::supported_properties),- ov::internal::caching_with_mmap),+ cacheContent.mmap_enabled && ov::util::contains(plugin.get_property(ov::internal::supported_properties),+ ov::internal::caching_with_mmap),[&](std::istream& networkStream, std::shared_ptr<ov::AlignedBuffer> model_buffer) {OV_ITT_SCOPE(FIRST_INFERENCE,ov::itt::domains::LoadTime,@@ -1516,7 +1557,16 @@ ov::AnyMap ov::CoreImpl::create_compile_config(const ov::Plugin& plugin, const oreturn compile_config;}-void ov::CoreImpl::CoreConfig::set_and_update(ov::AnyMap& config) {+ov::CoreConfig::CoreConfig(const CoreConfig& other) {+ {+ std::lock_guard<std::mutex> lock(other._cacheConfigMutex);+ _cacheConfig = other._cacheConfig;+ _cacheConfigPerDevice = other._cacheConfigPerDevice;+ }+ _flag_enable_mmap = other._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);@@ -1526,43 +1576,44 @@ void ov::CoreImpl::CoreConfig::set_and_update(ov::AnyMap& config) {for (auto& deviceCfg : _cacheConfigPerDevice) {deviceCfg.second = CoreConfig::CacheConfig::create(it->second.as<std::string>());}- config.erase(it);}it = config.find(ov::force_tbb_terminate.name());if (it != config.end()) {auto flag = it->second.as<bool>();ov::threading::executor_manager()->set_property({{it->first, flag}});- config.erase(it);}it = config.find(ov::enable_mmap.name());if (it != config.end()) {auto flag = it->second.as<bool>();_flag_enable_mmap = flag;- config.erase(it);}}-void ov::CoreImpl::CoreConfig::set_cache_dir_for_device(const std::string& dir, const std::string& name) {+void ov::CoreConfig::set_and_update(ov::AnyMap& config) {+ set(config);+ remove_core_properties(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::string ov::CoreImpl::CoreConfig::get_cache_dir() const {+std::string ov::CoreConfig::get_cache_dir() const {std::lock_guard<std::mutex> lock(_cacheConfigMutex);return _cacheConfig._cacheDir;}-bool ov::CoreImpl::CoreConfig::get_enable_mmap() const {+bool ov::CoreConfig::get_enable_mmap() const {return _flag_enable_mmap;}// Creating thread-safe copy of config including shared_ptr to ICacheManager// Passing empty or not-existing name will return global cache config-ov::CoreImpl::CoreConfig::CacheConfig ov::CoreImpl::CoreConfig::get_cache_config_for_device(- const ov::Plugin& plugin,- ov::AnyMap& parsedConfig) const {+ov::CoreConfig::CacheConfig ov::CoreConfig::get_cache_config_for_device(const ov::Plugin& plugin,+ ov::AnyMap& parsedConfig) const {// cache_dir is enabled locally in compile_model onlyif (parsedConfig.count(ov::cache_dir.name())) {const auto& cache_dir_val = parsedConfig.at(ov::cache_dir.name()).as<std::string>();@@ -1575,16 +1626,16 @@ ov::CoreImpl::CoreConfig::CacheConfig ov::CoreImpl::CoreConfig::get_cache_config}return tempConfig;} else { // cache_dir is set to Core globally or for the specific device- std::lock_guard<std::mutex> lock(_cacheConfigMutex);- if (_cacheConfigPerDevice.count(plugin.get_name()) > 0) {- return _cacheConfigPerDevice.at(plugin.get_name());- } else {- return _cacheConfig;- }+ return get_cache_config_for_device(plugin);}}-ov::CoreImpl::CoreConfig::CacheConfig ov::CoreImpl::CoreConfig::CacheConfig::create(const std::string& dir) {+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;+}++ov::CoreConfig::CacheConfig ov::CoreConfig::CacheConfig::create(const std::string& dir) {std::shared_ptr<ov::ICacheManager> cache_manager = nullptr;if (!dir.empty()) {diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hppindex 7cf12f3ba32..7bbab14e4d8 100644--- a/src/inference/src/dev/core_impl.hpp+++ b/src/inference/src/dev/core_impl.hpp@@ -22,14 +22,91 @@ using CreatePluginEngineFunc = void(std::shared_ptr<::ov::IPlugin>&);const std::string DEFAULT_DEVICE_NAME = "DEFAULT_DEVICE";+class CoreConfig final {+public:+ CoreConfig() = default;+ CoreConfig(const CoreConfig& other);+ CoreConfig& operator=(const CoreConfig&) = delete;++ struct CacheConfig {+ std::string _cacheDir;+ std::shared_ptr<ov::ICacheManager> _cacheManager;++ static CacheConfig create(const std::string& dir);+ };++ void set(const ov::AnyMap& config);++ /**+ * @brief Removes core-level properties from config and triggers new state for core config+ * @param config - config to be updated+ */+ void set_and_update(ov::AnyMap& config);++ OPENVINO_DEPRECATED("Don't use this method, it will be removed soon")+ void set_cache_dir_for_device(const std::string& dir, const std::string& name);++ std::string get_cache_dir() const;++ bool get_enable_mmap() const;++ CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, ov::AnyMap& parsedConfig) const;++ // Creating thread-safe copy of global config including shared_ptr to ICacheManager+ CacheConfig get_cache_config_for_device(const ov::Plugin& plugin) const;++private:+ mutable std::mutex _cacheConfigMutex;+ CacheConfig _cacheConfig;+ std::map<std::string, CacheConfig> _cacheConfigPerDevice;+ bool _flag_enable_mmap = true;+};+struct Parsed {std::string _deviceName;AnyMap _config;+ CoreConfig _core_config;};+/**+ * @brief Provides Parsed device name and configuration.+ *+ * Uses default core configuration updated with user properties from config.+ * 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 config User configuration to be parsed.+ * @param keep_auto_batch_property If set keep auto batch properties in compile properties.+ * @return Parsed:+ * - device name+ * - compile properties+ * - core configuration+ */+Parsed parseDeviceNameIntoConfig(const std::string& deviceName,+ const AnyMap& config = {},+ const bool keep_auto_batch_property = false);++/**+ * @brief Provides Parsed device name and configuration.+ *+ * Uses user core configuration which is updated with user properties from config.+ * 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 config User configuration to be parsed.+ * @param keep_auto_batch_property If set keep auto batch properties in compile properties.+ * @return Parsed:+ * - device name+ * - compile properties+ * - core configuration+ */Parsed parseDeviceNameIntoConfig(const std::string& deviceName,+ const CoreConfig& coreConfig,const AnyMap& config = {},- const bool keep_core_property = false);+ const bool keep_auto_batch_property = false);/*** @brief Checks whether config is applicable for device with 'device_name'@@ -61,47 +138,17 @@ private:bool is_proxy_device(const ov::Plugin& plugin) const;bool is_proxy_device(const std::string& dev_name) const;- class CoreConfig final {- public:- struct CacheConfig {- std::string _cacheDir;- std::shared_ptr<ov::ICacheManager> _cacheManager;-- static CacheConfig create(const std::string& dir);- };-- /**- * @brief Removes core-level properties from config and triggers new state for core config- * @param config - config to be updated- */- void set_and_update(ov::AnyMap& config);-- OPENVINO_DEPRECATED("Don't use this method, it will be removed soon")- void set_cache_dir_for_device(const std::string& dir, const std::string& name);-- std::string get_cache_dir() const;-- bool get_enable_mmap() const;-- // Creating thread-safe copy of config including shared_ptr to ICacheManager- // Passing empty or not-existing name will return global cache config- CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, ov::AnyMap& parsedConfig) const;-- private:- mutable std::mutex _cacheConfigMutex;- CacheConfig _cacheConfig;- std::map<std::string, CacheConfig> _cacheConfigPerDevice;- bool _flag_enable_mmap = true;- };-struct CacheContent {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) {}+ modelPath(model_path),+ mmap_enabled{mmap_enabled} {}std::shared_ptr<ov::ICacheManager> cacheManager;std::string blobId = {};std::string modelPath = {};+ bool mmap_enabled = false;};// Core settings (cache config, etc)@@ -291,7 +338,9 @@ public:ov::SoPtr<ov::IRemoteContext> create_context(const std::string& device_name, const AnyMap& args) const override;- ov::AnyMap get_supported_property(const std::string& device_name, const ov::AnyMap& config, const bool keep_core_property = true) const override;+ ov::AnyMap get_supported_property(const std::string& device_name,+ const ov::AnyMap& config,+ const bool keep_core_property = true) const override;ov::SoPtr<ov::IRemoteContext> get_default_context(const std::string& device_name) const override;diff --git a/src/plugins/auto/tests/functional/behavior/caching_test.cpp b/src/plugins/auto/tests/functional/behavior/caching_test.cppindex 1ef107cd599..196d2519250 100644--- a/src/plugins/auto/tests/functional/behavior/caching_test.cpp+++ b/src/plugins/auto/tests/functional/behavior/caching_test.cpp@@ -190,4 +190,4 @@ TEST_F(AutoFuncTests, compiled_with_cache_enabled_batch_enabled) {ASSERT_EQ(ov::test::utils::listFilesWithExt(cache_path, "blob").size(), 5);core.set_property(ov::cache_dir(""));#endif-}\ No newline at end of file+}diff --git a/src/plugins/auto_batch/src/plugin.hpp b/src/plugins/auto_batch/src/plugin.hppindex 37a777cc970..563ba4487ee 100644--- a/src/plugins/auto_batch/src/plugin.hpp+++ b/src/plugins/auto_batch/src/plugin.hpp@@ -68,4 +68,4 @@ private:mutable ov::AnyMap m_plugin_config;};} // namespace autobatch_plugin-} // namespace ov\ No newline at end of file+} // namespace ovdiff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cppindex f2fa9bcdeea..806ca65b16e 100644--- a/src/plugins/intel_gpu/src/plugin/plugin.cpp+++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp@@ -608,6 +608,7 @@ std::vector<ov::PropertyName> Plugin::get_supported_properties() const {ov::PropertyName{ov::hint::dynamic_quantization_group_size.name(), PropertyMutability::RW},ov::PropertyName{ov::hint::activations_scale_factor.name(), PropertyMutability::RW},ov::PropertyName{ov::weights_path.name(), PropertyMutability::RW},+ ov::PropertyName{ov::hint::kv_cache_precision.name(), PropertyMutability::RW},};return supported_properties;diff --git a/src/plugins/template/src/plugin.cpp b/src/plugins/template/src/plugin.cppindex f66df99c7b1..20d72f0fad5 100644--- a/src/plugins/template/src/plugin.cpp+++ b/src/plugins/template/src/plugin.cpp@@ -257,15 +257,18 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, constreturn ro_properties;};const auto& default_rw_properties = []() {- std::vector<ov::PropertyName> rw_properties{ov::device::id,- ov::enable_profiling,- ov::hint::performance_mode,- ov::hint::num_requests,- ov::hint::inference_precision,- ov::hint::execution_mode,- ov::num_streams,- ov::template_plugin::disable_transformations,- ov::log::level};+ std::vector<ov::PropertyName> rw_properties{+ ov::device::id,+ ov::enable_profiling,+ ov::hint::performance_mode,+ ov::hint::num_requests,+ ov::hint::inference_precision,+ ov::hint::execution_mode,+ ov::num_streams,+ ov::template_plugin::disable_transformations,+ ov::log::level,+ ov::hint::model_priority,+ };return rw_properties;};if (ov::supported_properties == name) {@@ -280,7 +283,9 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const} else if (ov::internal::supported_properties == name) {return decltype(ov::internal::supported_properties)::value_type{ov::PropertyName{ov::internal::caching_properties.name(), ov::PropertyMutability::RO},- ov::PropertyName{ov::internal::exclusive_async_requests.name(), ov::PropertyMutability::RW}};+ ov::PropertyName{ov::internal::exclusive_async_requests.name(), ov::PropertyMutability::RW},+ ov::PropertyName{ov::inference_num_threads.name(), ov::PropertyMutability::RW},+ ov::PropertyName{ov::internal::threads_per_stream.name(), ov::PropertyMutability::RW}};} else if (ov::available_devices == name) {// TODO: fill list of available devicesreturn decltype(ov::available_devices)::value_type{{""}};diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hppindex 76b110e9a5e..26ba7f59245 100644--- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hpp+++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/properties_tests.hpp@@ -121,6 +121,19 @@ TEST_P(InferRequestPropertiesTest, ReusableCPUStreamsExecutor) {}}}++TEST_P(InferRequestPropertiesTest, ConfigHasUnsupportedPluginProperty) {+ configuration.insert({ov::enable_mmap(false)});+ if (target_device.find(ov::test::utils::DEVICE_AUTO) == std::string::npos &&+ target_device.find(ov::test::utils::DEVICE_MULTI) == std::string::npos &&+ target_device.find(ov::test::utils::DEVICE_HETERO) == std::string::npos &&+ target_device.find(ov::test::utils::DEVICE_BATCH) == std::string::npos) {+ OV_ASSERT_NO_THROW(core->set_property(target_device, configuration));+ }+ // Compile model to target plugins+ execNet = core->compile_model(function, target_device, configuration);+ OV_ASSERT_NO_THROW(execNet.create_infer_request());+}} // namespace behavior} // namespace test} // namespace ov