From 580b99c99b000edcdea46d23d62b3bbba980f0a6 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 25 Mar 2023 00:26:18 +0400 Subject: [PATCH] Align plugins in caching properties (#16528) * Align plugins in caching properties * Fixed caching mock tests * Added new TestNoCachingProperties test * Fixed test * Added ov::caching_properties to API 1.0 metrics as well --- src/inference/dev_api/ie_icore.hpp | 6 +- src/inference/src/dev/core_impl.cpp | 75 ++++++++-------- src/inference/src/dev/core_impl.hpp | 8 +- src/inference/src/dev/core_impl_ie.cpp | 4 +- .../tests/functional/caching_test.cpp | 85 ++++++++++++++++++- src/plugins/hetero/executable_network.cpp | 4 +- src/plugins/hetero/plugin.cpp | 1 + src/plugins/intel_cpu/src/plugin.cpp | 6 +- .../src/plugin/legacy_api_helper.cpp | 2 + src/plugins/template/src/plugin.cpp | 5 ++ .../cpp_interfaces/interface/mock_icore.hpp | 2 +- 11 files changed, 143 insertions(+), 55 deletions(-) diff --git a/src/inference/dev_api/ie_icore.hpp b/src/inference/dev_api/ie_icore.hpp index 03c298af681..8852c1f4ecd 100644 --- a/src/inference/dev_api/ie_icore.hpp +++ b/src/inference/dev_api/ie_icore.hpp @@ -173,13 +173,13 @@ public: virtual std::vector GetAvailableDevices() const = 0; /** - * @brief Checks whether device supports Export & Import functionality of network + * @brief Checks whether device supports model caching feature * * @param deviceName - A name of a device to get a metric value. - * @return True if device has IMPORT_EXPORT_SUPPORT metric in SUPPORTED_METRICS and + * @return True if device has IMPORT_EXPORT_SUPPORT and CACHING_PROPERTIES metric in SUPPORTED_METRICS and * this metric returns 'true', False otherwise. */ - virtual bool DeviceSupportsImportExport(const std::string& deviceName) const = 0; + virtual bool DeviceSupportsModelCaching(const std::string& deviceName) const = 0; /** * @brief Create a new shared context object on specified accelerator device diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index 3e696487e9d..6af7aec1d6c 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -299,8 +299,8 @@ ov::Parsed ov::parseDeviceNameIntoConfig(const std::string& deviceName, const An }; // clean-up auto-batch related properties - clean_batch_properties(updated_device_name, updated_config, ov::hint::allow_auto_batching.name()); - clean_batch_properties(updated_device_name, updated_config, ov::auto_batch_timeout.name()); + 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); return {updated_device_name, updated_config}; } @@ -558,7 +558,7 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::shared_ptr< auto plugin = get_plugin(parsed._deviceName); ov::SoPtr res; auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager; - if (cacheManager && device_supports_import_export(plugin)) { + if (cacheManager && device_supports_model_caching(plugin)) { CacheContent cacheContent{cacheManager}; cacheContent.blobId = ov::ModelCache::compute_hash(model, create_compile_config(plugin, parsed._config)); auto lock = cacheGuard.get_hash_lock(cacheContent.blobId); @@ -587,7 +587,7 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::shared_ptr< auto plugin = get_plugin(parsed._deviceName); ov::SoPtr res; auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager; - if (cacheManager && device_supports_import_export(plugin)) { + if (cacheManager && device_supports_model_caching(plugin)) { CacheContent cacheContent{cacheManager}; cacheContent.blobId = ov::ModelCache::compute_hash(model, create_compile_config(plugin, parsed._config)); auto lock = cacheGuard.get_hash_lock(cacheContent.blobId); @@ -629,7 +629,7 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::string& mod ov::SoPtr compiled_model; auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager; - if (cacheManager && device_supports_import_export(plugin)) { + if (cacheManager && device_supports_model_caching(plugin)) { CacheContent cacheContent{cacheManager, model_path}; cacheContent.blobId = ov::ModelCache::compute_hash(model_path, create_compile_config(plugin, parsed._config)); auto lock = cacheGuard.get_hash_lock(cacheContent.blobId); @@ -660,7 +660,7 @@ ov::SoPtr ov::CoreImpl::compile_model(const std::string& mod ov::SoPtr compiled_model; auto cacheManager = coreConfig.get_cache_config_for_device(plugin, parsed._config)._cacheManager; - if (cacheManager && device_supports_import_export(plugin)) { + if (cacheManager && device_supports_model_caching(plugin)) { CacheContent cacheContent{cacheManager}; cacheContent.blobId = ov::ModelCache::compute_hash(model_str, weights, create_compile_config(plugin, parsed._config)); @@ -1121,25 +1121,26 @@ const std::vector& ov::CoreImpl::GetExtensions() return extensions; } -bool ov::CoreImpl::device_supports_import_export(const std::string& deviceName) const { +bool ov::CoreImpl::device_supports_model_caching(const std::string& deviceName) const { auto parsed = parseDeviceNameIntoConfig(deviceName); - return device_supports_import_export(get_plugin(parsed._deviceName)); + return device_supports_model_caching(get_plugin(parsed._deviceName)); } -bool ov::CoreImpl::device_supports_property(const ov::Plugin& plugin, const std::string& key) const { +bool ov::CoreImpl::device_supports_property(const ov::Plugin& plugin, const ov::PropertyName& key) const { return util::contains(plugin.get_property(ov::supported_properties), key); } -bool ov::CoreImpl::device_supports_import_export(const ov::Plugin& plugin) const { +bool ov::CoreImpl::device_supports_model_caching(const ov::Plugin& plugin) const { auto supportedMetricKeys = plugin.get_property(METRIC_KEY(SUPPORTED_METRICS), {}).as>(); - auto it = std::find(supportedMetricKeys.begin(), supportedMetricKeys.end(), METRIC_KEY(IMPORT_EXPORT_SUPPORT)); - auto supported = - (it != supportedMetricKeys.end()) && plugin.get_property(METRIC_KEY(IMPORT_EXPORT_SUPPORT), {}).as(); + auto supported = util::contains(supportedMetricKeys, METRIC_KEY(IMPORT_EXPORT_SUPPORT)) && + plugin.get_property(METRIC_KEY(IMPORT_EXPORT_SUPPORT), {}).as(); if (!supported) { - if (device_supports_property(plugin, ov::device::capabilities.name())) { - supported = - util::contains(plugin.get_property(ov::device::capabilities), ov::device::capability::EXPORT_IMPORT); - } + supported = + device_supports_property(plugin, ov::device::capabilities) && + util::contains(plugin.get_property(ov::device::capabilities), ov::device::capability::EXPORT_IMPORT); + } + if (supported) { + supported = device_supports_property(plugin, ov::caching_properties); } return supported; } @@ -1156,7 +1157,7 @@ ov::SoPtr ov::CoreImpl::compile_model_and_cache(const std::s OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "CoreImpl::compile_model_and_cache"); ov::SoPtr execNetwork; execNetwork = compile_model_with_preprocess(plugin, model, context, parsedConfig); - if (cacheContent.cacheManager && device_supports_import_export(plugin)) { + if (cacheContent.cacheManager && device_supports_model_caching(plugin)) { try { // need to export network for further import from "cache" OV_ITT_SCOPE(FIRST_INFERENCE, InferenceEngine::itt::domains::IE_LT, "Core::compile_model::Export"); @@ -1227,15 +1228,14 @@ ov::SoPtr ov::CoreImpl::load_model_from_cache( ov::AnyMap ov::CoreImpl::create_compile_config(const ov::Plugin& plugin, const ov::AnyMap& user_config) const { ov::AnyMap property_config; - ov::AnyMap compile_config; - // 0. Move TARGET_FALLBACK key to property_config - auto targetFallbackIt = user_config.find("TARGET_FALLBACK"); - if (targetFallbackIt == user_config.end()) { - targetFallbackIt = user_config.find(ov::device::priorities.name()); + // 0. Move ov::device::priorities / TARGET_FALLBACK key to property_config + auto device_priorities_it = user_config.find("TARGET_FALLBACK"); + if (device_priorities_it == user_config.end()) { + device_priorities_it = user_config.find(ov::device::priorities.name()); } - if (targetFallbackIt != user_config.end()) { - property_config[targetFallbackIt->first] = targetFallbackIt->second.as(); + if (device_priorities_it != user_config.end()) { + property_config[device_priorities_it->first] = device_priorities_it->second.as(); } // 1. Move DEVICE_ID key to property_config @@ -1248,24 +1248,17 @@ ov::AnyMap ov::CoreImpl::create_compile_config(const ov::Plugin& plugin, const o // for the default device (e.g. DEVICE_ID = 0 for GPU) } - // 2. Replace DEVICE_ID with DEVICE_ARCHITECTURE value to identify device - if (device_supports_property(plugin, ov::device::architecture.name())) { - compile_config[ov::device::architecture.name()] = - plugin.get_property(ov::device::architecture, property_config); - } else { - // Take device name if device does not support DEVICE_ARCHITECTURE metric - compile_config[ov::device::architecture.name()] = plugin.get_name(); + // 2. Extract config keys which affect compilation process + auto caching_props = plugin.get_property(ov::caching_properties); + OPENVINO_ASSERT(!caching_props.empty(), "ov::caching_properties returned by ", plugin.get_name(), " are empty"); + + ov::AnyMap compile_config; + for (const auto& prop : caching_props) { + // user_config values have higher priority than plugin parameters + auto it = user_config.find(prop); + compile_config[prop] = it == user_config.end() ? plugin.get_property(prop, property_config) : it->second; } - // 3. Extract config keys which affect compilation process - if (device_supports_property(plugin, ov::caching_properties.name())) { - auto cachingProps = plugin.get_property(ov::caching_properties); - for (const auto& prop : cachingProps) { - // user_config values have higher priority than plugin parameters - auto it = user_config.find(prop); - compile_config[prop] = it == user_config.end() ? plugin.get_property(prop, property_config) : it->second; - } - } return compile_config; } diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hpp index c711e416484..179b59cc671 100644 --- a/src/inference/src/dev/core_impl.hpp +++ b/src/inference/src/dev/core_impl.hpp @@ -162,9 +162,9 @@ private: const ov::RemoteContext& context, std::function()> compile_model_lambda); - bool device_supports_import_export(const ov::Plugin& plugin) const; + bool device_supports_model_caching(const ov::Plugin& plugin) const; - bool device_supports_property(const ov::Plugin& plugin, const std::string& key) const; + bool device_supports_property(const ov::Plugin& plugin, const ov::PropertyName& key) const; OPENVINO_DEPRECATED("Don't use this method, it will be removed soon") bool device_supports_cache_dir(const ov::Plugin& plugin) const; @@ -297,7 +297,7 @@ public: */ const std::vector& GetExtensions() const; - bool DeviceSupportsImportExport(const std::string& deviceName) const override; + bool DeviceSupportsModelCaching(const std::string& deviceName) const override; std::map GetVersions(const std::string& deviceName) const; @@ -341,7 +341,7 @@ public: void add_extension(const std::vector& extensions); - bool device_supports_import_export(const std::string& deviceName) const; + bool device_supports_model_caching(const std::string& deviceName) const; // ov::ICore std::shared_ptr read_model(const std::string& model, diff --git a/src/inference/src/dev/core_impl_ie.cpp b/src/inference/src/dev/core_impl_ie.cpp index a04d4608104..12641651797 100644 --- a/src/inference/src/dev/core_impl_ie.cpp +++ b/src/inference/src/dev/core_impl_ie.cpp @@ -214,8 +214,8 @@ void ov::CoreImpl::AddExtension(const InferenceEngine::IExtensionPtr& extension) AddExtensionUnsafe(extension); } -bool ov::CoreImpl::DeviceSupportsImportExport(const std::string& deviceName) const { - return device_supports_import_export(deviceName); +bool ov::CoreImpl::DeviceSupportsModelCaching(const std::string& deviceName) const { + return device_supports_model_caching(deviceName); } std::map ov::CoreImpl::GetSupportedConfig(const std::string& deviceName, diff --git a/src/inference/tests/functional/caching_test.cpp b/src/inference/tests/functional/caching_test.cpp index e23c6c14d71..531c115a32f 100644 --- a/src/inference/tests/functional/caching_test.cpp +++ b/src/inference/tests/functional/caching_test.cpp @@ -371,6 +371,7 @@ private: .WillByDefault(Invoke([&](const std::string&, const std::map&) { std::vector res; res.emplace_back(METRIC_KEY(IMPORT_EXPORT_SUPPORT)); + res.emplace_back(ov::caching_properties.name()); res.emplace_back(METRIC_KEY(DEVICE_ARCHITECTURE)); return res; })); @@ -379,6 +380,7 @@ private: return std::vector{ov::supported_properties.name(), METRIC_KEY(IMPORT_EXPORT_SUPPORT), ov::device::capabilities.name(), + ov::caching_properties.name(), ov::device::architecture.name()}; })); @@ -404,6 +406,12 @@ private: return "mock"; })); + ON_CALL(plugin, GetMetric(ov::caching_properties.name(), _)) + .WillByDefault(Invoke([&](const std::string&, const std::map&) { + std::vector cachingProperties = {ov::device::architecture.name()}; + return decltype(ov::caching_properties)::value_type(cachingProperties); + })); + ON_CALL(plugin, ImportNetwork(_, _, _)) .WillByDefault(Invoke( [&](std::istream& istr, const RemoteContext::Ptr&, const std::map& config) { @@ -503,6 +511,7 @@ TEST_P(CachingTest, TestLoad) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -541,6 +550,7 @@ TEST_P(CachingTest, TestLoad_by_device_name) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -579,6 +589,7 @@ TEST_P(CachingTest, TestLoadCustomImportExport) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); ON_CALL(*mockPlugin, ImportNetwork(_, _, _)) .WillByDefault( Invoke([&](std::istream& s, const RemoteContext::Ptr&, const std::map&) { @@ -703,6 +714,7 @@ TEST_P(CachingTest, TestChangeLoadConfig_With_Cache_Dir_inline) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); ON_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_CONFIG_KEYS), _)) .WillByDefault(Invoke([&](const std::string&, const std::map&) { return std::vector{}; @@ -741,6 +753,7 @@ TEST_P(CachingTest, TestNoCacheEnabled) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(0); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -763,6 +776,7 @@ TEST_P(CachingTest, TestNoCacheSupported) { .Times(AnyNumber()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(ov::device::capabilities.name(), _)) .Times(AnyNumber()) .WillRepeatedly(Return(decltype(ov::device::capabilities)::value_type{})); @@ -793,6 +807,7 @@ TEST_P(CachingTest, TestNoCacheMetricSupported) { .WillRepeatedly(Return(std::vector{})); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(0); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(0); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(0); EXPECT_CALL(*mockPlugin, GetMetric(ov::device::capabilities.name(), _)).Times(0); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); @@ -821,6 +836,7 @@ TEST_P(CachingTest, TestNoCacheMetricSupported_by_device_name) { .WillRepeatedly(Return(std::vector{})); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(0); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(0); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(0); EXPECT_CALL(*mockPlugin, GetMetric(ov::device::capabilities.name(), _)).Times(0); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); @@ -1008,6 +1024,7 @@ TEST_P(CachingTest, TestLoadChangeCacheDir) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1046,6 +1063,7 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, SetConfig(_)) .Times(AnyNumber()) .WillRepeatedly(Invoke([](const std::map& config) { @@ -1082,6 +1100,7 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore_overwrite_device_dir) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, SetConfig(_)) .Times(AnyNumber()) .WillRepeatedly(Invoke([](const std::map& config) { @@ -1130,6 +1149,7 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore_SupportsCacheDir_NoImportExpor .Times(AnyNumber()) .WillRepeatedly(Return(decltype(ov::device::capabilities)::value_type{})); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); std::string set_cache_dir = {}; EXPECT_CALL(*mockPlugin, SetConfig(_)) .Times(AtLeast(2)) @@ -1167,6 +1187,7 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore_by_device_name) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, SetConfig(_)) .Times(AnyNumber()) .WillRepeatedly(Invoke([](const std::map& config) { @@ -1212,6 +1233,7 @@ TEST_P(CachingTest, TestLoadChangeCacheDirOneCore_by_device_name_supports_cache_ .Times(AnyNumber()) .WillRepeatedly(Return(decltype(ov::device::capabilities)::value_type{})); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, SetConfig(_)) .Times(AtLeast(2)) .WillRepeatedly(Invoke([](const std::map& config) { @@ -1247,6 +1269,7 @@ TEST_P(CachingTest, TestClearCacheDir) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(0); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1270,6 +1293,7 @@ TEST_P(CachingTest, TestChangeOtherConfig) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1294,6 +1318,7 @@ TEST_P(CachingTest, TestChangeCacheDirFailure) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1335,6 +1360,7 @@ TEST_P(CachingTest, TestCacheDirCreateRecursive) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1358,6 +1384,7 @@ TEST_P(CachingTest, TestDeviceArchitecture) { EXPECT_CALL(*mockPlugin, GetMetric(ov::supported_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([&](const std::string&, const std::map& options) { @@ -1433,7 +1460,12 @@ TEST_P(CachingTest, TestNoDeviceArchitecture) { EXPECT_CALL(*mockPlugin, GetMetric(ov::supported_properties.name(), _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([&](const std::string&, const std::map&) { - return std::vector{ov::device::capabilities.name()}; + return std::vector{ov::device::capabilities.name(), ov::caching_properties.name()}; + })); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)) + .Times(AnyNumber()) + .WillRepeatedly(Invoke([&](const std::string&, const std::map&) { + return std::vector{ov::supported_properties}; })); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)) .Times(AnyNumber()) @@ -1476,12 +1508,48 @@ TEST_P(CachingTest, TestNoDeviceArchitecture) { } } +TEST_P(CachingTest, TestNoCachingProperties) { + EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_CONFIG_KEYS), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::supported_properties.name(), _)) + .Times(AnyNumber()) + .WillRepeatedly(Invoke([&](const std::string&, const std::map&) { + return std::vector{ov::device::capabilities.name()}; + })); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(0); + EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)) + .Times(AnyNumber()) + .WillRepeatedly(Invoke([&](const std::string&, const std::map&) { + return std::vector{METRIC_KEY(IMPORT_EXPORT_SUPPORT)}; + })); + EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::device::capabilities.name(), _)) + .Times(AnyNumber()) + .WillRepeatedly(Return(decltype(ov::device::capabilities)::value_type{ov::device::capability::EXPORT_IMPORT})); + EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(0); + { + EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); + EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); + EXPECT_CALL(*mockPlugin, OnLoadNetworkFromFile()).Times(m_type == TestLoadType::EModelName ? 1 : 0); + EXPECT_CALL(*mockPlugin, ImportNetwork(_, _, _)).Times(0); + EXPECT_CALL(*mockPlugin, ImportNetwork(_, _)).Times(0); + m_post_mock_net_callbacks.emplace_back([&](MockExecutableNetwork& net) { + EXPECT_CALL(net, Export(_)).Times(0); + }); + testLoad([&](Core& ie) { + deviceToLoad = "mock.0"; + ie.SetConfig({{CONFIG_KEY(CACHE_DIR), m_cacheDir}}); + m_testFunction(ie); + }); + } +} + TEST_P(CachingTest, TestThrowOnExport) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_CONFIG_KEYS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(ov::supported_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1505,6 +1573,7 @@ TEST_P(CachingTest, TestThrowOnImport) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1558,6 +1627,7 @@ TEST_P(CachingTest, TestNetworkModified) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _)).Times(!m_remoteContext ? 1 : 0); @@ -1617,6 +1687,7 @@ TEST_P(CachingTest, TestCacheFileCorrupted) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); @@ -1673,6 +1744,7 @@ TEST_P(CachingTest, TestCacheFileOldVersion) { EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(SUPPORTED_METRICS), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(IMPORT_EXPORT_SUPPORT), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); { EXPECT_CALL(*mockPlugin, LoadExeNetworkImpl(_, _, _)).Times(m_remoteContext ? 1 : 0); @@ -1854,6 +1926,7 @@ TEST_P(CachingTest, LoadHetero_TargetFallbackFromCore) { TEST_P(CachingTest, LoadHetero_MultiArchs) { EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)) .Times(AnyNumber()) @@ -1938,6 +2011,7 @@ TEST_P(CachingTest, LoadHetero_MultiArchs) { TEST_P(CachingTest, LoadHetero_MultiArchs_TargetFallback_FromCore) { EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([&](const std::string&, const std::map& options) { @@ -2006,6 +2080,7 @@ TEST_P(CachingTest, LoadAUTO_OneDevice) { const auto TEST_COUNT = 2; EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); if (m_remoteContext) { return; // skip the remote Context test for Auto plugin @@ -2033,6 +2108,7 @@ TEST_P(CachingTest, LoadAUTOWithConfig) { const auto TEST_COUNT = 2; EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); if (m_remoteContext) { return; // skip the remote Context test for Auto plugin @@ -2064,6 +2140,7 @@ TEST_P(CachingTest, LoadAUTO_OneDeviceNoImportExport) { EXPECT_CALL(*mockPlugin, GetMetric(ov::device::capabilities.name(), _)) .Times(AnyNumber()) .WillRepeatedly(Return(decltype(ov::device::capabilities)::value_type{})); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); if (m_remoteContext) { return; // skip the remote Context test for Auto plugin @@ -2097,6 +2174,7 @@ TEST_P(CachingTest, LoadMulti_race) { EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); if (m_remoteContext) { return; // skip the remote Context test for Multi plugin } @@ -2137,6 +2215,7 @@ TEST_P(CachingTest, LoadMultiWithConfig_race) { EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); if (m_remoteContext) { return; // skip the remote Context test for Multi plugin } @@ -2174,6 +2253,7 @@ TEST_P(CachingTest, LoadMulti_Archs) { const auto TEST_DEVICE_MAX_COUNT = 30; // Shall be >= 2 EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([&](const std::string&, const std::map& options) { @@ -2230,6 +2310,7 @@ TEST_P(CachingTest, LoadMulti_NoCachingOnDevice) { .WillRepeatedly(Return(decltype(ov::device::capabilities)::value_type{})); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); DataPtr inData = std::make_shared("Param_1", Precision::FP32); InputInfo inpInfo; @@ -2284,6 +2365,7 @@ TEST_P(CachingTest, LoadBATCHWithConfig) { EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); if (m_remoteContext) { return; // skip the remote Context test for Auto plugin } @@ -2313,6 +2395,7 @@ TEST_P(CachingTest, Load_threads) { EXPECT_CALL(*mockPlugin, GetMetric(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, QueryNetwork(_, _)).Times(AnyNumber()); EXPECT_CALL(*mockPlugin, GetMetric(METRIC_KEY(DEVICE_ARCHITECTURE), _)).Times(AnyNumber()); + EXPECT_CALL(*mockPlugin, GetMetric(ov::caching_properties.name(), _)).Times(AnyNumber()); if (m_remoteContext) { return; // skip the remote Context test for Multi plugin } diff --git a/src/plugins/hetero/executable_network.cpp b/src/plugins/hetero/executable_network.cpp index 08bc69bc041..7e16133890b 100644 --- a/src/plugins/hetero/executable_network.cpp +++ b/src/plugins/hetero/executable_network.cpp @@ -498,7 +498,7 @@ HeteroExecutableNetwork::HeteroExecutableNetwork(std::istream& heteroModel, InferenceEngine::SoExecutableNetworkInternal executableNetwork; CNNNetwork cnnnetwork; bool loaded = false; - if (_heteroPlugin->GetCore()->DeviceSupportsImportExport(deviceName)) { + if (_heteroPlugin->GetCore()->DeviceSupportsModelCaching(deviceName)) { executableNetwork = _heteroPlugin->GetCore()->ImportNetwork(heteroModel, deviceName, loadConfig); } else { // read XML content @@ -699,7 +699,7 @@ void HeteroExecutableNetwork::Export(std::ostream& heteroModel) { heteroModel << std::endl; for (auto&& subnetwork : _networks) { - if (_heteroPlugin->GetCore()->DeviceSupportsImportExport(subnetwork._device)) { + if (_heteroPlugin->GetCore()->DeviceSupportsModelCaching(subnetwork._device)) { subnetwork._network->Export(heteroModel); } else { auto subnet = subnetwork._clonedNetwork; diff --git a/src/plugins/hetero/plugin.cpp b/src/plugins/hetero/plugin.cpp index 78b3c78eb3b..9ac6619b00f 100644 --- a/src/plugins/hetero/plugin.cpp +++ b/src/plugins/hetero/plugin.cpp @@ -177,6 +177,7 @@ Parameter Engine::GetMetric(const std::string& name, const std::map cachingProperties = { METRIC_KEY(FULL_DEVICE_NAME) }; + return decltype(ov::caching_properties)::value_type(cachingProperties); } IE_CPU_PLUGIN_THROW() << "Unsupported metric key: " << name; @@ -631,7 +635,7 @@ Parameter Engine::GetMetric(const std::string& name, const std::map range = std::make_tuple(1, parallel_get_max_threads()); return decltype(ov::range_for_streams)::value_type(range); } else if (name == ov::caching_properties) { - std::vector cachingProperties; + std::vector cachingProperties = { ov::device::full_name }; return decltype(ov::caching_properties)::value_type(cachingProperties); } /* Internally legacy parameters are used with new API as part of migration procedure. diff --git a/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp b/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp index 2108d800edd..56c92bc84bc 100644 --- a/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp +++ b/src/plugins/intel_gpu/src/plugin/legacy_api_helper.cpp @@ -4,6 +4,7 @@ #include "intel_gpu/plugin/legacy_api_helper.hpp" #include "ie_plugin_config.hpp" +#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp" #include "gpu/gpu_config.hpp" namespace ov { @@ -262,6 +263,7 @@ std::vector LegacyAPIHelper::get_supported_metrics() { GPU_METRIC_KEY(UARCH_VERSION), GPU_METRIC_KEY(EXECUTION_UNITS_COUNT), GPU_METRIC_KEY(MEMORY_STATISTICS), + ov::caching_properties.name(), }; return supported_metrics; diff --git a/src/plugins/template/src/plugin.cpp b/src/plugins/template/src/plugin.cpp index 6747d88cb8e..2c66fa25ae4 100644 --- a/src/plugins/template/src/plugin.cpp +++ b/src/plugins/template/src/plugin.cpp @@ -6,6 +6,7 @@ #include +#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp" #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" #include "ie_plugin_config.hpp" #include "itt.hpp" @@ -224,6 +225,7 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const ov::device::full_name, ov::device::architecture, ov::device::capabilities, + ov::caching_properties, ov::range_for_async_infer_requests}; return ro_properties; }; @@ -281,6 +283,9 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const // TODO: return device architecture for device specified by DEVICE_ID config std::string arch = "TEMPLATE"; return decltype(ov::device::architecture)::value_type(arch); + } else if (ov::caching_properties == name) { + std::vector caching_properties = {ov::device::architecture}; + return decltype(ov::caching_properties)::value_type(caching_properties); } else if (ov::device::capabilities == name) { // TODO: fill actual list of supported capabilities: e.g. Template device supports only FP32 and EXPORT_IMPORT std::vector capabilities = {ov::device::capability::FP32, ov::device::capability::EXPORT_IMPORT}; diff --git a/src/tests/ie_test_utils/unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp b/src/tests/ie_test_utils/unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp index b59e56a850e..530bd9e1a7c 100644 --- a/src/tests/ie_test_utils/unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp +++ b/src/tests/ie_test_utils/unit_test_utils/mocks/cpp_interfaces/interface/mock_icore.hpp @@ -59,7 +59,7 @@ public: MOCK_CONST_METHOD2(GetConfig, ov::Any(const std::string&, const std::string&)); MOCK_CONST_METHOD3(get_property, ov::Any(const std::string&, const std::string&, const ov::AnyMap&)); MOCK_CONST_METHOD0(GetAvailableDevices, std::vector()); - MOCK_CONST_METHOD1(DeviceSupportsImportExport, bool(const std::string&)); // NOLINT not a cast to bool + MOCK_CONST_METHOD1(DeviceSupportsModelCaching, bool(const std::string&)); // NOLINT not a cast to bool MOCK_METHOD2(GetSupportedConfig, std::map(const std::string&, const std::map&)); MOCK_CONST_METHOD2(get_supported_property,