Skip to content

Commit

Permalink
(#23409) onnxruntime: add 1.17.3 & 1.18.1, remove older versions
Browse files Browse the repository at this point in the history
* onnxruntime: enable cuda provider

* onnxruntime: patch 1.16.1 build too

* onnxruntime: avoid gsl being patched when cuda is active

* onnxruntime: simplify patching

Replace the onnxruntime_external_deps.cmake and its FetchContent calls entirely with find_package() calls against Conan targets.

* onnxruntime: drop v1.16.0

* onnxruntime: fix build issues

* onnxruntime: add dummy targets to avoid accidental linking errors

* onnxruntime: silence a warning that gets converted to an error

* onnxruntime: fix wil includes not being found

* onnxruntime: bump deps

* onnxruntime: fix patches

* onnxruntime: relax Protobuf version check in CMake

* onnxruntime: bump deps

* onnxruntime: onnxruntime: add 1.17.1, remove older versions

* add version 1.17.3

* bump boost to 1.85.0

* use boost 1.83

* update comment on boost cpp 17 compat

* Add patch for missing include

* onnxruntime: add version 1.18.0

* fix abseil conflict

* add version 1.18.1, remove 1.18.0

* disable building with abeil DLL on Windows

* Avoid creating new revisions when new versions are added

* review: remove cuda

* bump to onnx 1.16.2

* bump wil

* remove variables that match the default

* empty commit

---------

Co-authored-by: Bart Verhagen <bart@kapernikov.com>
Co-authored-by: Martin Valgur <martin.valgur@gmail.com>
Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es>
Co-authored-by: czoido <mrgalleta@gmail.com>
  • Loading branch information
5 people committed Aug 21, 2024
1 parent ae4ceb7 commit 2b772b4
Show file tree
Hide file tree
Showing 11 changed files with 371 additions and 815 deletions.
112 changes: 112 additions & 0 deletions recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Replacement for https://github.com/microsoft/onnxruntime/blob/v1.16.1/cmake/external/onnxruntime_external_deps.cmake

if(NOT onnxruntime_DISABLE_ABSEIL)
find_package(absl REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES abseil::abseil)
include_directories(${absl_INCLUDE_DIRS})
endif()

find_package(re2 REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES re2::re2)

#flatbuffers 1.11.0 does not have flatbuffers::IsOutRange, therefore we require 1.12.0+
find_package(Flatbuffers REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES flatbuffers::flatbuffers)

find_package(Protobuf REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES protobuf::libprotobuf)
set(ONNX_CUSTOM_PROTOC_EXECUTABLE protoc)
set(PROTOC_EXECUTABLE protoc)

find_package(date REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES date::date)
include_directories(${date_INCLUDE_DIRS})
add_library(date_interface INTERFACE)

find_package(Boost REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES Boost::mp11)

find_package(nlohmann_json REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES nlohmann_json::nlohmann_json)

find_package(cpuinfo REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::cpuinfo)
if (TARGET cpuinfo::clog)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::clog)
endif()
set(CPUINFO_SUPPORTED ${cpuinfo_FOUND})
# Add a dummy targets for onnxruntime CMakelists.txt to depend on
add_library(clog INTERFACE)
add_library(cpuinfo INTERFACE)

if (NOT WIN32)
find_package(nsync REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp)
include_directories(${nsync_INCLUDE_DIRS})
add_library(nsync_cpp INTERFACE)
endif()

find_package(Microsoft.GSL 4.0 REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES Microsoft.GSL::GSL)
include_directories(${Microsoft.GSL_INCLUDE_DIRS})

find_package(safeint REQUIRED CONFIG)
include_directories(${safeint_INCLUDE_DIRS})
add_library(safeint_interface INTERFACE)

find_package(ONNX REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES onnx onnx_proto)

find_package(Eigen3 REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES Eigen3::Eigen)
set(eigen_INCLUDE_DIRS ${Eigen3_INCLUDE_DIRS})

if(WIN32)
find_package(wil REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES WIL::WIL)
include_directories(${wil_INCLUDE_DIRS})
endif()

# XNNPACK EP
if (onnxruntime_USE_XNNPACK)
if (onnxruntime_DISABLE_CONTRIB_OPS)
message(FATAL_ERROR "XNNPACK EP requires the internal NHWC contrib ops to be available "
"but onnxruntime_DISABLE_CONTRIB_OPS is ON")
endif()
find_package(xnnpack REQUIRED CONFIG)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES xnnpack::xnnpack)
add_library(XNNPACK INTERFACE)
endif()

if (onnxruntime_USE_MIMALLOC)
find_package(mimalloc REQUIRED CONFIG)
add_definitions(-DUSE_MIMALLOC)
endif()

# The source code of onnx_proto is generated, we must build this lib first before starting to compile the other source code that uses ONNX protobuf types.
# The other libs do not have the problem. All the sources are already there. We can compile them in any order.
set(onnxruntime_EXTERNAL_DEPENDENCIES
onnx_proto
flatbuffers::flatbuffers
)

if (onnxruntime_RUN_ONNX_TESTS)
add_definitions(-DORT_RUN_EXTERNAL_ONNX_TESTS)
endif()

if(onnxruntime_ENABLE_ATEN)
message("Aten fallback is enabled.")
find_package(dlpack REQUIRED CONFIG)
endif()

if(onnxruntime_ENABLE_TRAINING OR (onnxruntime_ENABLE_TRAINING_APIS AND onnxruntime_BUILD_UNIT_TESTS))
find_package(cxxopts REQUIRED CONFIG)
endif()

if(onnxruntime_USE_SNPE)
include(external/find_snpe.cmake)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${SNPE_NN_LIBS})
endif()

file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} ORT_BINARY_DIR)
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} ORT_SOURCE_DIR)
62 changes: 27 additions & 35 deletions recipes/onnxruntime/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,50 @@
sources:
"1.18.1":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.18.1.tar.gz"
sha256: "480ff5d2450ff18d02db48908c9c0c6a602993942cb47866b8effe32d0469a2c"
"1.17.3":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.17.3.tar.gz"
sha256: "4112f6552c17216311be013b9a2621a3c1a17ed9e1268a1142599b6a494517c2"
"1.16.3":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.16.3.tar.gz"
sha256: "d26b8a7eed1df4440aa3d8eac5049980cbe585514ccedfda809712051a4b1721"
"1.16.2":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.16.2.tar.gz"
sha256: "609a9d31fd9445eb2e737cbb6420100fa7d4e1180b594c1a62505b26f730bfd5"
"1.16.1":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.16.1.tar.gz"
sha256: "197c6ce4f2de9176402fb8a634c390e757b729ff48a30e8038a0f7d71ff1f1ae"
"1.16.0":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.16.0.tar.gz"
sha256: "3a4e57d454bce4349e11e2262fc47728a78b86ef1e0754514bbbc7d709e0a80d"
"1.15.1":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.15.1.tar.gz"
sha256: "93a9b6f148639938ccbaa48d0f641d8f33312fdfcc69ee9466e11362b43917c4"
"1.14.1":
url: "https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.14.1.tar.gz"
sha256: "f998352b131bb89fa7dd1f1d87ddbafe647dfaddd11929b6b5168b3f4ef857de"
patches:
"1.16.3":
- patch_file: "patches/1.16.0-0001-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used"
patch_type: "conan"
- patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch"
patch_description: "allow to build with abseil built without c++17 support"
"1.18.1":
- patch_file: "patches/1.17.3-0002-missing-include.patch"
patch_description: "add missing '<optional>' include when abseil is built without c++17 support"
patch_type: "portability"
"1.16.2":
- patch_file: "patches/1.16.0-0001-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used"
patch_type: "conan"
- patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch"
- patch_file: "patches/1.18.0-0004-abseil-no-string-view.patch"
patch_description: "allow to build with abseil built without c++17 support"
patch_type: "portability"
"1.16.1":
- patch_file: "patches/1.16.0-0001-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used"
patch_type: "conan"
"1.17.3":
- patch_file: "patches/1.17.3-0001-patch-macos-cpp20-date-compat.patch"
patch_description: "allow to build with macos c++20 support"
patch_type: "portability"
patch_source: "https://github.com/microsoft/onnxruntime/commit/7303a90f4916dcf6f66236d40b8917344c27420a.patch"
- patch_file: "patches/1.17.3-0002-missing-include.patch"
patch_description: "add missing '<optional>' include when abseil is built without c++17 support"
patch_type: "portability"
- patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch"
patch_description: "allow to build with abseil built without c++17 support"
patch_type: "portability"
"1.16.0":
- patch_file: "patches/1.16.0-0001-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used"
patch_type: "conan"
"1.16.3":
- patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch"
patch_description: "allow to build with abseil built without c++17 support"
patch_type: "portability"
"1.15.1":
- patch_file: "patches/1.15.1-0001-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used"
patch_type: "conan"
- patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch"
patch_description: "allow to build with abseil built without c++17 support"
patch_type: "portability"
"1.14.1":
- patch_file: "patches/1.14.1-0001-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used (upstreamed future versions)"
patch_type: "conan"
patch_source: "https://github.com/microsoft/onnxruntime/pull/15323"
- patch_file: "patches/1.14.1-0002-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used"
patch_type: "conan"
- patch_file: "patches/1.14.1-0003-amx-gas-version.patch"
patch_description: "Check GNU AS supports AMX before enabling it"
patch_type: "portability"
Expand All @@ -72,3 +56,11 @@ patches:
patch_description: "Ensures the forward compatibility with the newest versions of re2 library."
patch_type: "portability"
patch_source: "https://github.com/microsoft/onnxruntime/commit/126e7bf15fa4af8621814b82a3f7bd0d786f0239.patch"
# ONNX versions are based on the minor version used at
# https://github.com/microsoft/onnxruntime/tree/main/cmake/external
onnx_version_map:
"1.18.1": "1.16.2"
"1.17.3": "1.15.0"
"1.16.3": "1.14.1"
"1.15.1": "1.14.1"
"1.14.1": "1.13.1"
Loading

0 comments on commit 2b772b4

Please sign in to comment.