From cdac79586026c9c999b1cd2d93bd9be5045a8f8f Mon Sep 17 00:00:00 2001 From: Pawel Raasz Date: Mon, 3 Nov 2025 08:16:17 +0000 Subject: [PATCH 1/5] Remove pass ov::cache_dir to HW devices - remove ov::cache_dir as supported property in GPU and NPU - update core tests Signed-off-by: Pawel Raasz --- src/inference/src/dev/core_impl.cpp | 124 ++++-------------- src/inference/src/dev/core_impl.hpp | 15 +-- src/inference/src/dev/iplugin.cpp | 4 +- .../tests/functional/caching_test.cpp | 36 +++-- .../intel_gpu/src/plugin/compiled_model.cpp | 1 - src/plugins/intel_gpu/src/plugin/plugin.cpp | 1 - .../subgraph_tests/dynamic/kv_cache.cpp | 1 + .../intel_npu/src/plugin/src/properties.cpp | 2 - 8 files changed, 57 insertions(+), 127 deletions(-) diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index e561d6d47a8294..b4efc2481cfdf7 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -401,8 +401,7 @@ ov::Parsed ov::parseDeviceNameIntoConfig(const std::string& deviceName, // remove core properties for HW devices if (!ov::is_virtual_device(parsed._deviceName)) { - // note: ov::cache_dir kept as plugin may require it - CoreConfig::remove_core_skip_cache_dir(parsed._config); + CoreConfig::remove_core(parsed._config); } return parsed; } @@ -756,21 +755,6 @@ ov::Plugin ov::CoreImpl::get_plugin(const std::string& pluginName) const { } } #endif - // TODO: remove this block of code once GPU removes support of ov::cache_dir - // also, remove device_supports_cache_dir at all - { - 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; - } - } else if (desc.defaultConfig.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()); - } - OPENVINO_SUPPRESS_DEPRECATED_END - } allowNotImplemented([&]() { // Add device specific value to support device_name.device_id cases @@ -844,8 +828,7 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::shared_ptr< config_with_batch, is_proxy_device(patched_device_name)); auto plugin = get_plugin(parsed._deviceName); - // 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; + const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, config)._cacheManager; auto res = import_compiled_model(plugin, {}, parsed._config, model); // Skip caching for proxy plugin. HW plugin will load network from the cache if (res) { @@ -890,8 +873,7 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::shared_ptr< auto parsed = parseDeviceNameIntoConfig(device_name, coreConfig, config_with_batch, is_proxy_device(device_name)); auto plugin = get_plugin(parsed._deviceName); - // 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; + const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, config)._cacheManager; auto res = import_compiled_model(plugin, context, parsed._config, model); // Skip caching for proxy plugin. HW plugin will load network from the cache if (res) { @@ -919,15 +901,14 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::string& mod auto parsed = parse_device_config(device_name, coreConfig, config, false); // in case of compile_model(file_name), we need to clear-up core-level properties auto plugin = get_plugin(parsed._deviceName); - // 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; + const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, config)._cacheManager; auto compiled_model = import_compiled_model(plugin, {}, parsed._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)) { // Skip caching for proxy plugin. HW plugin will load network from the cache - CoreConfig::remove_core_skip_cache_dir(parsed._config); + CoreConfig::remove_core(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); @@ -949,8 +930,7 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::string& mod 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); - // 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; + const auto cache_manager = parsed._core_config.get_cache_config_for_device(plugin, config)._cacheManager; auto compiled_model = import_compiled_model(plugin, {}, parsed._config); // Skip caching for proxy plugin. HW plugin will load network from the cache if (compiled_model) { @@ -1366,34 +1346,7 @@ void ov::CoreImpl::set_property_for_device(const ov::AnyMap& configMap, const st std::lock_guard lock(get_mutex()); created_plugins.reserve(plugins.size()); - // TODO: keep only: - // coreConfig.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); - } 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(), clearDeviceName); - config.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 flag = it->second.as(); - ov::threading::executor_manager()->set_property({{it->first, flag}}); - config.erase(it); - } - - it = config.find(ov::enable_mmap.name()); - if (it != config.end()) { - config.erase(it); - } - } + coreConfig.set_and_update(config, clearDeviceName); if (!config.empty()) { auto base_desc = pluginRegistry.find(clearDeviceName); @@ -1430,17 +1383,6 @@ void ov::CoreImpl::set_property_for_device(const ov::AnyMap& configMap, const st allowNotImplemented([&]() { std::lock_guard lock(get_mutex(plugin.first)); auto configCopy = config; - // 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) { - // Remove "CACHE_DIR" from config if it is not supported by plugin - configCopy.erase(ov::cache_dir.name()); - } - OPENVINO_SUPPRESS_DEPRECATED_END - } // Add device specific value to support device_name.device_id cases { if (!parser.get_device_id().empty()) { @@ -1513,14 +1455,6 @@ bool ov::CoreImpl::device_supports_model_caching(const ov::Plugin& plugin, const : plugin.supports_model_caching(); } -bool ov::CoreImpl::device_supports_cache_dir(const ov::Plugin& plugin) const { - try { - return util::contains(plugin.get_property(ov::supported_properties), ov::cache_dir); - } catch (const ov::NotImplemented&) { - return false; - } -} - ov::SoPtr ov::CoreImpl::compile_model_and_cache(ov::Plugin& plugin, const std::shared_ptr& model, const ov::AnyMap& parsedConfig, @@ -1723,10 +1657,11 @@ void ov::CoreConfig::set(const ov::AnyMap& config) { if (it != config.end()) { std::lock_guard lock(_cacheConfigMutex); // fill global cache config - _cacheConfig = CoreConfig::CacheConfig::create(it->second.as()); + const auto& cache_dir = it->second.as(); + _cacheConfig = CoreConfig::CacheConfig::create(cache_dir); // sets cache config per-device if it's not set explicitly before for (auto& deviceCfg : _cacheConfigPerDevice) { - deviceCfg.second = CoreConfig::CacheConfig::create(it->second.as()); + deviceCfg.second = CoreConfig::CacheConfig::create(cache_dir); } } @@ -1743,8 +1678,17 @@ void ov::CoreConfig::set(const ov::AnyMap& config) { } } -void ov::CoreConfig::set_and_update(ov::AnyMap& config) { - set(config); +void ov::CoreConfig::set(const ov::AnyMap& config, const std::string& device_name) { + if (device_name.empty()) { + set(config); + } else if (const auto cache_dir_entry = config.find(ov::cache_dir.name()); cache_dir_entry != config.end()) { + std::lock_guard lock(_cacheConfigMutex); + _cacheConfigPerDevice[device_name] = CoreConfig::CacheConfig::create(cache_dir_entry->second.as()); + } +} + +void ov::CoreConfig::set_and_update(ov::AnyMap& config, const std::string& device_name) { + set(config, device_name); remove_core(config); } @@ -1754,17 +1698,6 @@ void ov::CoreConfig::remove_core(ov::AnyMap& config) { } } -void ov::CoreConfig::remove_core_skip_cache_dir(ov::AnyMap& config) { - for (const auto& name : {ov::enable_mmap.name(), ov::force_tbb_terminate.name(), ov::cache_model_path.name()}) { - config.erase(name); - } -} - -void ov::CoreConfig::set_cache_dir_for_device(const std::string& dir, const std::string& name) { - std::lock_guard lock(_cacheConfigMutex); - _cacheConfigPerDevice[name] = CoreConfig::CacheConfig::create(dir); -} - std::string ov::CoreConfig::get_cache_dir() const { std::lock_guard lock(_cacheConfigMutex); return _cacheConfig._cacheDir; @@ -1777,18 +1710,11 @@ bool ov::CoreConfig::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 ov::CoreConfig::CacheConfig ov::CoreConfig::get_cache_config_for_device(const ov::Plugin& plugin, - ov::AnyMap& parsedConfig) const { + const ov::AnyMap& config) const { // cache_dir is enabled locally in compile_model only - if (parsedConfig.count(ov::cache_dir.name())) { - const auto& cache_dir_val = parsedConfig.at(ov::cache_dir.name()).as(); - const auto& tempConfig = CoreConfig::CacheConfig::create(cache_dir_val); - // if plugin does not explicitly support cache_dir, and if plugin is not virtual, we need to remove - // it from config - if (!util::contains(plugin.get_property(ov::supported_properties), ov::cache_dir) && - !ov::is_virtual_device(plugin.get_name())) { - parsedConfig.erase(ov::cache_dir.name()); - } - return tempConfig; + if (config.count(ov::cache_dir.name())) { + const auto& cache_dir = config.at(ov::cache_dir.name()).as(); + return CoreConfig::CacheConfig::create(cache_dir); } else { // cache_dir is set to Core globally or for the specific device return get_cache_config_for_device(plugin); } diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hpp index d68663be6db753..336c8cb938f599 100644 --- a/src/inference/src/dev/core_impl.hpp +++ b/src/inference/src/dev/core_impl.hpp @@ -36,28 +36,26 @@ class CoreConfig final { }; void set(const ov::AnyMap& config); + void set(const ov::AnyMap& config, const std::string& device_name); /** * @brief Removes core-level properties from config and triggers new state for core config - * @param config - config to be updated + * @param config config to be updated + * @param device_name device name for which config is applied (empty is for core-level) */ - 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); + void set_and_update(ov::AnyMap& config, const std::string& device_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; + CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, const ov::AnyMap& 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; // remove core properties static void remove_core(ov::AnyMap& config); - static void remove_core_skip_cache_dir(ov::AnyMap& config); private: mutable std::mutex _cacheConfigMutex; @@ -222,9 +220,6 @@ class CoreImpl : public ov::ICore, public std::enable_shared_from_this ov::IPlugin::compile_model(const std::string OPENVINO_ASSERT(core); const auto model = core->read_model(model_path, {}, properties); auto local_properties = properties; - CoreConfig::remove_core_skip_cache_dir(local_properties); + if (!ov::is_virtual_device(get_device_name())) { + CoreConfig::remove_core(local_properties); + } return compile_model(model, local_properties); } diff --git a/src/inference/tests/functional/caching_test.cpp b/src/inference/tests/functional/caching_test.cpp index d3b9e7fcad4097..5144f8744aa655 100644 --- a/src/inference/tests/functional/caching_test.cpp +++ b/src/inference/tests/functional/caching_test.cpp @@ -726,6 +726,7 @@ TEST_P(CachingTest, TestNoCacheEnabled) { m_post_mock_net_callbacks.emplace_back([&](MockICompiledModelImpl& net) { EXPECT_CALL(net, export_model(_)).Times(0); }); + EXPECT_CALL(*mockPlugin, OnCompileModelFromFile()).Times(m_type == TestLoadType::EModelName ? 1 : 0); testLoad([&](ov::Core& core) { m_testFunction(core); }); @@ -828,7 +829,7 @@ TEST_P(CachingTest, TestNoCacheMetric_hasCacheDirConfig) { .Times(AtLeast(1)) .WillRepeatedly(Return(std::vector{})); EXPECT_CALL(*mockPlugin, set_property(_)).Times(AtLeast(1)).WillRepeatedly(Invoke([](const ov::AnyMap& config) { - ASSERT_GT(config.count(ov::cache_dir.name()), 0); + ASSERT_EQ(config.count(ov::cache_dir.name()), 0); })); { @@ -847,7 +848,7 @@ TEST_P(CachingTest, TestNoCacheMetric_hasCacheDirConfig) { /// core.compile_model TEST_P(CachingTest, TestNoCacheMetric_hasCacheDirConfig_inline) { m_checkConfigCb = [](const ov::AnyMap& config) { - EXPECT_NE(config.count(ov::cache_dir.name()), 0); + EXPECT_EQ(config.count(ov::cache_dir.name()), 0); }; EXPECT_CALL(*mockPlugin, get_property(ov::supported_properties.name(), _)) .Times(AtLeast(1)) @@ -880,7 +881,7 @@ TEST_P(CachingTest, TestNoCacheMetric_hasCacheDirConfig_by_device_name) { .Times(AtLeast(1)) .WillRepeatedly(Return(std::vector{})); EXPECT_CALL(*mockPlugin, set_property(_)).Times(AtLeast(1)).WillRepeatedly(Invoke([](const ov::AnyMap& config) { - ASSERT_GT(config.count(ov::cache_dir.name()), 0); + ASSERT_EQ(config.count(ov::cache_dir.name()), 0); })); { @@ -922,14 +923,12 @@ TEST_P(CachingTest, TestNoCacheMetric_configThrow) { m_checkConfigCb = [](const ov::AnyMap& config) { EXPECT_NE(config.count(ov::cache_dir.name()), 0); }; - EXPECT_CALL(*mockPlugin, get_property(ov::supported_properties.name(), _)) - .Times(AtLeast(1)) - .WillRepeatedly(Return(std::vector{ov::supported_properties.name(), ov::cache_dir.name()})); + EXPECT_CALL(*mockPlugin, get_property(ov::supported_properties.name(), _)).Times(0); EXPECT_CALL(*mockPlugin, get_property(ov::internal::supported_properties.name(), _)) .Times(AtLeast(1)) .WillRepeatedly(Return(std::vector{})); EXPECT_CALL(*mockPlugin, set_property(_)).Times(AtLeast(1)).WillRepeatedly(Invoke([](const ov::AnyMap& config) { - ASSERT_GT(config.count(ov::cache_dir.name()), 0); + ASSERT_EQ(config.count(ov::cache_dir.name()), 0); OPENVINO_THROW("Error occurred"); })); @@ -956,6 +955,7 @@ TEST_P(CachingTest, TestNoCacheEnabled_cacheDirConfig) { .Times(!m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, import_model(A(), _, _)).Times(0); EXPECT_CALL(*mockPlugin, import_model(A(), _)).Times(0); + EXPECT_CALL(*mockPlugin, OnCompileModelFromFile()).Times(m_type == TestLoadType::EModelName ? 1 : 0); testLoad([&](ov::Core& core) { m_testFunction(core); }); @@ -1090,9 +1090,8 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore_SupportsCacheDir_NoImportExpor EXPECT_CALL(*mockPlugin, get_property(ov::internal::supported_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, get_property(ov::internal::caching_properties.name(), _)).Times(AnyNumber()); std::string set_cache_dir = {}; - EXPECT_CALL(*mockPlugin, set_property(_)).Times(AtLeast(2)).WillRepeatedly(Invoke([&](const ov::AnyMap& config) { - ASSERT_NE(config.count(ov::cache_dir.name()), 0); - set_cache_dir = config.at(ov::cache_dir.name()).as(); + EXPECT_CALL(*mockPlugin, set_property(_)).Times(AtLeast(1)).WillRepeatedly(Invoke([&](const ov::AnyMap& config) { + ASSERT_EQ(config.count(ov::cache_dir.name()), 0); })); { EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(m_remoteContext ? 2 : 0); @@ -1107,13 +1106,14 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore_SupportsCacheDir_NoImportExpor testLoad([&](ov::Core& core) { core.set_property(ov::cache_dir(m_cacheDir)); m_testFunction(core); - EXPECT_EQ(set_cache_dir, m_cacheDir); + EXPECT_NE(set_cache_dir, m_cacheDir); std::string new_cache_dir = m_cacheDir + "2"; MkDirGuard dir(new_cache_dir); core.set_property(ov::cache_dir(new_cache_dir)); m_testFunction(core); - EXPECT_EQ(set_cache_dir, new_cache_dir); + EXPECT_NE(set_cache_dir, new_cache_dir); + EXPECT_EQ(set_cache_dir, ""); }); } } @@ -1169,7 +1169,7 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore_by_device_name_supports_cache_ EXPECT_CALL(*mockPlugin, get_property(ov::internal::supported_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, get_property(ov::internal::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, set_property(_)).Times(AtLeast(2)).WillRepeatedly(Invoke([](const ov::AnyMap& config) { - ASSERT_GT(config.count(ov::cache_dir.name()), 0); + ASSERT_EQ(config.count(ov::cache_dir.name()), 0); })); { EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(m_remoteContext ? 2 : 0); @@ -1214,6 +1214,7 @@ TEST_P(CachingTest, TestClearCacheDir) { for (auto& model : comp_models) { EXPECT_CALL(*model, export_model(_)).Times(0); } + EXPECT_CALL(*mockPlugin, OnCompileModelFromFile()).Times(m_type == TestLoadType::EModelName ? 1 : 0); testLoad([&](ov::Core& core) { core.set_property(ov::cache_dir(m_cacheDir)); core.set_property(ov::cache_dir("")); @@ -1930,6 +1931,7 @@ TEST_P(CachingTest, LoadHetero_NoCacheMetric) { EXPECT_CALL(*mockPlugin, get_property(ov::internal::supported_properties.name(), _)) .Times(AnyNumber()) .WillRepeatedly(Return(std::vector{})); + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(m_remoteContext ? 0 : 1); // Hetero supports Import/Export, but mock plugin does not deviceToLoad = ov::test::utils::DEVICE_HETERO + std::string(":mock.1,mock.2"); if (m_remoteContext) { @@ -1961,6 +1963,7 @@ TEST_P(CachingTest, LoadHetero_OneDevice) { return; // skip the remote Context test for Hetero plugin } { + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(m_remoteContext ? 0 : 1); EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(A&>(), _)).Times(1); EXPECT_CALL(*mockPlugin, import_model(A(), _, _)).Times(0); @@ -1977,6 +1980,7 @@ TEST_P(CachingTest, LoadHetero_OneDevice) { } m_post_mock_net_callbacks.pop_back(); { + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(A&>(), _)).Times(0); EXPECT_CALL(*mockPlugin, import_model(A(), _, _)).Times(0); @@ -2000,6 +2004,7 @@ TEST_P(CachingTest, LoadHetero_TargetFallbackFromCore) { return; // skip the remote Context test for Hetero plugin } { + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(1); EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(A&>(), _)).Times(1); EXPECT_CALL(*mockPlugin, import_model(A(), _, _)).Times(0); @@ -2017,6 +2022,7 @@ TEST_P(CachingTest, LoadHetero_TargetFallbackFromCore) { } m_post_mock_net_callbacks.pop_back(); { + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(m_remoteContext ? 0 : 0); EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(A&>(), _)).Times(0); EXPECT_CALL(*mockPlugin, import_model(A(), _, _)).Times(0); @@ -2070,6 +2076,7 @@ TEST_P(CachingTest, LoadHetero_MultiArchs) { return; // skip the remote Context test for Hetero plugin } { + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(m_remoteContext ? 0 : 3); EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(A&>(), _)) .Times(AtLeast(2)); // for .1 and for .51 @@ -2088,6 +2095,7 @@ TEST_P(CachingTest, LoadHetero_MultiArchs) { deviceToLoad = ov::test::utils::DEVICE_HETERO + std::string(":mock.2,mock.52"); { + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(A&>(), _)).Times(0); EXPECT_CALL(*mockPlugin, import_model(A(), _, _)).Times(0); @@ -2103,6 +2111,7 @@ TEST_P(CachingTest, LoadHetero_MultiArchs) { deviceToLoad = ov::test::utils::DEVICE_HETERO + std::string(":mock.53,mock.3"); m_post_mock_net_callbacks.pop_back(); { + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(m_remoteContext ? 0 : 3); EXPECT_CALL(*mockPlugin, compile_model(_, _, _)).Times(0); EXPECT_CALL(*mockPlugin, compile_model(A&>(), _)).Times(AtLeast(1)); EXPECT_CALL(*mockPlugin, import_model(A(), _, _)).Times(0); @@ -2132,6 +2141,7 @@ TEST_P(CachingTest, LoadHetero_MultiArchs_TargetFallback_FromCore) { return "mock_another_architecture"; } })); + EXPECT_CALL(*mockPlugin, get_default_context(_)).Times(m_remoteContext ? 0 : 2); deviceToLoad = ov::test::utils::DEVICE_HETERO; if (m_remoteContext) { return; // skip the remote Context test for Hetero plugin diff --git a/src/plugins/intel_gpu/src/plugin/compiled_model.cpp b/src/plugins/intel_gpu/src/plugin/compiled_model.cpp index ac7d7263b846fe..c9a6fdd93115ce 100644 --- a/src/plugins/intel_gpu/src/plugin/compiled_model.cpp +++ b/src/plugins/intel_gpu/src/plugin/compiled_model.cpp @@ -265,7 +265,6 @@ ov::Any CompiledModel::get_property(const std::string& name) const { ov::PropertyName{ov::intel_gpu::hint::queue_throttle.name(), PropertyMutability::RO}, ov::PropertyName{ov::intel_gpu::enable_loop_unrolling.name(), PropertyMutability::RO}, ov::PropertyName{ov::intel_gpu::disable_winograd_convolution.name(), PropertyMutability::RO}, - ov::PropertyName{ov::cache_dir.name(), PropertyMutability::RO}, ov::PropertyName{ov::cache_mode.name(), PropertyMutability::RO}, ov::PropertyName{ov::hint::performance_mode.name(), PropertyMutability::RO}, ov::PropertyName{ov::hint::execution_mode.name(), PropertyMutability::RO}, diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cpp index 4e3f9f14273d7d..035e2da5bdee37 100644 --- a/src/plugins/intel_gpu/src/plugin/plugin.cpp +++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp @@ -711,7 +711,6 @@ std::vector Plugin::get_supported_properties() const { ov::PropertyName{ov::intel_gpu::hint::enable_lora_operation.name(), PropertyMutability::RW}, ov::PropertyName{ov::intel_gpu::enable_loop_unrolling.name(), PropertyMutability::RW}, ov::PropertyName{ov::intel_gpu::disable_winograd_convolution.name(), PropertyMutability::RW}, - ov::PropertyName{ov::cache_dir.name(), PropertyMutability::RW}, ov::PropertyName{ov::cache_mode.name(), PropertyMutability::RW}, ov::PropertyName{ov::hint::performance_mode.name(), PropertyMutability::RW}, ov::PropertyName{ov::hint::execution_mode.name(), PropertyMutability::RW}, diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp index 37b8eb5260f9a9..d5aa024dd31ebf 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp @@ -71,6 +71,7 @@ TEST_P(KVCacheTest, Inference_cached) { ov::test::utils::removeFilesWithExt(cacheDirName, "blob"); ov::test::utils::removeFilesWithExt(cacheDirName, "cl_cache"); ov::test::utils::removeDir(cacheDirName); + core->set_property(ov::cache_dir(cacheDirName)); configuration.insert(ov::cache_dir(cacheDirName)); compile_model(); } diff --git a/src/plugins/intel_npu/src/plugin/src/properties.cpp b/src/plugins/intel_npu/src/plugin/src/properties.cpp index 0432b69af2b363..784f180ab1e567 100644 --- a/src/plugins/intel_npu/src/plugin/src/properties.cpp +++ b/src/plugins/intel_npu/src/plugin/src/properties.cpp @@ -352,7 +352,6 @@ void Properties::registerPluginProperties() { TRY_REGISTER_SIMPLE_PROPERTY(ov::compilation_num_threads, COMPILATION_NUM_THREADS); TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::inference_precision, INFERENCE_PRECISION_HINT); TRY_REGISTER_SIMPLE_PROPERTY(ov::log::level, LOG_LEVEL); - TRY_REGISTER_SIMPLE_PROPERTY(ov::cache_dir, CACHE_DIR); TRY_REGISTER_SIMPLE_PROPERTY(ov::cache_mode, CACHE_MODE); TRY_REGISTER_SIMPLE_PROPERTY(ov::hint::compiled_blob, COMPILED_BLOB); TRY_REGISTER_SIMPLE_PROPERTY(ov::device::id, DEVICE_ID); @@ -596,7 +595,6 @@ void Properties::registerCompiledModelProperties() { // Properties we shall only enable if they were set prior-to-compilation TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::weights_path, WEIGHTS_PATH); - TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::cache_dir, CACHE_DIR); TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::enable_profiling, PERF_COUNT); TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::profiling_type, PROFILING_TYPE); TRY_REGISTER_COMPILEDMODEL_PROPERTY_IFSET(ov::intel_npu::turbo, TURBO); From e9727af4233ad7171c21965f7061b1804855edf0 Mon Sep 17 00:00:00 2001 From: Pawel Raasz Date: Mon, 3 Nov 2025 18:03:45 +0000 Subject: [PATCH 2/5] Update Node JS tests Signed-off-by: Pawel Raasz --- src/bindings/js/node/tests/unit/basic.test.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/bindings/js/node/tests/unit/basic.test.js b/src/bindings/js/node/tests/unit/basic.test.js index d417065b5fa919..b108d8ac7079b6 100644 --- a/src/bindings/js/node/tests/unit/basic.test.js +++ b/src/bindings/js/node/tests/unit/basic.test.js @@ -345,12 +345,9 @@ describe("ov basic tests.", () => { }); it("Test importModelSync(stream, device, config: unsupported property) \ - throws", () => { + no exception core property not passed to device", () => { const tmpDir = "/tmp"; - assert.throws( - () => core.importModelSync(userStream, "CPU", { CACHE_DIR: tmpDir }), - /Unsupported property CACHE_DIR by CPU plugin./, - ); + core.importModelSync(userStream, "CPU", { CACHE_DIR: tmpDir }); }); it("importModel returns promise with CompiledModel", async () => { From feef71a44c4a73653d9efc9aa206b96bde9c61b9 Mon Sep 17 00:00:00 2001 From: Pawel Raasz Date: Tue, 4 Nov 2025 15:08:29 +0000 Subject: [PATCH 3/5] Update JS unsupported property test Signed-off-by: Pawel Raasz --- src/bindings/js/node/tests/unit/basic.test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bindings/js/node/tests/unit/basic.test.js b/src/bindings/js/node/tests/unit/basic.test.js index b108d8ac7079b6..1f17e488eaa472 100644 --- a/src/bindings/js/node/tests/unit/basic.test.js +++ b/src/bindings/js/node/tests/unit/basic.test.js @@ -345,9 +345,11 @@ describe("ov basic tests.", () => { }); it("Test importModelSync(stream, device, config: unsupported property) \ - no exception core property not passed to device", () => { - const tmpDir = "/tmp"; - core.importModelSync(userStream, "CPU", { CACHE_DIR: tmpDir }); + throws", () => { + assert.throws( + () => core.importModelSync(userStream, "CPU", { NPU_DEVICE_TOTAL_MEM_SIZE: 1024}), + /Unsupported property NPU_DEVICE_TOTAL_MEM_SIZE by CPU plugin./, + ); }); it("importModel returns promise with CompiledModel", async () => { From 75154a6189fe0ebd21a5c65bdb90b1902ff313ed Mon Sep 17 00:00:00 2001 From: Pawel Raasz Date: Wed, 5 Nov 2025 05:15:03 +0000 Subject: [PATCH 4/5] Fix style Signed-off-by: Pawel Raasz --- src/bindings/js/node/tests/unit/basic.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/js/node/tests/unit/basic.test.js b/src/bindings/js/node/tests/unit/basic.test.js index 1f17e488eaa472..9b1bda05410afe 100644 --- a/src/bindings/js/node/tests/unit/basic.test.js +++ b/src/bindings/js/node/tests/unit/basic.test.js @@ -347,7 +347,7 @@ describe("ov basic tests.", () => { it("Test importModelSync(stream, device, config: unsupported property) \ throws", () => { assert.throws( - () => core.importModelSync(userStream, "CPU", { NPU_DEVICE_TOTAL_MEM_SIZE: 1024}), + () => core.importModelSync(userStream, "CPU", { NPU_DEVICE_TOTAL_MEM_SIZE: 1024 }), /Unsupported property NPU_DEVICE_TOTAL_MEM_SIZE by CPU plugin./, ); }); From c9b2bc139a79c222e6c0242c57333d00245159fa Mon Sep 17 00:00:00 2001 From: "Raasz, Pawel" Date: Fri, 7 Nov 2025 10:07:38 +0000 Subject: [PATCH 5/5] Fix code style Signed-off-by: Raasz, Pawel --- src/inference/src/dev/core_impl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index e57dc1fd2201fa..6a4914f9d20cd7 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -831,9 +831,9 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::shared_ptr< const auto model = apply_auto_batching(model_, patched_device_name, config_with_batch); auto parsed = parse_device_name_into_config(patched_device_name, - m_core_config, - config_with_batch, - is_proxy_device(patched_device_name)); + m_core_config, + config_with_batch, + is_proxy_device(patched_device_name)); auto plugin = get_plugin(parsed.m_device_name); const auto cache_manager = parsed.m_core_config.get_cache_config_for_device(plugin, parsed.m_config).m_cache_manager; @@ -1686,7 +1686,8 @@ void ov::CoreConfig::set(const ov::AnyMap& config, const std::string& device_nam set(config); } else if (const auto cache_dir_entry = config.find(ov::cache_dir.name()); cache_dir_entry != config.end()) { std::lock_guard lock(m_cache_config_mutex); - m_devices_cache_config[device_name] = CoreConfig::CacheConfig::create(cache_dir_entry->second.as()); + m_devices_cache_config[device_name] = + CoreConfig::CacheConfig::create(cache_dir_entry->second.as()); } }