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
This commit is contained in:
parent
6a25143045
commit
580b99c99b
@ -173,13 +173,13 @@ public:
|
||||
virtual std::vector<std::string> 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
|
||||
|
@ -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::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
|
||||
auto plugin = get_plugin(parsed._deviceName);
|
||||
ov::SoPtr<ov::ICompiledModel> 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::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
|
||||
auto plugin = get_plugin(parsed._deviceName);
|
||||
ov::SoPtr<ov::ICompiledModel> 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::ICompiledModel> ov::CoreImpl::compile_model(const std::string& mod
|
||||
ov::SoPtr<ov::ICompiledModel> 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::ICompiledModel> ov::CoreImpl::compile_model(const std::string& mod
|
||||
ov::SoPtr<ov::ICompiledModel> 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<InferenceEngine::IExtensionPtr>& 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<std::vector<std::string>>();
|
||||
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<bool>();
|
||||
auto supported = util::contains(supportedMetricKeys, METRIC_KEY(IMPORT_EXPORT_SUPPORT)) &&
|
||||
plugin.get_property(METRIC_KEY(IMPORT_EXPORT_SUPPORT), {}).as<bool>();
|
||||
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::ICompiledModel> ov::CoreImpl::compile_model_and_cache(const std::s
|
||||
OV_ITT_SCOPED_TASK(ov::itt::domains::IE, "CoreImpl::compile_model_and_cache");
|
||||
ov::SoPtr<ov::ICompiledModel> 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::ICompiledModel> 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<std::string>();
|
||||
if (device_priorities_it != user_config.end()) {
|
||||
property_config[device_priorities_it->first] = device_priorities_it->second.as<std::string>();
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -162,9 +162,9 @@ private:
|
||||
const ov::RemoteContext& context,
|
||||
std::function<ov::SoPtr<ov::ICompiledModel>()> 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<InferenceEngine::IExtensionPtr>& GetExtensions() const;
|
||||
|
||||
bool DeviceSupportsImportExport(const std::string& deviceName) const override;
|
||||
bool DeviceSupportsModelCaching(const std::string& deviceName) const override;
|
||||
|
||||
std::map<std::string, InferenceEngine::Version> GetVersions(const std::string& deviceName) const;
|
||||
|
||||
@ -341,7 +341,7 @@ public:
|
||||
|
||||
void add_extension(const std::vector<ov::Extension::Ptr>& 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<ov::Model> read_model(const std::string& model,
|
||||
|
@ -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<std::string, std::string> ov::CoreImpl::GetSupportedConfig(const std::string& deviceName,
|
||||
|
@ -371,6 +371,7 @@ private:
|
||||
.WillByDefault(Invoke([&](const std::string&, const std::map<std::string, Parameter>&) {
|
||||
std::vector<std::string> 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::PropertyName>{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::string, Parameter>&) {
|
||||
std::vector<ov::PropertyName> 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<std::string, std::string>& 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<std::string, std::string>&) {
|
||||
@ -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<std::string, Parameter>&) {
|
||||
return std::vector<std::string>{};
|
||||
@ -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<std::string>{}));
|
||||
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<std::string>{}));
|
||||
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<std::string, std::string>& 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<std::string, std::string>& 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<std::string, std::string>& 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<std::string, std::string>& 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<std::string, Parameter>& 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<std::string, Parameter>&) {
|
||||
return std::vector<ov::PropertyName>{ov::device::capabilities.name()};
|
||||
return std::vector<ov::PropertyName>{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<std::string, Parameter>&) {
|
||||
return std::vector<ov::PropertyName>{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<std::string, Parameter>&) {
|
||||
return std::vector<ov::PropertyName>{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<std::string, Parameter>&) {
|
||||
return std::vector<std::string>{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<std::string, Parameter>& 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<std::string, Parameter>& 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<Data>("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
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -177,6 +177,7 @@ Parameter Engine::GetMetric(const std::string& name, const std::map<std::string,
|
||||
ov::device::full_name.name(),
|
||||
METRIC_KEY(SUPPORTED_CONFIG_KEYS),
|
||||
METRIC_KEY(IMPORT_EXPORT_SUPPORT),
|
||||
ov::caching_properties.name(),
|
||||
ov::device::capabilities.name()});
|
||||
} else if (METRIC_KEY(SUPPORTED_CONFIG_KEYS) == name) {
|
||||
IE_SET_METRIC_RETURN(SUPPORTED_CONFIG_KEYS, getSupportedConfigKeys());
|
||||
|
@ -534,6 +534,7 @@ Parameter Engine::GetMetricLegacy(const std::string& name, const std::map<std::s
|
||||
METRIC_KEY(RANGE_FOR_ASYNC_INFER_REQUESTS),
|
||||
METRIC_KEY(RANGE_FOR_STREAMS),
|
||||
METRIC_KEY(IMPORT_EXPORT_SUPPORT),
|
||||
ov::caching_properties.name(),
|
||||
};
|
||||
IE_SET_METRIC_RETURN(SUPPORTED_METRICS, metrics);
|
||||
} else if (name == METRIC_KEY(FULL_DEVICE_NAME)) {
|
||||
@ -565,6 +566,9 @@ Parameter Engine::GetMetricLegacy(const std::string& name, const std::map<std::s
|
||||
IE_SET_METRIC_RETURN(RANGE_FOR_STREAMS, range);
|
||||
} else if (name == METRIC_KEY(IMPORT_EXPORT_SUPPORT)) {
|
||||
IE_SET_METRIC_RETURN(IMPORT_EXPORT_SUPPORT, true);
|
||||
} else if (name == ov::caching_properties) {
|
||||
std::vector<ov::PropertyName> 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<std::string,
|
||||
const std::tuple<unsigned int, unsigned int> 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<ov::PropertyName> cachingProperties;
|
||||
std::vector<ov::PropertyName> 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.
|
||||
|
@ -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<std::string> 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;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#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<ov::PropertyName> 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<std::string> capabilities = {ov::device::capability::FP32, ov::device::capability::EXPORT_IMPORT};
|
||||
|
@ -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<std::string>());
|
||||
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<std::string, std::string>(const std::string&, const std::map<std::string, std::string>&));
|
||||
MOCK_CONST_METHOD2(get_supported_property,
|
||||
|
Loading…
Reference in New Issue
Block a user