Skip to content

Commit

Permalink
Apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
olpipi committed Sep 20, 2024
1 parent 6074ec3 commit 9b1e70d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 6 additions & 7 deletions src/inference/src/dev/core_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
parsed._config,
ov::SoPtr<ov::IRemoteContext>{},
cacheContent);
}, coreConfig.get_enable_mmap());
});
} else {
res = plugin.compile_model(model, parsed._config);
}
Expand Down Expand Up @@ -780,7 +780,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::shared_ptr<
std::unique_ptr<CacheGuardEntry> lock = cacheGuard.get_hash_lock(cacheContent.blobId);
res = load_model_from_cache(cacheContent, plugin, parsed._config, context, [&]() {
return compile_model_and_cache(plugin, model, parsed._config, context, cacheContent);
}, coreConfig.get_enable_mmap());
});
} else {
res = plugin.compile_model(model, context, parsed._config);
}
Expand All @@ -807,7 +807,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::string& mod
load_model_from_cache(cacheContent, plugin, parsed._config, ov::SoPtr<ov::IRemoteContext>{}, [&]() {
auto model = read_model(model_path, std::string{});
return compile_model_and_cache(plugin, model, parsed._config, {}, cacheContent);
}, coreConfig.get_enable_mmap());
});
} else {
compiled_model = plugin.compile_model(model_path, parsed._config);
}
Expand Down Expand Up @@ -839,7 +839,7 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::compile_model(const std::string& mod
parsed._config,
ov::SoPtr<ov::IRemoteContext>{},
cacheContent);
}, coreConfig.get_enable_mmap());
});
} else {
auto model = read_model(model_str, weights);
compiled_model = plugin.compile_model(model, parsed._config);
Expand Down Expand Up @@ -1401,14 +1401,13 @@ ov::SoPtr<ov::ICompiledModel> ov::CoreImpl::load_model_from_cache(
ov::Plugin& plugin,
const ov::AnyMap& config,
const ov::SoPtr<ov::IRemoteContext>& context,
std::function<ov::SoPtr<ov::ICompiledModel>()> compile_model_lambda,
bool enable_mmap) {
std::function<ov::SoPtr<ov::ICompiledModel>()> compile_model_lambda) const {
ov::SoPtr<ov::ICompiledModel> compiled_model;
struct HeaderException {};

OPENVINO_ASSERT(cacheContent.cacheManager != nullptr);
try {
cacheContent.cacheManager->read_cache_entry(cacheContent.blobId, enable_mmap, [&](std::istream& networkStream) {
cacheContent.cacheManager->read_cache_entry(cacheContent.blobId, coreConfig.get_enable_mmap(), [&](std::istream& networkStream) {
OV_ITT_SCOPE(FIRST_INFERENCE,
ov::itt::domains::LoadTime,
"Core::load_model_from_cache::ReadStreamAndImport");
Expand Down
5 changes: 2 additions & 3 deletions src/inference/src/dev/core_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,12 @@ class CoreImpl : public ov::ICore, public std::enable_shared_from_this<ov::ICore
const ov::SoPtr<ov::IRemoteContext>& context,
const CacheContent& cacheContent) const;

static ov::SoPtr<ov::ICompiledModel> load_model_from_cache(
ov::SoPtr<ov::ICompiledModel> load_model_from_cache(
const CacheContent& cacheContent,
ov::Plugin& plugin,
const ov::AnyMap& config,
const ov::SoPtr<ov::IRemoteContext>& context,
std::function<ov::SoPtr<ov::ICompiledModel>()> compile_model_lambda,
bool enable_mmap);
std::function<ov::SoPtr<ov::ICompiledModel>()> compile_model_lambda) const;

bool device_supports_model_caching(const ov::Plugin& plugin) const;

Expand Down

0 comments on commit 9b1e70d

Please sign in to comment.