Skip to content

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

Fix import_compiled_model to use parsed config (#38191)

Joonho Yeomdd34cc5aa6f7
diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp
index adfc2a2d4ae..676e53f03e1 100644
--- a/src/inference/src/dev/core_impl.cpp
+++ b/src/inference/src/dev/core_impl.cpp
@@ -1155,7 +1155,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
is_proxy_device(patched_device_name));
auto plugin = get_plugin(parsed.m_device_name, parsed.m_config);
const auto& [cache_dir, cache_manager] = parsed.m_core_config.get_cache_config_for_device(plugin);
- auto compiled_model = import_compiled_model(plugin, {}, config, model);
+ auto compiled_model = import_compiled_model(plugin, {}, parsed.m_config, model);
// Skip caching for proxy plugin. HW plugin will load network from the cache
if (compiled_model) {
// hint::compiled_blob is set and imported skip compilation
diff --git a/src/inference/tests/functional/caching_test.cpp b/src/inference/tests/functional/caching_test.cpp
index 4325abbc8ad..a14f2d377df 100644
--- a/src/inference/tests/functional/caching_test.cpp
+++ b/src/inference/tests/functional/caching_test.cpp
@@ -3178,7 +3178,8 @@ TEST_P(CachingTest, import_from_cache_model_and_weights_path_properties_are_supp
});
}
-TEST_P(CachingTest, import_from_compiled_blob_weights_path_property_is_supported) {
+TEST_P(CachingTest, import_from_compiled_blob_preserves_import_properties) {
+ deviceToLoad = deviceName + ".1"; // To check device id retention on import.
ON_CALL(*mockPlugin, get_property(ov::supported_properties.name(), _))
.WillByDefault(Invoke([&](const std::string&, const ov::AnyMap&) {
return std::vector<ov::PropertyName>{ov::supported_properties.name(),
@@ -3195,6 +3196,10 @@ TEST_P(CachingTest, import_from_compiled_blob_weights_path_property_is_supported
EXPECT_EQ(config.count(ov::hint::compiled_blob.name()), 1);
EXPECT_EQ(config.count(ov::hint::model.name()), m_type != TestLoadType::EModelName ? 1 : 0);
EXPECT_EQ(config.count(ov::weights_path.name()), m_type == TestLoadType::EModelName ? 1 : 0);
+ EXPECT_EQ(config.count(ov::device::id.name()), 1);
+ if (config.count(ov::device::id.name())) {
+ EXPECT_EQ(config.at(ov::device::id.name()).as<std::string>(), "1");
+ }
return nullptr;
}));
EXPECT_CALL(*mockPlugin, get_property(_, _)).Times(AnyNumber());