Skip to content

Commit

Permalink
[openvino] fixed build with standalone crashpad and onednn (#32773)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Aug 8, 2023
1 parent 90e7eab commit 2ad5618
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 37 deletions.
41 changes: 41 additions & 0 deletions ports/openvino/004-onednn-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/src/cmake/ie_parallel.cmake b/src/cmake/ie_parallel.cmake
index e8aa1c30ef..259e4152c2 100644
--- a/src/cmake/ie_parallel.cmake
+++ b/src/cmake/ie_parallel.cmake
@@ -282,7 +282,7 @@ function(set_ie_threading_interface_for TARGET_NAME)
foreach(include_directory IN LISTS include_directories)
# cannot include /usr/include headers as SYSTEM
if(NOT "${include_directory}" MATCHES "^/usr.*$")
- target_include_directories(${TARGET_NAME} SYSTEM BEFORE
+ target_include_directories(${TARGET_NAME} SYSTEM
${LINK_TYPE} $<BUILD_INTERFACE:${include_directory}>)
else()
set(_system_library ON)
diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt
index e1f04b4ad2..d1150fdab0 100644
--- a/src/plugins/intel_cpu/CMakeLists.txt
+++ b/src/plugins/intel_cpu/CMakeLists.txt
@@ -83,18 +83,19 @@ elseif(RISCV64)
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "openvino_riscv_cpu_plugin")
endif()

-set_ie_threading_interface_for(${TARGET_NAME})
-
ie_mark_target_as_cc(${TARGET_NAME})

target_link_libraries(${TARGET_NAME} PRIVATE dnnl
ov_shape_inference
- openvino::pugixml
inference_engine_snippets)

+target_include_directories(${TARGET_NAME} SYSTEM PRIVATE $<TARGET_PROPERTY:dnnl,INCLUDE_DIRECTORIES>)
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_EXTENSION_API)
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
-target_include_directories(${TARGET_NAME} SYSTEM PRIVATE $<TARGET_PROPERTY:dnnl,INCLUDE_DIRECTORIES>)
+
+# system libraries must go last
+target_link_libraries(${TARGET_NAME} PRIVATE openvino::pugixml)
+set_ie_threading_interface_for(${TARGET_NAME})

# Cross compiled function
# TODO: The same for proposal, proposalONNX, topk
13 changes: 13 additions & 0 deletions ports/openvino/005-rename-utils.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/common/util/CMakeLists.txt b/src/common/util/CMakeLists.txt
index 4b538aab7c..1cae344ed6 100644
--- a/src/common/util/CMakeLists.txt
+++ b/src/common/util/CMakeLists.txt
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#

-set(TARGET_NAME util)
+set(TARGET_NAME openvino_util)

file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
85 changes: 85 additions & 0 deletions ports/openvino/006-onednn-gpu-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
diff --git a/cmake/OpenCL.cmake b/cmake/OpenCL.cmake
index df86d3434..cf4274b47 100644
--- a/cmake/OpenCL.cmake
+++ b/cmake/OpenCL.cmake
@@ -42,5 +42,5 @@ endif()
add_definitions(-DCL_TARGET_OPENCL_VERSION=120)

set(DNNL_GPU_RUNTIME_CURRENT ${DNNL_GPU_RUNTIME})
-include_directories(${OpenCL_INCLUDE_DIRS})
+# include_directories(${OpenCL_INCLUDE_DIRS})
list(APPEND EXTRA_SHARED_LIBS OpenCL::OpenCL)
diff --git a/cmake/TBB.cmake b/cmake/TBB.cmake
index d6bbe3e80..a62a25117 100644
--- a/cmake/TBB.cmake
+++ b/cmake/TBB.cmake
@@ -26,7 +26,7 @@ include("cmake/Threading.cmake")
macro(handle_tbb_target)
if(TBB_FOUND)
set_property(TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "DEBUG")
- include_directories_with_host_compiler(${_tbb_include_dirs})
+ # include_directories_with_host_compiler(${_tbb_include_dirs})
list(APPEND EXTRA_SHARED_LIBS ${TBB_IMPORTED_TARGETS})

# Print TBB location
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index e38723312..f19c63f3d 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -50,5 +50,7 @@ endif()

set(OBJ_LIB ${DNNL_LIBRARY_NAME}_common)
add_library(${OBJ_LIB} OBJECT ${SOURCES})
+target_include_directories(${OBJ_LIB} PRIVATE
+ $<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>)
set_property(GLOBAL APPEND PROPERTY DNNL_LIB_DEPS
$<TARGET_OBJECTS:${OBJ_LIB}>)
diff --git a/src/gpu/CMakeLists.txt b/src/gpu/CMakeLists.txt
index e31655ec4..867dcac6f 100644
--- a/src/gpu/CMakeLists.txt
+++ b/src/gpu/CMakeLists.txt
@@ -27,6 +27,8 @@ add_definitions_with_host_compiler(-DNGEN_WINDOWS_COMPAT)

set(OBJ_LIB ${DNNL_LIBRARY_NAME}_gpu)
add_library(${OBJ_LIB} OBJECT ${SOURCES})
+target_include_directories(${OBJ_LIB} PRIVATE
+ $<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>)
set_property(GLOBAL APPEND PROPERTY DNNL_LIB_DEPS
$<TARGET_OBJECTS:${OBJ_LIB}>)

diff --git a/src/gpu/compute/CMakeLists.txt b/src/gpu/compute/CMakeLists.txt
index 3f08abbe1..51c59f026 100644
--- a/src/gpu/compute/CMakeLists.txt
+++ b/src/gpu/compute/CMakeLists.txt
@@ -23,5 +23,7 @@ file(GLOB_RECURSE SOURCES

set(OBJ_LIB ${DNNL_LIBRARY_NAME}_gpu_compute)
add_library(${OBJ_LIB} OBJECT ${SOURCES})
+target_include_directories(${OBJ_LIB} PRIVATE
+ $<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>)
set_property(GLOBAL APPEND PROPERTY DNNL_LIB_DEPS
$<TARGET_OBJECTS:${OBJ_LIB}>)
diff --git a/src/gpu/jit/CMakeLists.txt b/src/gpu/jit/CMakeLists.txt
index 178d325ed..a84b54b02 100644
--- a/src/gpu/jit/CMakeLists.txt
+++ b/src/gpu/jit/CMakeLists.txt
@@ -32,5 +32,7 @@ endif()

set(OBJ_LIB ${DNNL_LIBRARY_NAME}_gpu_jit)
add_library(${OBJ_LIB} OBJECT ${SOURCES})
+target_include_directories(${OBJ_LIB} PRIVATE
+ $<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>)
set_property(GLOBAL APPEND PROPERTY DNNL_LIB_DEPS
$<TARGET_OBJECTS:${OBJ_LIB}>)
diff --git a/src/gpu/ocl/CMakeLists.txt b/src/gpu/ocl/CMakeLists.txt
index 2ccb8d1f5..ab6310e39 100644
--- a/src/gpu/ocl/CMakeLists.txt
+++ b/src/gpu/ocl/CMakeLists.txt
@@ -39,5 +39,7 @@ list(APPEND SOURCES ${kernel_list_src})

set(OBJ_LIB ${DNNL_LIBRARY_NAME}_gpu_ocl)
add_library(${OBJ_LIB} OBJECT ${SOURCES})
+target_include_directories(${OBJ_LIB} PRIVATE
+ $<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>)
set_property(GLOBAL APPEND PROPERTY DNNL_LIB_DEPS
$<TARGET_OBJECTS:${OBJ_LIB}>)
53 changes: 24 additions & 29 deletions ports/openvino/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@ vcpkg_from_github(
001-disable-tools.patch
002-typo-in-default-option-value.patch
003-fix-find-onnx.patch
004-onednn-build.patch
005-rename-utils.patch
HEAD_REF master)

function(ov_checkout_in_path PATH REPO REF SHA512)
vcpkg_from_github(
OUT_SOURCE_PATH DEP_SOURCE_PATH
REPO ${REPO}
REF ${REF}
SHA512 ${SHA512}
)

file(COPY "${DEP_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/${PATH}")
endfunction()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
cpu ENABLE_INTEL_CPU
Expand All @@ -45,12 +36,14 @@ if(ENABLE_INTEL_GPU)
"Please, consider using VCPKG_LIBRARY_LINKAGE=\"dynamic\".")
list(APPEND FEATURE_OPTIONS "-DENABLE_ONEDNN_FOR_GPU=OFF")
else()
ov_checkout_in_path(
src/plugins/intel_gpu/thirdparty/onednn_gpu
oneapi-src/oneDNN
f27dedbfc093f51032a4580198bb80579440dc15
882eb42e31490df1b35b5e55bef1be8452b710b7a16f5ad648961510abd288e16dbd783e0163aab9dd161fd3a9bd836b0f4afc82b14043d80d1dad9c3400af1b
)
vcpkg_from_github(
OUT_SOURCE_PATH DEP_SOURCE_PATH
REPO oneapi-src/oneDNN
REF f27dedbfc093f51032a4580198bb80579440dc15
SHA512 882eb42e31490df1b35b5e55bef1be8452b710b7a16f5ad648961510abd288e16dbd783e0163aab9dd161fd3a9bd836b0f4afc82b14043d80d1dad9c3400af1b
PATCHES 006-onednn-gpu-build.patch
)
file(COPY "${DEP_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/src/plugins/intel_gpu/thirdparty/onednn_gpu")
endif()

list(APPEND FEATURE_OPTIONS
Expand All @@ -59,12 +52,13 @@ if(ENABLE_INTEL_GPU)
endif()

if(ENABLE_INTEL_CPU)
ov_checkout_in_path(
src/plugins/intel_cpu/thirdparty/onednn
openvinotoolkit/oneDNN
48bf41e04ba8cdccb1e7ad166fecfb329f5f84a1
8a5ef1ce07545bc28328d1cfd49a8ee8f2ff13c2e393623cb842982b83963881f3d096230805d2a187100c68a2ca30c99add5a975f3f623d9f4a51517c2d585f
)
vcpkg_from_github(
OUT_SOURCE_PATH DEP_SOURCE_PATH
REPO openvinotoolkit/oneDNN
REF 48bf41e04ba8cdccb1e7ad166fecfb329f5f84a1
SHA512 8a5ef1ce07545bc28328d1cfd49a8ee8f2ff13c2e393623cb842982b83963881f3d096230805d2a187100c68a2ca30c99add5a975f3f623d9f4a51517c2d585f
)
file(COPY "${DEP_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/src/plugins/intel_cpu/thirdparty/onednn")

if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
# scons (python tool) is required for ARM Compute Library building
Expand All @@ -77,12 +71,13 @@ if(ENABLE_INTEL_CPU)
OUT_PYTHON_VAR OV_PYTHON_WITH_SCONS
)

ov_checkout_in_path(
src/plugins/intel_cpu/thirdparty/ComputeLibrary
ARM-software/ComputeLibrary
v23.02.1
ee9439e0804bacd365f079cedc548ffe2c12b0d4a86780e0783186884eb5a6d7aa7ceac11c504e242bedc55c3d026b826c90adaafbdbd3e5cfa2562a1c4ee04d
)
vcpkg_from_github(
OUT_SOURCE_PATH DEP_SOURCE_PATH
REPO ARM-software/ComputeLibrary
REF v23.02.1
SHA512 ee9439e0804bacd365f079cedc548ffe2c12b0d4a86780e0783186884eb5a6d7aa7ceac11c504e242bedc55c3d026b826c90adaafbdbd3e5cfa2562a1c4ee04d
)
file(COPY "${DEP_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/src/plugins/intel_cpu/thirdparty/ComputeLibrary")
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion ports/openvino/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "openvino",
"version-date": "2023-06-11",
"port-version": 3,
"port-version": 4,
"maintainers": "OpenVINO Developers <openvino@intel.com>",
"summary": "This is a port for Open Visual Inference And Optimization toolkit for AI inference",
"description": [
Expand Down
6 changes: 0 additions & 6 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -969,12 +969,6 @@ openturns:x64-osx=fail
# openvdb\openvdb\libopenvdb.lib : fatal error LNK1248: image size (109A36020) exceeds maximum allowable size (FFFFFFFF)
openvdb:x64-windows-static=fail
openvdb:x64-windows-static-md=fail
# openvino conflicts with oneDNN, see https://github.com/microsoft/vcpkg/pull/32418#issuecomment-1634989305
openvino:x64-linux=skip
openvino:x64-osx=skip
openvino:x64-windows=skip
openvino:x64-windows-static=skip
openvino:x64-windows-static-md=skip
openvpn3:x64-osx=fail
openvpn3:arm64-osx=fail
openvr:x64-windows-static=fail
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6122,7 +6122,7 @@
},
"openvino": {
"baseline": "2023-06-11",
"port-version": 3
"port-version": 4
},
"openvpn3": {
"baseline": "3.7.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/openvino.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a27f3d63ace7db21e84b4e42eef2ab776a6dcb69",
"version-date": "2023-06-11",
"port-version": 4
},
{
"git-tree": "be798c823b9abdb477acbbe2541368067263f268",
"version-date": "2023-06-11",
Expand Down

0 comments on commit 2ad5618

Please sign in to comment.