Skip to content

Commit

Permalink
Filter core properties by using local core config
Browse files Browse the repository at this point in the history
Signed-off-by: Raasz, Pawel <[email protected]>
  • Loading branch information
praasz committed Dec 10, 2024
1 parent ce822f7 commit 2772f3d
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 162 deletions.
251 changes: 111 additions & 140 deletions src/inference/src/dev/core_impl.cpp

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions src/inference/src/dev/core_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class CoreImpl : public ov::ICore, public std::enable_shared_from_this<ov::ICore

class CoreConfig final {
public:
CoreConfig() = default;
CoreConfig(const CoreConfig& other);

struct CacheConfig {
std::string _cacheDir;
std::shared_ptr<ov::ICacheManager> _cacheManager;
Expand All @@ -83,9 +86,8 @@ class CoreImpl : public ov::ICore, public std::enable_shared_from_this<ov::ICore

bool 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
CacheConfig get_cache_config_for_device(const ov::Plugin& plugin, ov::AnyMap& parsedConfig) const;
// Creating thread-safe copy of global config including shared_ptr to ICacheManager
CacheConfig get_cache_config_for_device(const ov::Plugin& plugin) const;

private:
mutable std::mutex _cacheConfigMutex;
Expand All @@ -96,12 +98,15 @@ class CoreImpl : public ov::ICore, public std::enable_shared_from_this<ov::ICore

struct CacheContent {
explicit CacheContent(const std::shared_ptr<ov::ICacheManager>& cache_manager,
bool mmap_enabled = false,
const std::string model_path = {})
: cacheManager(cache_manager),
modelPath(model_path) {}
modelPath(model_path),
mmap_enabled{mmap_enabled} {}
std::shared_ptr<ov::ICacheManager> cacheManager;
std::string blobId = {};
std::string modelPath = {};
bool mmap_enabled = false;
};

// Core settings (cache config, etc)
Expand Down Expand Up @@ -183,12 +188,6 @@ class CoreImpl : public ov::ICore, public std::enable_shared_from_this<ov::ICore
}
void add_extensions_unsafe(const std::vector<ov::Extension::Ptr>& extensions) const;

Plugin get_plugin(const std::string& pluginName, bool on_create_filter_config) const;

AnyMap get_supported_property(const Plugin& plugin, const AnyMap& config, bool keep_core, bool rw_only) const;

AnyMap get_hw_plugin_properties_or_forward(const Plugin& plugin, const AnyMap& config) const;

public:
CoreImpl();

Expand Down
2 changes: 0 additions & 2 deletions src/plugins/hetero/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ ov::Any ov::hetero::Plugin::get_property(const std::string& name, const ov::AnyM
} else if (ov::internal::supported_properties == name) {
return decltype(ov::internal::supported_properties)::value_type{
ov::PropertyName{ov::internal::caching_properties.name(), ov::PropertyMutability::RO},
// write-only as internal
ov::PropertyName{ov::cache_encryption_callbacks.name(), ov::PropertyMutability::WO},
};
} else if (ov::device::full_name == name) {
return decltype(ov::device::full_name)::value_type{get_device_name()};
Expand Down
7 changes: 0 additions & 7 deletions src/plugins/intel_cpu/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,6 @@ ov::Any Plugin::get_ro_property(const std::string& name, const ov::AnyMap& optio
#endif
ov::PropertyName{ov::internal::exclusive_async_requests.name(), ov::PropertyMutability::RW},
ov::PropertyName{ov::internal::compiled_model_runtime_properties.name(), ov::PropertyMutability::RO},
// as write-only as internal only
ov::PropertyName{ov::intel_cpu::snippets_mode.name(), ov::PropertyMutability::WO},
ov::PropertyName{ov::internal::compiled_model_runtime_properties_supported.name(),
ov::PropertyMutability::RO},
ov::PropertyName{ov::cache_encryption_callbacks.name(), ov::PropertyMutability::WO},
ov::PropertyName{ov::intel_cpu::lp_transforms_mode.name(), ov::PropertyMutability::WO},
ov::PropertyName{ov::intel_cpu::cpu_runtime_cache_capacity.name(), ov::PropertyMutability::WO},
};
} else if (name == ov::device::full_name) {
return decltype(ov::device::full_name)::value_type(deviceFullName);
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/template/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const
ov::PropertyName{ov::internal::caching_properties.name(), ov::PropertyMutability::RO},
ov::PropertyName{ov::internal::exclusive_async_requests.name(), ov::PropertyMutability::RW},
ov::PropertyName{ov::inference_num_threads.name(), ov::PropertyMutability::RW},
ov::PropertyName{ov::internal::threads_per_stream.name(), ov::PropertyMutability::RW},
ov::PropertyName{ov::cache_encryption_callbacks.name(), ov::PropertyMutability::WO}};
ov::PropertyName{ov::internal::threads_per_stream.name(), ov::PropertyMutability::RW}};
} else if (ov::available_devices == name) {
// TODO: fill list of available devices
return decltype(ov::available_devices)::value_type{{""}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,14 @@ TEST_P(OVCompiledModelBaseTest, canLoadCorrectNetworkToGetExecutableWithIncorrec
config.emplace(confItem.first, confItem.second);
}

OV_ASSERT_NO_THROW(std::ignore = core->compile_model(function, target_device, config));
bool is_meta_devices = target_device.find("AUTO") != std::string::npos ||
target_device.find("MULTI") != std::string::npos ||
target_device.find("HETERO") != std::string::npos;
if (is_meta_devices) {
EXPECT_NO_THROW(auto execNet = core->compile_model(function, target_device, config));
} else {
EXPECT_ANY_THROW(auto execNet = core->compile_model(function, target_device, config));
}
}

typedef std::tuple<ov::element::Type, // Type to convert
Expand Down

0 comments on commit 2772f3d

Please sign in to comment.