Skip to content

Commit

Permalink
openvino/2024.5.0 update
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lavrenov <[email protected]>
  • Loading branch information
ilya-lavrenov committed Jan 12, 2025
1 parent 401edd4 commit d807dde
Show file tree
Hide file tree
Showing 10 changed files with 409 additions and 90 deletions.
26 changes: 0 additions & 26 deletions ports/openvino/002-fix-onnx.patch

This file was deleted.

28 changes: 28 additions & 0 deletions ports/openvino/002-protobuf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/src/frontends/onnx/frontend/src/frontend.cpp b/src/frontends/onnx/frontend/src/frontend.cpp
index 5ad28be3654422..5296e5b1b7a506 100644
--- a/src/frontends/onnx/frontend/src/frontend.cpp
+++ b/src/frontends/onnx/frontend/src/frontend.cpp
@@ -3,6 +3,9 @@
//

#include <google/protobuf/port_def.inc>
+#ifndef PROTOBUF_VERSION
+# include <google/protobuf/runtime_version.h>
+#endif
#if PROTOBUF_VERSION >= 4022000 // protobuf 4.22
# define OV_PROTOBUF_ABSL_IS_USED
#endif
diff --git a/src/frontends/paddle/src/frontend.cpp b/src/frontends/paddle/src/frontend.cpp
index 163b4d894cb766..2f2ca72418e5dd 100644
--- a/src/frontends/paddle/src/frontend.cpp
+++ b/src/frontends/paddle/src/frontend.cpp
@@ -5,6 +5,9 @@
#include "openvino/frontend/paddle/frontend.hpp"

#include <google/protobuf/port_def.inc>
+#ifndef PROTOBUF_VERSION
+# include <google/protobuf/runtime_version.h>
+#endif
#if PROTOBUF_VERSION >= 4022000 // protobuf 4.22
# define OV_PROTOBUF_ABSL_IS_USED
#endif
37 changes: 0 additions & 37 deletions ports/openvino/003-protobuf.patch

This file was deleted.

52 changes: 52 additions & 0 deletions ports/openvino/003-snippets-templates.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/docs/snippets/CMakeLists.txt b/docs/snippets/CMakeLists.txt
index ec1cf14bd0e60b..18d176212a0212 100644
--- a/docs/snippets/CMakeLists.txt
+++ b/docs/snippets/CMakeLists.txt
@@ -122,12 +122,15 @@ set(TARGET_NAME_PY "ov_integration_snippet_py")
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)

-find_package(Python3 REQUIRED)
- execute_process(
- COMMAND ${Python3_EXECUTABLE} -c "from openvino.utils import get_cmake_path; print(get_cmake_path(), end='')"
- OUTPUT_VARIABLE OpenVINO_DIR_PY
- ERROR_QUIET
- )
+if(NOT CMAKE_CROSSCOMPILING)
+ find_package(Python3 QUIET COMPONENTS Interpreter)
+ if(Python3_Interpreter_FOUND)
+ execute_process(
+ COMMAND ${Python3_EXECUTABLE} -c "from openvino.utils import get_cmake_path; print(get_cmake_path(), end='')"
+ OUTPUT_VARIABLE OpenVINO_DIR_PY
+ ERROR_QUIET)
+ endif()
+endif()

find_package(OpenVINO REQUIRED PATHS "${OpenVINO_DIR_PY}")

diff --git a/src/core/template_extension/CMakeLists.txt b/src/core/template_extension/CMakeLists.txt
index aa8030e78d7171..3cfcfcd058ff94 100644
--- a/src/core/template_extension/CMakeLists.txt
+++ b/src/core/template_extension/CMakeLists.txt
@@ -8,12 +8,15 @@ set(CMAKE_CXX_STANDARD 11)
set(TARGET_NAME "openvino_template_extension")

# The OpenVINO installed from PyPI can be used to find OpenVINO_DIR
-find_package(Python3 REQUIRED)
-execute_process(
- COMMAND ${Python3_EXECUTABLE} -c "from openvino.utils import get_cmake_path; print(get_cmake_path(), end='')"
- OUTPUT_VARIABLE OpenVINO_DIR_PY
- ERROR_QUIET
-)
+if(NOT CMAKE_CROSSCOMPILING)
+ find_package(Python3 QUIET COMPONENTS Interpreter)
+ if(Python3_Interpreter_FOUND)
+ execute_process(
+ COMMAND ${Python3_EXECUTABLE} -c "from openvino.utils import get_cmake_path; print(get_cmake_path(), end='')"
+ OUTPUT_VARIABLE OpenVINO_DIR_PY
+ ERROR_QUIET)
+ endif()
+endif()

find_package(OpenVINO REQUIRED PATHS "${OpenVINO_DIR_PY}")

File renamed without changes.
191 changes: 191 additions & 0 deletions ports/openvino/005-level-zero.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
commit 31b0560f226d199051766c6982be4a62046caaf5
Author: Ilya Lavrenov <[email protected]>
Date: Wed Nov 20 20:39:25 2024 +0400

[NPU] Allow to use system level-zero (#27633)

### Details:
-
https://github.com/conda-forge/openvino-feedstock/pull/110#discussion_r1849117753

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9e8d3724d..65a72ef8f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,7 +138,7 @@ function(ov_developer_package_export_targets)
endforeach()
endif()
else()
- message(FATAL_ERROR "Internal error: ${target_name} does not represent a cmake target")
+ message(FATAL_ERROR "Internal error: '${EXPORT_TARGET}' does not represent a cmake target")
endif()

list(REMOVE_DUPLICATES _OPENVINO_DEVELOPER_PACKAGE_TARGETS)
diff --git a/cmake/features.cmake b/cmake/features.cmake
index e1201ad3a1..f12810adf8 100644
--- a/cmake/features.cmake
+++ b/cmake/features.cmake
@@ -200,6 +200,9 @@ ov_dependent_option (ENABLE_SYSTEM_PROTOBUF "Enables use of system Protobuf" OFF
# the option is turned off by default, because we don't want to have a dependency on libsnappy.so
ov_dependent_option (ENABLE_SYSTEM_SNAPPY "Enables use of system version of Snappy" OFF
"ENABLE_SNAPPY_COMPRESSION" OFF)
+# the option is turned off by default, because we are not sure that system version of ZE loader is fresh enough
+ov_dependent_option (ENABLE_SYSTEM_LEVEL_ZERO "Enables use of system version of Level Zero" OFF
+ "ENABLE_INTEL_NPU" OFF)

ov_dependent_option(ENABLE_JS "Enables JS API building" ${ENABLE_JS_DEFAULT} "NOT ANDROID;NOT EMSCRIPTEN" OFF)

diff --git a/src/cmake/ov_parallel.cmake b/src/cmake/ov_parallel.cmake
index 110e7fe185..86a4a8092b 100644
--- a/src/cmake/ov_parallel.cmake
+++ b/src/cmake/ov_parallel.cmake
@@ -132,7 +132,7 @@ macro(ov_find_package_tbb)
IMPORTED_TARGET
# we need to set GLOBAL in order to create ALIAS later
# ALIAS creation for non-GLOBAL targets is available since cmake 3.18
- ${OV_PkgConfig_VISILITY}
+ ${OV_PkgConfig_VISIBILITY}
tbb)
if(tbb_FOUND)
# parse version
diff --git a/src/plugins/intel_npu/src/backend/CMakeLists.txt b/src/plugins/intel_npu/src/backend/CMakeLists.txt
index 5a1585c0a6..251479aa19 100644
--- a/src/plugins/intel_npu/src/backend/CMakeLists.txt
+++ b/src/plugins/intel_npu/src/backend/CMakeLists.txt
@@ -25,7 +25,7 @@ target_link_libraries(${TARGET_NAME}
PRIVATE
openvino::npu_al
openvino::npu_common
- ze_loader
+ LevelZero::LevelZero
)

#
diff --git a/src/plugins/intel_npu/src/compiler_adapter/CMakeLists.txt b/src/plugins/intel_npu/src/compiler_adapter/CMakeLists.txt
index 9f265b7f6d..830019f855 100644
--- a/src/plugins/intel_npu/src/compiler_adapter/CMakeLists.txt
+++ b/src/plugins/intel_npu/src/compiler_adapter/CMakeLists.txt
@@ -25,7 +25,7 @@ target_link_libraries(${TARGET_NAME}
PRIVATE
openvino::npu_al
openvino::npu_common
- ze_loader
+ LevelZero::LevelZero
)

#
diff --git a/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt b/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt
index f1e81267dc..8eb9cb31db 100644
--- a/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt
+++ b/src/plugins/intel_npu/src/utils/src/zero/CMakeLists.txt
@@ -21,10 +21,7 @@ target_include_directories(${TARGET_NAME}
$<TARGET_PROPERTY:LevelZero::NPUExt,INTERFACE_INCLUDE_DIRECTORIES>
$<BUILD_INTERFACE:${NPU_UTILS_SOURCE_DIR}/include>)

-
-target_link_libraries(
- ${TARGET_NAME}
- PUBLIC openvino::runtime openvino::runtime::dev)
+target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime::dev)

#
# targets install
@@ -35,17 +32,19 @@ ov_developer_package_export_targets(TARGET openvino::npu_zero_utils
INSTALL_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${NPU_UTILS_SOURCE_DIR}/include>)

+ov_developer_package_export_targets(TARGET level-zero-ext)
+ov_install_static_lib(level-zero-ext ${NPU_PLUGIN_COMPONENT})
+
if(TARGET ze_loader)
ov_developer_package_export_targets(TARGET ze_loader)
- ov_developer_package_export_targets(TARGET utils)
- ov_developer_package_export_targets(TARGET level-zero-ext)
-
ov_install_static_lib(ze_loader ${NPU_PLUGIN_COMPONENT})
+
+ # TODO: remove once https://github.com/oneapi-src/level-zero/pull/243 is merged
+ ov_developer_package_export_targets(TARGET utils)
ov_install_static_lib(utils ${NPU_PLUGIN_COMPONENT})
- ov_install_static_lib(level-zero-ext ${NPU_PLUGIN_COMPONENT})

# Support tests to run with ze_loader
install(TARGETS ze_loader
- RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
- LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
+ RUNTIME DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL
+ LIBRARY DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
endif()
diff --git a/thirdparty/dependencies.cmake b/thirdparty/dependencies.cmake
index c22b06bcf5..83f7e209bc 100644
--- a/thirdparty/dependencies.cmake
+++ b/thirdparty/dependencies.cmake
@@ -18,7 +18,7 @@ find_package(PkgConfig QUIET)
# cmake older than 3.18 cannot create an alias for imported non-GLOBAL targets
# so, we have to use 'IMPORTED_GLOBAL' property
if(CMAKE_VERSION VERSION_LESS 3.18)
- set(OV_PkgConfig_VISILITY GLOBAL)
+ set(OV_PkgConfig_VISIBILITY GLOBAL)
endif()

if(SUGGEST_OVERRIDE_SUPPORTED)
@@ -69,9 +69,21 @@ endif()
#

if(ENABLE_INTEL_NPU)
- add_subdirectory(thirdparty/level_zero EXCLUDE_FROM_ALL)
+ if(ENABLE_SYSTEM_LEVEL_ZERO)
+ pkg_search_module(level_zero QUIET
+ IMPORTED_TARGET
+ ${OV_PkgConfig_VISIBILITY}
+ level-zero)
+ if(level_zero_FOUND)
+ add_library(LevelZero::LevelZero ALIAS PkgConfig::level_zero)
+ message(STATUS "${PKG_CONFIG_EXECUTABLE}: level_zero (${level_zero_VERSION}) is found at ${level_zero_PREFIX}")
+ endif()
+ endif()

- add_library(LevelZero::LevelZero ALIAS ze_loader)
+ if(NOT libze_loader_FOUND)
+ add_subdirectory(thirdparty/level_zero EXCLUDE_FROM_ALL)
+ add_library(LevelZero::LevelZero ALIAS ze_loader)
+ endif()
endif()

#
@@ -190,7 +202,7 @@ if(ENABLE_SYSTEM_PUGIXML)
# Ubuntu 18.04 case when cmake interface is not available
pkg_search_module(pugixml QUIET
IMPORTED_TARGET
- ${OV_PkgConfig_VISILITY}
+ ${OV_PkgConfig_VISIBILITY}
pugixml)
if(pugixml_FOUND)
set(pugixml_target PkgConfig::pugixml)
@@ -249,7 +261,7 @@ if(ENABLE_SYSTEM_PUGIXML)
message(FATAL_ERROR "Debian | RPM package build requires shared Pugixml library")
endif()

- if(OV_PkgConfig_VISILITY)
+ if(OV_PkgConfig_VISIBILITY)
# need to set GLOBAL visibility in order to create ALIAS for this target
set_target_properties(${pugixml_target} PROPERTIES IMPORTED_GLOBAL ON)
endif()
@@ -299,7 +311,7 @@ if(ENABLE_TESTS)

if(GTest_FOUND)
foreach(gtest_target gtest gtest_main gmock gmock_main)
- if(OV_PkgConfig_VISILITY)
+ if(OV_PkgConfig_VISIBILITY)
# need to set GLOBAL visibility in order to create ALIAS for this target
set_target_properties(GTest::${gtest_target} PROPERTIES IMPORTED_GLOBAL ON)
endif()
@@ -448,7 +460,7 @@ if(ENABLE_SNAPPY_COMPRESSION)
set(ov_snappy_lib Snappy::snappy-static)
endif()

- if(OV_PkgConfig_VISILITY)
+ if(OV_PkgConfig_VISIBILITY)
# need to set GLOBAL visibility in order to create ALIAS for this target
set_target_properties(${ov_snappy_lib} PROPERTIES IMPORTED_GLOBAL ON)
endif()
Loading

0 comments on commit d807dde

Please sign in to comment.