From 74272ed05efda1218059c85c99a3a6283bcf02d5 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Thu, 9 Mar 2023 15:25:23 +0400 Subject: [PATCH] Port to 2022.3 (#16174) * Remove setuptools upperbound (#16054) * Added missed licenses to openvino-dev (#16057) * Fixed OpenMP + debian package code-path (#16058) * [CPU] Prevent out of bounds read inside Graph::InferDynamic (#16067) * Fixed compilation on Debian 11 with gcc 12.2 (#16096) * Fix for OpenCL --------- Co-authored-by: Przemyslaw Wysocki Co-authored-by: Maksim Kutakov --- cmake/packaging/debian.cmake | 2 + cmake/packaging/rpm.cmake | 2 + .../python/wheel/requirements-dev.txt | 2 +- src/plugins/intel_cpu/src/graph.cpp | 6 ++- .../intel_cpu/thirdparty/CMakeLists.txt | 45 ++++++++++--------- .../intel_gpu/src/runtime/ocl/ocl_ext.hpp | 6 ++- .../intel_gpu/thirdparty/CMakeLists.txt | 17 ++++--- thirdparty/CMakeLists.txt | 7 +++ thirdparty/ocl/CMakeLists.txt | 3 +- tools/openvino_dev/CMakeLists.txt | 4 ++ tools/openvino_dev/setup.cfg | 2 - tools/openvino_dev/setup.py | 2 +- 12 files changed, 61 insertions(+), 37 deletions(-) diff --git a/cmake/packaging/debian.cmake b/cmake/packaging/debian.cmake index 1d9b9d25e9d..76e9d72022a 100644 --- a/cmake/packaging/debian.cmake +++ b/cmake/packaging/debian.cmake @@ -54,6 +54,8 @@ macro(ov_cpack_settings) NOT item STREQUAL "gna" AND # myriad is EOL in 2023.0 NOT item STREQUAL "myriad" AND + # don't install Intel OpenMP during debian + NOT item STREQUAL "omp" AND # even for case of system TBB we have installation rules for wheels packages # so, need to skip this explicitly NOT item MATCHES "^tbb(_dev)?$" AND diff --git a/cmake/packaging/rpm.cmake b/cmake/packaging/rpm.cmake index 3fbffaa76eb..3646a288f75 100644 --- a/cmake/packaging/rpm.cmake +++ b/cmake/packaging/rpm.cmake @@ -40,6 +40,8 @@ macro(ov_cpack_settings) NOT item STREQUAL "gna" AND # myriad is EOL in 2023.0 NOT item STREQUAL "myriad" AND + # don't install Intel OpenMP during rpm + NOT item STREQUAL "omp" AND # even for case of system TBB we have installation rules for wheels packages # so, need to skip this explicitly NOT item MATCHES "^tbb(_dev)?$" AND diff --git a/src/bindings/python/wheel/requirements-dev.txt b/src/bindings/python/wheel/requirements-dev.txt index 2fcb597b909..13aecd85a63 100644 --- a/src/bindings/python/wheel/requirements-dev.txt +++ b/src/bindings/python/wheel/requirements-dev.txt @@ -1,3 +1,3 @@ -setuptools>=65.6.1,<=65.7.0 +setuptools>=65.6.1 wheel>=0.38.1 patchelf; sys_platform == 'linux' and platform_machine == 'x86_64' diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp index 7b01f401505..8cb6ee71df5 100644 --- a/src/plugins/intel_cpu/src/graph.cpp +++ b/src/plugins/intel_cpu/src/graph.cpp @@ -1109,11 +1109,12 @@ void Graph::InferDynamic(InferRequestBase* request) { std::function updateDynParams; updateShapes = [&](size_t node_indx, size_t stop_indx) { - const auto& node = executableGraphNodes[node_indx]; prepareCounter.store(node_indx); if (node_indx >= stop_indx) { return; } + + const auto& node = executableGraphNodes[node_indx]; if (node->isDynamicNode()) { node->updateShapes(); } @@ -1124,11 +1125,12 @@ void Graph::InferDynamic(InferRequestBase* request) { }; updateDynParams = [&](size_t node_indx, size_t stop_indx) { - const auto& node = executableGraphNodes[node_indx]; if (node_indx >= stop_indx) { prepareCounter.store(node_indx); return; } + + const auto& node = executableGraphNodes[node_indx]; if (node->isDynamicNode()) { node->updateDynamicParams(); } diff --git a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt index 61b9d11de0e..8fb38dc5d16 100644 --- a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt @@ -44,26 +44,6 @@ function(ie_add_onednn) set(OpenMP_cmake_included ON) ## to skip "omp simd" inside a code. Lead to some crashes inside NDK LLVM.. endif() - if(SUGGEST_OVERRIDE_SUPPORTED) - # xbyak compilation fails - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override") - endif() - if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") - set(DNNL_TARGET_ARCH "X64") - elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") - set(DNNL_TARGET_ARCH "AARCH64") - endif() - if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) - ie_add_compiler_flags(-Wno-undef) - ie_add_compiler_flags(-Wno-missing-declarations) - if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_COMPILER_IS_GNUCXX) - ie_add_compiler_flags(-Wno-error=array-bounds) - ie_add_compiler_flags(-Wno-error=stringop-overflow=) - endif() - elseif(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable=10121") - endif() - # WA for old TBBConfig.cmake like tbb2019_20180718oss # they don't check that imported target is already created if(TBB_FOUND) @@ -75,7 +55,25 @@ function(ie_add_onednn) link_libraries(TBB::tbb) endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") + set(DNNL_TARGET_ARCH "X64") + elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") + set(DNNL_TARGET_ARCH "AARCH64") + endif() + + if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) + ie_add_compiler_flags(-Wno-undef) + ie_add_compiler_flags(-Wno-missing-declarations) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11 AND CMAKE_COMPILER_IS_GNUCXX) + ie_add_compiler_flags(-Wno-array-bounds) + ie_add_compiler_flags(-Wno-stringop-overflow) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + ie_add_compiler_flags(-Wno-restrict) + endif() + endif() + elseif(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable=10121") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # C4849 OpenMP 'reduction' clause ignored in 'simd' directive ie_add_compiler_flags(/wd4849) # C4661 no suitable definition provided for explicit template instantiation request @@ -86,6 +84,11 @@ function(ie_add_onednn) # C4334 '<<': result of 32-bit shift implicitly converted to 64 bits ie_add_compiler_flags(/wd4334) endif() + if(SUGGEST_OVERRIDE_SUPPORTED) + # xbyak compilation fails + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override") + endif() + add_subdirectory(onednn EXCLUDE_FROM_ALL) ov_install_static_lib(dnnl cpu) endfunction() diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp index f4c9e20844a..b08e55e0a17 100644 --- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp +++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp @@ -213,7 +213,9 @@ clEnqueueMemFillINTEL_fn)( #endif // cl_khr_device_uuid -#ifndef OV_GPU_USE_OPENCL_HPP +// some versions of CL/opencl.hpp don't define C++ wrapper for CL_DEVICE_UUID_KHR +// we are checking it in cmake and defined macro OV_GPU_OPENCL_HPP_HAS_UUID if it is defined +#ifndef OV_GPU_OPENCL_HPP_HAS_UUID // for C++ wrappers using uuid_array = std::array; @@ -224,7 +226,7 @@ CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_UUID_KHR, uuid_array) } // namespace detail } // namespace cl -#endif // OV_GPU_USE_OPENCL_HPP +#endif // OV_GPU_OPENCL_HPP_HAS_UUID /*************************************************************** * cl_intel_device_attribute_query diff --git a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt index fb699d7ed79..5196e2c22f0 100644 --- a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt @@ -22,13 +22,16 @@ if(ENABLE_ONEDNN_FOR_GPU) set(ONEDNN_PREFIX_DIR "${CMAKE_CURRENT_BINARY_DIR}/onednn_gpu_root") set(ONEDNN_ENABLED_PRIMITIVES "CONCAT;CONVOLUTION;DECONVOLUTION;INNER_PRODUCT;MATMUL;REORDER;POOLING;REDUCTION") set(ONEDNN_ENABLED_ISA "XEHP;XEHPG;XEHPC") - if(CMAKE_COMPILER_IS_GNUCXX) - ie_add_compiler_flags(-Wno-undef -Wno-missing-declarations) - if(SUGGEST_OVERRIDE_SUPPORTED) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override") - endif() - if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) - ie_add_compiler_flags(-Wno-error=array-bounds -Wno-error=stringop-overflow= -Wno-error=unused-result) + + if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) + ie_add_compiler_flags(-Wno-undef) + ie_add_compiler_flags(-Wno-missing-declarations) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11 AND CMAKE_COMPILER_IS_GNUCXX) + ie_add_compiler_flags(-Wno-array-bounds) + ie_add_compiler_flags(-Wno-stringop-overflow) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + ie_add_compiler_flags(-Wno-restrict) + endif() endif() endif() ExternalProject_Add(onednn_gpu_build diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 7a6aff3dcd3..24a1099752b 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -69,6 +69,13 @@ if(ENABLE_INTEL_GPU) if(OpenCL_HPP) set_target_properties(OpenCL::OpenCL PROPERTIES INTERFACE_COMPILE_DEFINITIONS OV_GPU_USE_OPENCL_HPP) + + # check whether CL/opencl.hpp contains C++ wrapper for property CL_DEVICE_UUID_KHR + file(STRINGS "${OpenCL_HPP}" CL_DEVICE_UUID_KHR_CPP REGEX ".*CL_DEVICE_UUID_KHR.*") + if(CL_DEVICE_UUID_KHR_CPP) + set_target_properties(OpenCL::OpenCL PROPERTIES + INTERFACE_COMPILE_DEFINITIONS OV_GPU_OPENCL_HPP_HAS_UUID) + endif() endif() # set variables for onednn_gpu diff --git a/thirdparty/ocl/CMakeLists.txt b/thirdparty/ocl/CMakeLists.txt index 72e14c8762b..6f5de39eabb 100644 --- a/thirdparty/ocl/CMakeLists.txt +++ b/thirdparty/ocl/CMakeLists.txt @@ -46,7 +46,8 @@ add_subdirectory(icd_loader EXCLUDE_FROM_ALL) add_library(OpenCL::OpenCL ALIAS OpenCL) # use CL/opencl.hpp -target_compile_definitions(OpenCL INTERFACE OV_GPU_USE_OPENCL_HPP) +target_compile_definitions(OpenCL INTERFACE OV_GPU_USE_OPENCL_HPP + OV_GPU_OPENCL_HPP_HAS_UUID) target_include_directories(OpenCL INTERFACE $ $) diff --git a/tools/openvino_dev/CMakeLists.txt b/tools/openvino_dev/CMakeLists.txt index a3d03d82267..415545b4212 100644 --- a/tools/openvino_dev/CMakeLists.txt +++ b/tools/openvino_dev/CMakeLists.txt @@ -67,6 +67,10 @@ set(openvino_wheels_output_dir "${CMAKE_BINARY_DIR}/wheels") set(openvino_wheel_path "${openvino_wheels_output_dir}/${openvino_wheel_name}") add_custom_command(OUTPUT ${openvino_wheel_path} + COMMAND ${CMAKE_COMMAND} -E copy "${OpenVINO_SOURCE_DIR}/thirdparty/open_model_zoo/licensing/omz-third-party-programs.txt" "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy "${OpenVINO_SOURCE_DIR}/licensing/dev-third-party-programs.txt" "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy "${OpenVINO_SOURCE_DIR}/LICENSE" "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/readme.txt" "${CMAKE_CURRENT_BINARY_DIR}" COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/setup.cfg" "${CMAKE_CURRENT_BINARY_DIR}" COMMAND ${CMAKE_COMMAND} -E env OPENVINO_VERSION=${WHEEL_VERSION} ${PYTHON_EXECUTABLE} ${SETUP_PY} bdist_wheel diff --git a/tools/openvino_dev/setup.cfg b/tools/openvino_dev/setup.cfg index c8f76d388cb..37ea36cc439 100644 --- a/tools/openvino_dev/setup.cfg +++ b/tools/openvino_dev/setup.cfg @@ -18,5 +18,3 @@ license_files = *LICENSE* *license* *third-party-programs* - ../../licensing/dev-third-party-programs.txt - ../../LICENSE diff --git a/tools/openvino_dev/setup.py b/tools/openvino_dev/setup.py index c5adb28bfe4..e6f84abd86f 100644 --- a/tools/openvino_dev/setup.py +++ b/tools/openvino_dev/setup.py @@ -152,7 +152,7 @@ class CustomBuild(build): unique_req = list(set(map(lambda x: x.lower(), req))) self.distribution.extras_require[extra] = unique_req - # add dependecy on runtime package + # add dependency on runtime package runtime_req = [f'openvino=={self.distribution.get_version()}'] self.distribution.install_requires.extend(runtime_req)