Skip to content

Conversation

@almilosz
Copy link
Contributor

@almilosz almilosz commented Jan 21, 2026

Details:

Tickets:

@github-actions github-actions bot added category: inference OpenVINO Runtime library - Inference category: CPP API OpenVINO CPP API bindings labels Jan 21, 2026
CompiledModel compile_model(const std::string& model_path, const AnyMap& properties = {});

template <class Path, std::enable_if_t<std::is_same_v<Path, std::filesystem::path>>* = nullptr>
auto compile_model(const Path& model_path, const AnyMap& properties = {}) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead remove it make if constexpr for string or wstring to call correct resolve overload use

const std::string& device_name,
const AnyMap& properties = {});

template <class Path, std::enable_if_t<std::is_constructible_v<std::wstring, Path>>* = nullptr>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is possible to remove this enable_if and resolve it by single template compile_model(const Path& model_path,

@github-actions github-actions bot added the category: IE Tests OpenVINO Test: plugins and common label Jan 29, 2026
@almilosz almilosz marked this pull request as ready for review January 29, 2026 17:42
@almilosz almilosz requested review from a team as code owners January 29, 2026 17:42
@almilosz almilosz requested a review from a team as a code owner February 2, 2026 10:46
@github-actions github-actions bot added the category: AUTO OpenVINO AUTO device selection plugin label Feb 2, 2026
CompiledModel compile_model(const std::wstring& model_path, const AnyMap& properties = {});
#endif
template <class Path, std::enable_if_t<std::is_constructible_v<std::string, Path>>* = nullptr>
CompiledModel compile_model(const Path& model_path, const AnyMap& properties = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is wstring version is handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I moved the implementation to std::filesystem::path, the "wstring version" was just explicitly calling "std::filesystem::version version" without any helpers like wstring_to_string. Now it's done implicitly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wstring -> path conversion may not work correctly in some cases, the test should be created to confirm it (see file_path.cpp) where there is dedicated constructor.

It safer to keep wstring version and make call by usingov::util::make_path conversion.

template <typename... Properties>
util::EnableIfAllStringAny<CompiledModel, Properties...> compile_model(const std::string& model_path,
template <class Path, class... Properties, std::enable_if_t<std::is_constructible_v<std::string, Path>>* = nullptr>
util::EnableIfAllStringAny<CompiledModel, Properties...> compile_model(const Path& model_path,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about wstring version?

}

TEST_F(CoreBaseTest, compile_model) {
generate_test_model_files("model2");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What special unicode characters are created in path?
why not use similar patter from test TEST_P(FileUtilTestP, create_directories) the test values can be re-used in other tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to reuse model_files_name_w, weight_files_name_w

std::vector<std::wstring> model_files_name_w, weight_files_name_w;

const auto model = core.compile_model(model_path, devices.at(0), ov::AnyMap{});
EXPECT_TRUE(model);
}
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be avoided similar like in TEST_P(FileUtilTestP, create_directories) test

Comment on lines +246 to +247
const auto model_path = model_file_name;
const auto weight_path = weight_file_name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why copy is required?

ov::SoPtr<ov::ICompiledModel> ov::Plugin::compile_model(const std::filesystem::path& model_path,
const ov::AnyMap& properties) const {
OV_PLUGIN_CALL_STATEMENT(return {m_ptr->compile_model(model_path, properties), m_so});
OV_PLUGIN_CALL_STATEMENT(return {m_ptr->compile_model(ov::util::path_to_string(model_path), properties), m_so});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this path conversion will be remove when plugin interface will be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@praasz praasz added this to the 2026.1 milestone Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: AUTO OpenVINO AUTO device selection plugin category: CPP API OpenVINO CPP API bindings category: IE Tests OpenVINO Test: plugins and common category: inference OpenVINO Runtime library - Inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants