diff --git a/src/frontends/ir/src/frontend.cpp b/src/frontends/ir/src/frontend.cpp index 5f3cf4718d7cb2..1a34bede9e8675 100644 --- a/src/frontends/ir/src/frontend.cpp +++ b/src/frontends/ir/src/frontend.cpp @@ -130,11 +130,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector& variants) const return exts; }; -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - auto create_input_model = [&](std::wstring& weights_path) -> std::shared_ptr { -#else auto create_input_model = [&](std::string& weights_path) -> std::shared_ptr { -#endif if (provided_model_stream) { return std::make_shared(*provided_model_stream, weights, create_extensions_map(), weights_path); } else if (local_model_stream.is_open()) { @@ -241,7 +237,11 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector& variants) const } } +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) + return create_input_model(ov::util::wstring_to_string(weights_path)); +#else return create_input_model(weights_path); +#endif } std::shared_ptr FrontEnd::convert(const InputModel::Ptr& model) const { diff --git a/src/frontends/ir/src/input_model.cpp b/src/frontends/ir/src/input_model.cpp index 23d58ab5a1ecd9..0bd614f3904055 100644 --- a/src/frontends/ir/src/input_model.cpp +++ b/src/frontends/ir/src/input_model.cpp @@ -205,24 +205,16 @@ class InputModel::InputModelIRImpl { std::unordered_map m_opsets; pugi::xml_node m_root; pugi::xml_document m_xml_doc; -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring m_weights_path; -#else std::string m_weights_path; -#endif public: InputModelIRImpl(std::istream& stream, const std::shared_ptr& weights, const std::unordered_map& extensions, -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring& m_weights_path) -#else - std::string& m_weights_path) -#endif + std::string& weights_path) : m_weights(weights), m_extensions(extensions), - m_weights_path(m_weights_path) { + m_weights_path(weights_path) { pugi::xml_parse_result res = m_xml_doc.load(stream); if (res.status != pugi::status_ok) { OPENVINO_THROW(res.description(), " at offset ", res.offset); @@ -239,11 +231,7 @@ class InputModel::InputModelIRImpl { InputModel::InputModel(std::istream& stream, const std::shared_ptr& weights, const std::unordered_map& extensions, -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring weights_path) { -#else std::string weights_path) { -#endif _impl = std::make_shared(stream, weights, extensions, weights_path); } diff --git a/src/frontends/ir/src/input_model.hpp b/src/frontends/ir/src/input_model.hpp index 6ed8f31cd69933..7fb7f25b996dc5 100644 --- a/src/frontends/ir/src/input_model.hpp +++ b/src/frontends/ir/src/input_model.hpp @@ -23,11 +23,7 @@ class InputModel : public ov::frontend::InputModel { InputModel(std::istream& stream, const std::shared_ptr& weights, const std::unordered_map& extensions, -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring weights_path = L""); -#else std::string weights_path = ""); -#endif std::shared_ptr convert(); }; diff --git a/src/plugins/intel_gpu/include/intel_gpu/plugin/compiled_model.hpp b/src/plugins/intel_gpu/include/intel_gpu/plugin/compiled_model.hpp index d9db5aae7586aa..f6b7f2ce869965 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/plugin/compiled_model.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/plugin/compiled_model.hpp @@ -70,11 +70,7 @@ class CompiledModel : public ov::ICompiledModel { std::vector> m_outputs; std::vector> m_graphs; bool m_loaded_from_cache; -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring m_weights_path; -#else std::string m_weights_path; -#endif }; } // namespace intel_gpu diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp index b94e1b6fb64137..0c659db21528a3 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/data.hpp @@ -35,11 +35,7 @@ struct data : public primitive_base { size_t original_size = SIZE_MAX; size_t bin_offset = SIZE_MAX; -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring weights_path = L""; -#else std::string weights_path = ""; -#endif size_t hash() const override { size_t seed = primitive::hash(); diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp index e1fd081feb62da..50de64ec56c880 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/internal_properties.hpp @@ -56,11 +56,7 @@ static constexpr Property max_dynamic_batch{"DYN static constexpr Property nv12_two_inputs{"GPU_NV12_TWO_INPUTS"}; static constexpr Property buffers_preallocation_ratio{"GPU_BUFFERS_PREALLOCATION_RATIO"}; static constexpr Property max_kernels_per_batch{"GPU_MAX_KERNELS_PER_BATCH"}; -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) -static constexpr Property weights_path{"GPU_WEIGHTS_PATH"}; -#else static constexpr Property weights_path{"GPU_WEIGHTS_PATH"}; -#endif } // namespace intel_gpu } // namespace ov diff --git a/src/plugins/intel_gpu/src/graph/program.cpp b/src/plugins/intel_gpu/src/graph/program.cpp index 8d9e14cc4c682f..3dba9017954f9e 100644 --- a/src/plugins/intel_gpu/src/graph/program.cpp +++ b/src/plugins/intel_gpu/src/graph/program.cpp @@ -1723,11 +1723,7 @@ void program::cancel_compilation_context() { } void program::save(cldnn::BinaryOutputBuffer& ob) const { -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring weights_path; -#else std::string weights_path; -#endif weights_path = _config.get_property(ov::intel_gpu::weights_path); ob << weights_path; @@ -1846,11 +1842,7 @@ void program::save(cldnn::BinaryOutputBuffer& ob) const { void program::load(cldnn::BinaryInputBuffer& ib) { init_program(); -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::wstring weights_path; -#else std::string weights_path; -#endif ib >> weights_path; ov::AnyMap weights_path_property{{"GPU_WEIGHTS_PATH", weights_path}}; _config.set_property(weights_path_property); diff --git a/src/plugins/intel_gpu/src/plugin/compiled_model.cpp b/src/plugins/intel_gpu/src/plugin/compiled_model.cpp index 298239f34a66e6..0823272e7e82d9 100644 --- a/src/plugins/intel_gpu/src/plugin/compiled_model.cpp +++ b/src/plugins/intel_gpu/src/plugin/compiled_model.cpp @@ -50,14 +50,12 @@ CompiledModel::CompiledModel(std::shared_ptr model, m_model_name(model->get_friendly_name()), m_inputs(ov::ICompiledModel::inputs()), m_outputs(ov::ICompiledModel::outputs()), - m_loaded_from_cache(false) -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - , - m_weights_path(model->get_rt_info()["weights_path"].as()) { -#else - , - m_weights_path(model->get_rt_info()["weights_path"].as()) { -#endif + m_loaded_from_cache(false) { + auto model_rt_info = model->get_rt_info(); + auto weights_path = model_rt_info.find("weights_path"); + if (weights_path != model_rt_info.end()) { + m_weights_path = weights_path->second.as(); + } auto graph_base = std::make_shared(model, m_context, m_config, 0); for (uint16_t n = 0; n < m_config.get_property(ov::num_streams); n++) { auto graph = n == 0 ? graph_base : std::make_shared(graph_base, n); diff --git a/src/plugins/intel_gpu/src/runtime/execution_config.cpp b/src/plugins/intel_gpu/src/runtime/execution_config.cpp index c58f9c9fe5b1ff..3596a600e91fb1 100644 --- a/src/plugins/intel_gpu/src/runtime/execution_config.cpp +++ b/src/plugins/intel_gpu/src/runtime/execution_config.cpp @@ -80,11 +80,7 @@ void ExecutionConfig::set_default() { std::make_tuple(ov::intel_gpu::use_only_static_kernels_for_dynamic_shape, false), std::make_tuple(ov::intel_gpu::buffers_preallocation_ratio, 1.1f), std::make_tuple(ov::intel_gpu::max_kernels_per_batch, 8), -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) - std::make_tuple(ov::intel_gpu::weights_path, L"")); -#else std::make_tuple(ov::intel_gpu::weights_path, "")); -#endif } void ExecutionConfig::register_property_impl(const std::pair& property, PropertyVisibility visibility, BaseValidator::Ptr validator) {