[onnx] Update onnx to 1.16.2 and fix downstream (#40067)

Co-authored-by: Monica <v-liumonica@microsoft.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
MonicaLiu 2024-10-18 04:24:02 +00:00 committed by GitHub
parent b2a47d316d
commit 88a0bf87b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 125 additions and 120 deletions

View File

@ -40,7 +40,7 @@ index feebad7..ad407e1 100644
if(ANDROID)
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index c3abce5..cfaf83e 100644
index c3abce5..63f665f 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -285,7 +285,7 @@ endif()
@ -113,18 +113,36 @@ index c3abce5..cfaf83e 100644
endif()
list(APPEND Caffe2_DEPENDENCY_LIBS fp16)
@@ -1244,8 +1247,8 @@ endif(USE_LLVM)
@@ -1127,7 +1130,7 @@ if(BUILD_PYTHON)
# Observers are required in the python build
caffe2_update_option(USE_OBSERVERS ON)
else()
- message(WARNING "Python dependencies not met. Not compiling with python. Suppress this warning with -DBUILD_PYTHON=OFF")
+ message(FATAL_ERROR "Python dependencies not met. Not compiling with python. Suppress this warning with -DBUILD_PYTHON=OFF")
caffe2_update_option(BUILD_PYTHON OFF)
endif()
endif()
@@ -1231,7 +1234,7 @@ endif()
# ---[ LLVM
if(USE_LLVM)
message(STATUS "Looking for LLVM in ${USE_LLVM}")
- find_package(LLVM PATHS ${USE_LLVM} NO_DEFAULT_PATH)
+ find_package(LLVM)
if(LLVM_FOUND)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
@@ -1244,8 +1247,10 @@ endif(USE_LLVM)
# ---[ cuDNN
if(USE_CUDNN)
- set(CUDNN_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/cudnn_frontend/include)
- target_include_directories(torch::cudnn INTERFACE ${CUDNN_FRONTEND_INCLUDE_DIR})
+ find_package(CUDNN REQUIRED)
set(CUDNN_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/cudnn_frontend/include)
target_include_directories(torch::cudnn INTERFACE ${CUDNN_FRONTEND_INCLUDE_DIR})
+ target_include_directories(torch::cudnn INTERFACE "${CUDNN_INCLUDE_DIR}")
endif()
# ---[ HIP
@@ -1555,7 +1558,10 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
@@ -1555,7 +1560,10 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
set_target_properties(onnx_proto PROPERTIES CXX_STANDARD 17)
endif()
endif()
@ -136,27 +154,28 @@ index c3abce5..cfaf83e 100644
add_definitions(-DONNX_NAMESPACE=${ONNX_NAMESPACE})
if(NOT USE_SYSTEM_ONNX)
@@ -1573,14 +1579,14 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
@@ -1573,23 +1581,13 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
target_compile_options(onnx PRIVATE -Wno-deprecated-declarations)
endif()
else()
- add_library(onnx SHARED IMPORTED)
- find_library(ONNX_LIBRARY onnx)
+ add_library(onnx UNKNOWN IMPORTED)
+ find_library(ONNX_LIBRARY NAMES onnx REQUIRED)
if(NOT ONNX_LIBRARY)
message(FATAL_ERROR "Cannot find onnx")
endif()
set_property(TARGET onnx PROPERTY IMPORTED_LOCATION ${ONNX_LIBRARY})
- if(NOT ONNX_LIBRARY)
- message(FATAL_ERROR "Cannot find onnx")
- endif()
- set_property(TARGET onnx PROPERTY IMPORTED_LOCATION ${ONNX_LIBRARY})
- add_library(onnx_proto SHARED IMPORTED)
- find_library(ONNX_PROTO_LIBRARY onnx_proto)
+ add_library(onnx_proto UNKNOWN IMPORTED)
+ find_library(ONNX_PROTO_LIBRARY NAMES onnx_proto REQUIRED)
if(NOT ONNX_PROTO_LIBRARY)
message(FATAL_ERROR "Cannot find onnx")
endif()
@@ -1589,7 +1595,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
- if(NOT ONNX_PROTO_LIBRARY)
- message(FATAL_ERROR "Cannot find onnx")
- endif()
- set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY})
- message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}")
- list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
+ find_package(ONNX CONFIG REQUIRED)
+ set(ONNX_LIBRARY ONNX::onnx)
+ set(ONNX_PROTO_LIBRARY ONNX::onnx_proto)
+ list(APPEND Caffe2_DEPENDENCY_LIBS ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY})
endif()
include_directories(${FOXI_INCLUDE_DIRS})
- list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader)
@ -164,7 +183,7 @@ index c3abce5..cfaf83e 100644
# Recover the build shared libs option.
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS})
endif()
@@ -1834,8 +1840,8 @@ endif()
@@ -1834,8 +1832,8 @@ endif()
#
set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
@ -175,7 +194,7 @@ index c3abce5..cfaf83e 100644
# Disable compiler feature checks for `fmt`.
#
# CMake compiles a little program to check compiler features. Some of our build
@@ -1843,7 +1849,6 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)
@@ -1843,7 +1841,6 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/fmt)
# CMAKE_CXX_FLAGS in ways that break feature checks. Since we already know
# `fmt` is compatible with a superset of the compilers that PyTorch is, it
# shouldn't be too bad to just disable the checks.

View File

@ -29,34 +29,6 @@ index ecbc7c1..2dd1001 100644
namespace c10 {
/// The primary ATen error class.
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index b46a444..255d7f4 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -1581,19 +1581,10 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
target_compile_options(onnx PRIVATE -Wno-deprecated-declarations)
endif()
else()
- add_library(onnx UNKNOWN IMPORTED)
- find_library(ONNX_LIBRARY NAMES onnx REQUIRED)
- if(NOT ONNX_LIBRARY)
- message(FATAL_ERROR "Cannot find onnx")
- endif()
- set_property(TARGET onnx PROPERTY IMPORTED_LOCATION ${ONNX_LIBRARY})
- add_library(onnx_proto UNKNOWN IMPORTED)
- find_library(ONNX_PROTO_LIBRARY NAMES onnx_proto REQUIRED)
- if(NOT ONNX_PROTO_LIBRARY)
- message(FATAL_ERROR "Cannot find onnx")
- endif()
- set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY})
- message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}")
+ find_package(ONNX REQUIRED)
+ set(ONNX_LIBRARY onnx)
+ set(ONNX_PROTO_LIBRARY onnx_proto)
+ message("-- Found onnx")
list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
endif()
include_directories(${FOXI_INCLUDE_DIRS})
diff --git a/pyproject.toml b/pyproject.toml
index eb764cb..c70f317 100644
--- a/pyproject.toml

View File

@ -164,37 +164,6 @@ index 74d0d55..cf349c2 100644
endif()
# ---[ Caffe2 HIP sources.
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index cfaf83e..b46a444 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -1130,7 +1130,7 @@ if(BUILD_PYTHON)
# Observers are required in the python build
caffe2_update_option(USE_OBSERVERS ON)
else()
- message(WARNING "Python dependencies not met. Not compiling with python. Suppress this warning with -DBUILD_PYTHON=OFF")
+ message(FATAL_ERROR "Python dependencies not met. Not compiling with python. Suppress this warning with -DBUILD_PYTHON=OFF")
caffe2_update_option(BUILD_PYTHON OFF)
endif()
endif()
@@ -1234,7 +1234,7 @@ endif()
# ---[ LLVM
if(USE_LLVM)
message(STATUS "Looking for LLVM in ${USE_LLVM}")
- find_package(LLVM PATHS ${USE_LLVM} NO_DEFAULT_PATH)
+ find_package(LLVM)
if(LLVM_FOUND)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
@@ -1248,6 +1248,8 @@ endif(USE_LLVM)
# ---[ cuDNN
if(USE_CUDNN)
find_package(CUDNN REQUIRED)
+ set(CUDNN_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/cudnn_frontend/include)
+ target_include_directories(torch::cudnn INTERFACE ${CUDNN_FRONTEND_INCLUDE_DIR})
target_include_directories(torch::cudnn INTERFACE "${CUDNN_INCLUDE_DIR}")
endif()
diff --git a/cmake/Modules/FindCUSPARSELT.cmake b/cmake/Modules/FindCUSPARSELT.cmake
index 8727f44..1e41281 100644
--- a/cmake/Modules/FindCUSPARSELT.cmake

View File

@ -1,7 +1,7 @@
{
"name": "libtorch",
"version": "2.1.2",
"port-version": 6,
"port-version": 7,
"description": "Tensors and Dynamic neural networks in Python with strong GPU acceleration",
"homepage": "https://pytorch.org/",
"license": null,

View File

@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0063385..64458ef 100644
index 0063385..f1522bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,15 @@ project(onnx_optimizer C CXX)
@ -33,6 +33,15 @@ index 0063385..64458ef 100644
file(READ "${PROJECT_SOURCE_DIR}/VERSION_NUMBER" ONNX_OPTIMIZER_VERSION)
string(STRIP "${ONNX_OPTIMIZER_VERSION}" ONNX_OPTIMIZER_VERSION)
@@ -41,7 +48,7 @@ file(GLOB onnx_opt_srcs "onnxoptimizer/*.cc"
list(REMOVE_ITEM onnx_opt_srcs "${PROJECT_SOURCE_DIR}/onnxoptimizer/cpp2py_export.cc")
onnxopt_add_library(onnx_optimizer ${onnx_opt_srcs})
-target_link_libraries(onnx_optimizer PUBLIC ${ONNX_TARGET_NAME})
+target_link_libraries(onnx_optimizer PUBLIC ONNX::onnx ONNX::onnx_proto)
target_include_directories(onnx_optimizer PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
@@ -70,7 +77,7 @@ if(BUILD_ONNX_PYTHON)
set(PY_EXT_SUFFIX ".so")
endif()
@ -73,3 +82,17 @@ index 6cca9f3..9d79f1a 100644
# Poor man's FetchContent
function(add_subdirectory_if_no_target dir target)
if (NOT TARGET ${target})
diff --git a/cmake/ONNXOptimizerConfig.cmake.in b/cmake/ONNXOptimizerConfig.cmake.in
index 72dcc88..c5639c8 100644
--- a/cmake/ONNXOptimizerConfig.cmake.in
+++ b/cmake/ONNXOptimizerConfig.cmake.in
@@ -3,6 +3,9 @@
# ONNX_OPTIMIZER_INCLUDE_DIRS - include directories for onnx optimizer
# as well as ONNX Optimizer targets for other cmake libraries to use.
+include(CMakeFindDependencyMacro)
+find_dependency(onnx CONFIG)
+
# library version information
set(ONNX_OPTIMIZER_VERSION "@ONNX_OPTIMIZER_VERSION@")

View File

@ -4,11 +4,10 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO onnx/optimizer
REF "v${VERSION}"
SHA512 419aeaac60fa27f54708c864a2f907777aaa4de882725c83cade33053dec546ede6f95f7f133b50991e3b9b17e300c1a108729cad00ac99dc5ba5d2982b09737
SHA512 552d6fa261c3ce2db2e0938a5b5261676335bce9bd828b46a1e2631f3b362c748ae9a6cfe7d62072fc3774b3f506bc54aa5827b52241e6f48d78a08dea1d9316
HEAD_REF master
PATCHES
fix-cmakelists.patch
remove-outdate-headers.patch
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME)

View File

@ -1,24 +0,0 @@
diff --git a/onnxoptimizer/optimize.h b/onnxoptimizer/optimize.h
index f25e6c3f..506e2554 100644
--- a/onnxoptimizer/optimize.h
+++ b/onnxoptimizer/optimize.h
@@ -9,7 +9,6 @@
#include "onnx/common/ir.h"
#include "onnx/common/ir_pb_converter.h"
-#include "onnx/common/stl_backports.h"
#include "onnx/proto_utils.h"
#include "onnxoptimizer/pass_manager.h"
diff --git a/onnxoptimizer/pass_registry.h b/onnxoptimizer/pass_registry.h
index 51a2c161..b8dc26f9 100644
--- a/onnxoptimizer/pass_registry.h
+++ b/onnxoptimizer/pass_registry.h
@@ -12,7 +12,6 @@
#include "onnx/common/ir.h"
#include "onnx/common/ir_pb_converter.h"
-#include "onnx/common/stl_backports.h"
#include "onnx/proto_utils.h"
#include "onnxoptimizer/passes/adjust_add.h"
#include "onnxoptimizer/passes/adjust_slice_and_matmul.h"

View File

@ -1,6 +1,6 @@
{
"name": "onnx-optimizer",
"version-semver": "0.3.18",
"version-semver": "0.3.19",
"description": "Actively maintained ONNX Optimizer",
"homepage": "https://github.com/onnx/optimizer",
"license": "Apache-2.0",

View File

@ -1,9 +1,9 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1295eab..0fb9f17 100644
index d81ac1d..9f97998 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -126,6 +126,7 @@ if(ONNX_BUILD_TESTS)
include(googletest)
@@ -149,6 +149,7 @@ if(ONNX_BUILD_TESTS)
set(googletest_STATIC_LIBRARIES GTest::gtest)
endif()
+find_package(protobuf CONFIG REQUIRED)

View File

@ -4,7 +4,7 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO onnx/onnx
REF "v${VERSION}"
SHA512 b46a4ab70af88053318eba45251c1f71528f15e45a33042877570e8d857febd3ec66e2e811fcda2105a4f17b84c9a1c6a0aaa22756c3287321b3ea29e83127fd
SHA512 7a9a8493b9c007429629484156487395044506f34e72253640e626351cb623b390750b36af78a290786131e3dcac35f4eb269e8693b594b7ce7cb105bcf9318d
PATCHES
fix-cmakelists.patch
fix-dependency-protobuf.patch

View File

@ -1,7 +1,6 @@
{
"name": "onnx",
"version-semver": "1.15.0",
"port-version": 1,
"version-semver": "1.16.2",
"description": "Open standard for machine learning interoperability",
"homepage": "https://onnx.ai",
"license": "Apache-2.0",

View File

@ -0,0 +1,26 @@
diff --git a/src/frontends/onnx/onnx_common/CMakeLists.txt b/src/frontends/onnx/onnx_common/CMakeLists.txt
index d63bce4..116a6e3 100644
--- a/src/frontends/onnx/onnx_common/CMakeLists.txt
+++ b/src/frontends/onnx/onnx_common/CMakeLists.txt
@@ -30,7 +30,7 @@ target_include_directories(${TARGET_NAME}
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime openvino::util)
-ov_link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx)
+ov_link_system_libraries(${TARGET_NAME} PUBLIC ONNX::onnx ONNX::onnx_proto)
ov_add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
diff --git a/thirdparty/dependencies.cmake b/thirdparty/dependencies.cmake
index 24c4940..8ea7d12 100644
--- a/thirdparty/dependencies.cmake
+++ b/thirdparty/dependencies.cmake
@@ -479,7 +479,7 @@ endif()
#
if(ENABLE_OV_ONNX_FRONTEND)
- find_package(ONNX 1.15.0 QUIET COMPONENTS onnx onnx_proto NO_MODULE)
+ find_package(ONNX CONFIG REQUIRED)
if(ONNX_FOUND)
# conan and vcpkg create imported targets 'onnx' and 'onnx_proto'

View File

@ -6,6 +6,7 @@ vcpkg_from_github(
PATCHES
# vcpkg specific patch, because OV creates a file in source tree, which is prohibited
001-disable-tools.patch
002-fix-onnx.patch
HEAD_REF master)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS

View File

@ -2,6 +2,7 @@
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "openvino",
"version": "2024.4.0",
"port-version": 1,
"maintainers": "OpenVINO Developers <openvino@intel.com>",
"summary": "This is a port for Open Visual Inference And Optimization toolkit for AI inference",
"description": [

View File

@ -5190,7 +5190,7 @@
},
"libtorch": {
"baseline": "2.1.2",
"port-version": 6
"port-version": 7
},
"libtorrent": {
"baseline": "2.0.10",
@ -6545,11 +6545,11 @@
"port-version": 1
},
"onnx": {
"baseline": "1.15.0",
"port-version": 1
"baseline": "1.16.2",
"port-version": 0
},
"onnx-optimizer": {
"baseline": "0.3.18",
"baseline": "0.3.19",
"port-version": 0
},
"onnxruntime-gpu": {
@ -6742,7 +6742,7 @@
},
"openvino": {
"baseline": "2024.4.0",
"port-version": 0
"port-version": 1
},
"openvpn3": {
"baseline": "3.10",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e738e2da09a82affc4bf4090d8c672579364231b",
"version": "2.1.2",
"port-version": 7
},
{
"git-tree": "12485495c895b105a0b0a35558edce15579a5a98",
"version": "2.1.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "126bfc519dc0c50fc52ed0b19a0bd88663bae87f",
"version-semver": "0.3.19",
"port-version": 0
},
{
"git-tree": "e574f424edd5d2fd9ca36c5058f96163d9018725",
"version-semver": "0.3.18",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "57d8f77c2964232239ba10b3f2ebf16698486d9a",
"version-semver": "1.16.2",
"port-version": 0
},
{
"git-tree": "69ad297b15bb801f74d50be6e5d290eab7573be4",
"version-semver": "1.15.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "668983aa79f507592885fa2ef91fb0dbd1e4a495",
"version": "2024.4.0",
"port-version": 1
},
{
"git-tree": "e65d1d305cc744e9ff5d96358695cbfe22deb8c3",
"version": "2024.4.0",