Skip to content

Commit

Permalink
[GPU] POC for shared plugin config (#28667)
Browse files Browse the repository at this point in the history
### Details:
- Added common base class for plugin configuration and migration in GPU
plugin.
- New config defines options as typed members of config class which
shall provide more efficient access to the value than AnyMap
- Property setting is possible before finalization only which shall
localize the point when config become immutable.
- All config options may be read from environment as well as from json
config file when OV is built w/ debug caps.
 - Debug and release options are defined and handled similarly now

---------

Signed-off-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com>
  • Loading branch information
vladimir-paramuzov authored Feb 18, 2025
1 parent 398842a commit ecc3477
Show file tree
Hide file tree
Showing 115 changed files with 2,216 additions and 2,014 deletions.
13 changes: 11 additions & 2 deletions src/core/src/any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

#include "openvino/core/any.hpp"

#include <array>
#include <limits>
#include <string>
#include <string_view>

#include "openvino/util/common_util.hpp"
namespace {
template <class Container>
bool contains_type_index(Container&& types, const std::type_info& user_type) {
Expand Down Expand Up @@ -202,9 +206,14 @@ namespace util {
void Read<bool>::operator()(std::istream& is, bool& value) const {
std::string str;
is >> str;
if (str == "YES") {

constexpr std::array<std::string_view, 4> off = {"0", "false", "off", "no"};
constexpr std::array<std::string_view, 4> on = {"1", "true", "on", "yes"};
str = util::to_lower(str);

if (std::find(on.begin(), on.end(), str) != on.end()) {
value = true;
} else if (str == "NO") {
} else if (std::find(off.begin(), off.end(), str) != off.end()) {
value = false;
} else {
OPENVINO_THROW("Could not convert to bool from string " + str);
Expand Down
10 changes: 9 additions & 1 deletion src/inference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ target_compile_definitions(${TARGET_NAME}_obj PRIVATE
IMPLEMENT_OPENVINO_RUNTIME_API
$<$<TARGET_EXISTS:openvino_proxy_plugin_obj>:PROXY_PLUGIN_ENABLED>)

if(ENABLE_DEBUG_CAPS)
target_compile_definitions(${TARGET_NAME}_obj PUBLIC ENABLE_DEBUG_CAPS)
endif()

target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE
$<TARGET_PROPERTY:openvino::pugixml,INTERFACE_INCLUDE_DIRECTORIES>
$<$<TARGET_EXISTS:xbyak::xbyak>:$<TARGET_PROPERTY:xbyak::xbyak,INTERFACE_INCLUDE_DIRECTORIES>>)
Expand All @@ -87,7 +91,7 @@ target_include_directories(${TARGET_NAME}_obj PRIVATE
# for ov_plugins.hpp
$<IF:$<AND:$<BOOL:${OV_GENERATOR_MULTI_CONFIG}>,$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.20>>,${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>,${CMAKE_CURRENT_BINARY_DIR}>)

target_link_libraries(${TARGET_NAME}_obj PRIVATE openvino::itt openvino::util openvino::core::dev)
target_link_libraries(${TARGET_NAME}_obj PRIVATE openvino::itt openvino::util openvino::core::dev nlohmann_json::nlohmann_json)
ov_mark_target_as_cc(${TARGET_NAME}_obj)

# OpenVINO Runtime is public API => need to mark this library as important for ABI free
Expand Down Expand Up @@ -133,6 +137,10 @@ target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS}

target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE)

if(ENABLE_DEBUG_CAPS)
target_compile_definitions(${TARGET_NAME}_s PUBLIC ENABLE_DEBUG_CAPS)
endif()

set_target_properties(${TARGET_NAME}_s PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})

# LTO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,11 @@ static constexpr Property<bool, PropertyMutability::RO> compiled_model_runtime_p
*/
static constexpr Property<float, PropertyMutability::RW> query_model_ratio{"QUERY_MODEL_RATIO"};

/**
* @brief Allow execution of low precision transformations in plugin's pipelines
* @ingroup ov_dev_api_plugin_api
*/
static constexpr Property<bool, PropertyMutability::RW> enable_lp_transformations{"LP_TRANSFORMS_MODE"};

} // namespace internal
} // namespace ov
Loading

0 comments on commit ecc3477

Please sign in to comment.