[neon/backports-noble/onnxruntime-noble/Neon/release] debian: switch to 1.21.0
Carlos De Maine
null at kde.org
Sat Sep 26 08:40:15 BST 2026
Git commit f2a2e9ed4b7ad8ff01af0d7b28eef9408ae87baf by Carlos De Maine.
Committed on 26/09/2026 at 07:40.
Pushed by carlosdem into branch 'Neon/release'.
switch to 1.21.0
M +189 -1 debian/changelog
M +45 -13 debian/control
M +9 -2 debian/copyright
M +0 -1 debian/libonnxruntime-dev.install
D +0 -2 debian/libonnxruntime1.16.3.install
D +0 -2 debian/libonnxruntime1.16.3.lintian-overrides
A +2 -0 debian/libonnxruntime1.21-dbgsym.lintian-overrides
A +4 -0 debian/libonnxruntime1.21.install
A +6 -0 debian/libonnxruntime1.21.lintian-overrides
A +6 -0 debian/libonnxruntime1.21.symbols
A +1 -0 debian/onnxruntime-tools.lintian-overrides
D +0 -194 debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch
D +0 -35 debian/patches/Add-missing-include.patch
D +0 -19 debian/patches/Disable-AVX-tests-on-non-AMD64.patch
M +41 -39 debian/patches/Disable-failing-tests-on-ARM32.patch
A +84 -0 debian/patches/Skip_python_unit_tests.patch
M +1 -1 debian/patches/disable-power10.patch
A +104 -0 debian/patches/disable-propagate-nan-in-eigen3.patch
A +75 -0 debian/patches/fix-compilation-g++-14.patch
D +0 -24 debian/patches/fix-cxx20-template-constructor.patch
D +0 -159 debian/patches/fix_forward_decl_flatbuffers.patch
M +1 -1 debian/patches/gcc-false-positive.patch
D +0 -210 debian/patches/no-nsync.patch
M +22 -33 debian/patches/remove-wil.patch
M +9 -8 debian/patches/series
A +21 -0 debian/patches/set-noexecstack-linker-flag.patch
A +32 -0 debian/patches/set-soversion.patch
A +15 -0 debian/patches/system-absl.patch
M +13 -6 debian/patches/system-benchmark.patch
M +29 -22 debian/patches/system-cpuinfo.patch
M +9 -9 debian/patches/system-datadir.patch
M +18 -97 debian/patches/system-date-and-mp11.patch
M +5 -5 debian/patches/system-flatbuffers.patch
M +24 -23 debian/patches/system-onnx.patch
M +46 -17 debian/patches/system-protobuf.patch
M +9 -5 debian/patches/system-python.patch
M +13 -4 debian/patches/system-re2.patch
M +6 -19 debian/patches/system-safeint.patch
A +16 -0 debian/patches/use-system-dlpack.patch
A +65 -0 debian/patches/use-system-dnnl.patch
A +47 -0 debian/patches/use-system-xnnpack.patch
D +0 -14 debian/patches/versioned-onnxruntime_providers_shared.patch
A +1 -0 debian/python3-onnxruntime.install
M +64 -10 debian/rules
M +1 -0 debian/salsa-ci.yml
M +19 -0 debian/tests/control
A +36 -0 debian/tests/inference.py
A +55 -0 debian/tests/providers.py
A +34 -0 debian/tests/transformer.py
A +5 -0 debian/upstream/metadata
M +1 -1 debian/watch
https://invent.kde.org/neon/backports-noble/onnxruntime-noble/-/commit/f2a2e9ed4b7ad8ff01af0d7b28eef9408ae87baf
diff --git a/debian/changelog b/debian/changelog
index 1a41474..a2e4181 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,192 @@
-onnxruntime (1.16.3+dfsg-7) noble; urgency=medium
+onnxruntime (1.21.0+dfsg-1) unstable; urgency=medium
+
+ * Upload to unstable.
+ * d/patches: update set-soversion.patch to use SOVERSION in the generation of
+ linker scripts (so that ABIs are stable across patch releases).
+ * Update symbol control file for libonnxruntime1.21.
+
+ -- Shengqi Chen <harry at debian.org> Thu, 13 Mar 2025 23:28:54 +0800
+
+onnxruntime (1.21.0+dfsg-1~exp2) experimental; urgency=medium
+
+ * d/tests: add test-name feature to all stanza
+ * d/control:
+ + bump std-ver to 4.7.2 (no changes required)
+ + disable test-related B-D since tests are not compiled
+ * d/patches:
+ + do not require unused packages to be found in cmake
+ + simply system-date-and-mp11.patch
+
+ -- Shengqi Chen <harry at debian.org> Wed, 12 Mar 2025 13:03:10 +0800
+
+onnxruntime (1.21.0+dfsg-1~exp1) experimental; urgency=medium
+
+ * New upstream version 1.21.0+dfsg
+ + change SONAME to libonnxruntime1.21
+ + enable dlpack and add patch to use libdlpack from system
+ * d/patches:
+ + refresh all existing patches, remove unused patch
+ + set SONAME to MAJOR.MINOR to avoid needless transitions
+ + backport gcc-14 compilation fix from upstream
+ + disable downloading in system-re2.patch
+
+ -- Shengqi Chen <harry at debian.org> Wed, 12 Mar 2025 00:46:59 +0800
+
+onnxruntime (1.20.1+dfsg-2) unstable; urgency=medium
+
+ * d/rules: disable xnnpack EP on riscv64 (currently unusable)
+ * d/patches: add patch to set noexecstack in linker flags
+ (closes: #1098205)
+
+ -- Shengqi Chen <harry at debian.org> Wed, 19 Feb 2025 14:27:32 +0800
+
+onnxruntime (1.20.1+dfsg-1) unstable; urgency=medium
+
+ * Upload to unstable.
+
+ -- Shengqi Chen <harry at debian.org> Tue, 18 Feb 2025 22:05:43 +0800
+
+onnxruntime (1.20.1+dfsg-1~exp3) experimental; urgency=medium
+
+ [ Mo Zhou ]
+ * Patch cmake to avoid -lkleidiai to fix arm64 FTBFS.
+
+ [ Shengqi Chen ]
+ * d/patches:
+ + refresh & rename arm64-no-kleidiai to use-system-xnnpack
+ + update use-system-xnnpack.patch to disable all downloading
+ * d/salsa-ci.yml: enable arm64 build test
+ * d/control: add myself in uploaders
+
+ -- Shengqi Chen <harry at debian.org> Tue, 18 Feb 2025 02:04:15 +0800
+
+onnxruntime (1.20.1+dfsg-1~exp2) experimental; urgency=medium
+
+ * Don't make providers versioned
+ * Add some Conflicts, Replaces and Breaks to avoid
+ conflicts with providers (Closes: #1094599)
+ * Add more lintian overrides for providers plugins
+
+ -- Dylan Aïssi <daissi at debian.org> Thu, 30 Jan 2025 11:00:21 +0100
+
+onnxruntime (1.20.1+dfsg-1~exp1) experimental; urgency=medium
+
+ * Team upload.
+ * New upstream version 1.20.1+dfsg
+ + bump SONAME to libonnxruntime1.20.1
+ * d/patches:
+ + refresh existing patches, remove merged patches
+ + add more hunks to fix build issue with eigen3
+ + add hunk to fix c++ build issue
+ * d/control: specify correct version of libxnnpack-dev in B-D
+
+ -- Shengqi Chen <harry at debian.org> Tue, 28 Jan 2025 19:21:58 +0800
+
+onnxruntime (1.19.2+dfsg-9) unstable; urgency=medium
+
+ * Team upload.
+ * Remove remaining dnnl-related config on riscv64 to fix build
+ * d/rules: remove all potential loadable plugin files from
+ python3-onnxruntime
+
+ -- Shengqi Chen <harry at debian.org> Fri, 24 Jan 2025 13:29:27 +0800
+
+onnxruntime (1.19.2+dfsg-8) unstable; urgency=medium
+
+ * Team upload.
+ * d/tests: enable tests only on architectures with pytorch available
+ * d/rules: disable onednn on riscv64 due to its lack of openmp support
+ * d/rules: use ninja as cmake backend
+ * d/patches: update metadata of some patches
+ * lintian-overrides:
+ + add no-manual-page for onnxruntime-tools
+ + fix .so paths for libonnxruntime
+ * d/control: mark onnxruntime-tools as Archtecture: all
+ * d/control: remove disabled libnsync-dev from Build-Depends
+
+ -- Shengqi Chen <harry at debian.org> Thu, 23 Jan 2025 21:14:15 +0800
+
+onnxruntime (1.19.2+dfsg-7) unstable; urgency=medium
+
+ * Update symbols file for architectures where DNNL is enabled.
+
+ -- Dylan Aïssi <daissi at debian.org> Tue, 21 Jan 2025 12:06:50 +0100
+
+onnxruntime (1.19.2+dfsg-6) unstable; urgency=medium
+
+ * Only install libonnxruntime_providers_dnnl.so on architectures
+ where DNNL is enabled.
+
+ -- Dylan Aïssi <daissi at debian.org> Fri, 17 Jan 2025 15:40:13 +0100
+
+onnxruntime (1.19.2+dfsg-5) unstable; urgency=medium
+
+ * Autopkgtest: add providers.py to check the f32 GEMM performance
+ for all supported providers. Currently on amd64 we have three providers:
+ dnnl, xnnpack, and cpu (onnxruntime built-in).
+ * Only B-D on XNNPACK for some architectures. Then it can be built on ppc64el.
+ * Enable DNNL (i.e., oneDNN) execution provider for selected architectures.
+ * Refresh symbols control file and update lintian overrides.
+ * Override dh_python3 to remove redundant dnnl provider.
+
+ -- Mo Zhou <lumin at debian.org> Tue, 14 Jan 2025 19:05:30 -0500
+
+onnxruntime (1.19.2+dfsg-4) unstable; urgency=medium
+
+ [ Mo Zhou ]
+ * Autopkgtest: test inference with a dummy neural net exported from PyTorch.
+
+ [ Dylan Aïssi ]
+ * Upload to unstable
+
+ -- Dylan Aïssi <daissi at debian.org> Mon, 13 Jan 2025 14:55:09 +0100
+
+onnxruntime (1.19.2+dfsg-3) experimental; urgency=medium
+
+ [ Dylan Aïssi ]
+ * Enable python binding (Closes: #1088901)
+ - Build new binary package: python3-onnxruntime
+ - Add new Build-Deps: dh-sequence-python3, dh-sequence-numpy3,
+ python3-packaging, python3-protobuf, python3-pybind11.
+
+ [ Mateus Rodrigues de Morais ]
+ * Disable LTO and O3 optimization to fix FTBFS on Ubuntu
+
+ -- Dylan Aïssi <daissi at debian.org> Sat, 11 Jan 2025 11:31:55 +0100
+
+onnxruntime (1.19.2+dfsg-2) unstable; urgency=medium
+
+ * Upload to unstable
+
+ -- Dylan Aïssi <daissi at debian.org> Tue, 15 Oct 2024 19:28:48 +0200
+
+onnxruntime (1.19.2+dfsg-1) experimental; urgency=medium
+
+ [ Shengqi Chen ]
+ * d/copyright: exclude more files with unclear license
+ * New upstream version 1.19.2+dfsg (closes: #1080510, #1081664)
+ * d/patches:
+ + refresh & remove applied patches
+ + add patch to use system absl (not yet enabled)
+ + add patch to fix eigen3 compilation
+ + add patch to fix xnnpack compilation
+ + add patch to fix compilation with gcc-14
+ + add patch to set SOVERSION of shared library
+ * d/control: bump B-D version of libcpuinfo and libxnnpack
+ * d/rules:
+ + use ninja to build
+ + enable hardening
+ + do not re-generate fbs schema
+ * d/: bump SONAME to libonnxruntime1.19.2
+
+ [ Dylan Aïssi ]
+ * Add patch adding aliases for library onnx
+ * Add symbols file
+ * Add upstream/metadata
+
+ -- Dylan Aïssi <daissi at debian.org> Thu, 10 Oct 2024 11:13:02 +0200
+
+onnxruntime (1.16.3+dfsg-7) unstable; urgency=medium
* Fix includedir in pkgconfig (Closes: #1079791)
* Add a basic build autopkgtest for the library
diff --git a/debian/control b/debian/control
index dab8c55..6a399fb 100644
--- a/debian/control
+++ b/debian/control
@@ -1,30 +1,35 @@
Source: onnxruntime
Maintainer: Debian Deep Learning Team <debian-ai at lists.debian.org>
Uploaders: Mo Zhou <lumin at debian.org>,
- Dylan Aïssi <daissi at debian.org>
+ Dylan Aïssi <daissi at debian.org>,
+ Shengqi Chen <harry at debian.org>
Section: science
Priority: optional
Build-Depends: debhelper-compat (= 13),
+ dh-exec,
+ dh-sequence-python3,
+ dh-sequence-numpy3,
cmake,
- flatbuffers-compiler,
libboost-dev,
- libbenchmark-dev,
- libcpuinfo-dev (>= 0.0~git20220819.8ec7bd9),
+# libbenchmark-dev, # not enabled in rules
+ libcpuinfo-dev (>= 0.0~git20240830.fa1c679),
+ libdlpack-dev,
libeigen3-dev (>= 3.4.0),
libflatbuffers-dev,
- libgmock-dev,
- libgtest-dev,
+# libgmock-dev <!nocheck>,
+# libgtest-dev <!nocheck>,
libhowardhinnant-date-dev,
libmsgsl-dev,
- libnsync-dev,
libonnx-dev,
- libonnx-testdata,
+# libonnx-testdata <!nocheck>,
libpng-dev,
libprotobuf-dev,
libpthreadpool-dev,
libsafeint-dev,
libre2-dev,
- libxnnpack-dev (>= 0.0~git20221221.51a9875),
+ libdnnl-dev [amd64 arm64 ppc64el s390x],
+ libxnnpack-dev (>= 0.0~git20241108.4ea82e5~) [amd64 arm64 armhf i386 riscv64 x32],
+ ninja-build,
nlohmann-json3-dev,
protobuf-compiler,
pkgconf,
@@ -32,21 +37,28 @@ Build-Depends: debhelper-compat (= 13),
python3-all-dev,
python3-numpy,
python3-onnx,
+ python3-packaging,
+ python3-protobuf,
+ python3-pybind11,
python3-setuptools,
python3-wheel,
zlib1g-dev
-Standards-Version: 4.7.0
+Standards-Version: 4.7.2
Vcs-Browser: https://salsa.debian.org/deeplearning-team/onnxruntime
Vcs-Git: https://salsa.debian.org/deeplearning-team/onnxruntime.git
Homepage: https://github.com/microsoft/onnxruntime
Rules-Requires-Root: no
-Package: libonnxruntime1.16.3
+Package: libonnxruntime1.21
Architecture: any
Multi-Arch: same
Section: libs
Depends: ${misc:Depends},
${shlibs:Depends}
+Conflicts: libonnxruntime1.19.2, libonnxruntime1.20.1
+Replaces: libonnxruntime1.19.2, libonnxruntime1.20.1,
+ libonnxruntime-dev (<< 1.20.1+dfsg-1~exp2~)
+Breaks: libonnxruntime-dev (<< 1.20.1+dfsg-1~exp2~)
Description: cross-platform inference and training ML accelerator (shared lib)
ONNX Runtime is a performance-focused complete scoring engine for Open Neural
Network Exchange (ONNX) models, with an open extensible architecture to
@@ -62,7 +74,7 @@ Package: libonnxruntime-dev
Architecture: any
Multi-Arch: same
Section: libdevel
-Depends: libonnxruntime1.16.3 (= ${binary:Version}),
+Depends: libonnxruntime1.21 (= ${binary:Version}),
${misc:Depends}
Breaks: libonnxruntime1.13.1 (<< 1.16.3+dfsg-1~)
Replaces: libonnxruntime1.13.1 (<< 1.16.3+dfsg-1~)
@@ -78,8 +90,10 @@ Description: cross-platform inference and training ML accelerator (dev files)
This package provides the development files for libonnxruntime.
Package: onnxruntime-tools
-Architecture: any
+Architecture: all
+Multi-Arch: foreign
Depends: ${misc:Depends},
+ ${python3:Depends},
${shlibs:Depends}
Description: cross-platform inference and training ML accelerator (tools)
ONNX Runtime is a performance-focused complete scoring engine for Open Neural
@@ -91,3 +105,21 @@ Description: cross-platform inference and training ML accelerator (tools)
details.
.
This package provides the onnxruntime tools.
+
+Package: python3-onnxruntime
+Architecture: any
+Section: python
+Depends: libonnxruntime1.21 (= ${binary:Version}),
+ ${misc:Depends},
+ ${python3:Depends},
+ ${shlibs:Depends}
+Description: cross-platform inference and training ML accelerator (Python bindings)
+ ONNX Runtime is a performance-focused complete scoring engine for Open Neural
+ Network Exchange (ONNX) models, with an open extensible architecture to
+ continually address the latest developments in AI and Deep Learning. ONNX
+ Runtime stays up to date with the ONNX standard with complete implementation of
+ all ONNX operators, and supports all ONNX releases (1.2+) with both future and
+ backwards compatibility. Please refer to this page for ONNX opset compatibility
+ details.
+ .
+ This package provides the onnxruntime Python bindings.
diff --git a/debian/copyright b/debian/copyright
index 748b97b..7ea8861 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,15 +1,22 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ONNX Runtime
Source: https://github.com/microsoft/onnxruntime
-Comment: Model files with unclear licenses.
- See https://github.com/microsoft/onnxruntime/issues/8963
+Comment: Files excluded include:
+ 1. Model files with unclear licenses (*.onnx, *.ort, *.bin).
+ See https://github.com/microsoft/onnxruntime/issues/8963
+ 2. Binary files in testdata with unknown source (*.mp3, *.png)
+ 3. Binary patches for Windows with unclear license
Files-Excluded:
*.onnx
+ *.bin
+ */models/*/test/*.mp3
+ */models/*/test/*.png
*.ort
*.jar
.gitignore
.gitattributes
csharp/ApiDocs
+ cmake/external/git.*
Files: *
Copyright: 2017-2024 Microsoft Corporation
diff --git a/debian/libonnxruntime-dev.install b/debian/libonnxruntime-dev.install
index 4a47cf2..7c24f17 100644
--- a/debian/libonnxruntime-dev.install
+++ b/debian/libonnxruntime-dev.install
@@ -2,4 +2,3 @@ usr/include/
usr/lib/*/cmake
usr/lib/*/pkgconfig
usr/lib/*/libonnxruntime.so
-usr/lib/*/libonnxruntime_providers_shared.so
diff --git a/debian/libonnxruntime1.16.3.install b/debian/libonnxruntime1.16.3.install
deleted file mode 100644
index 92f2c25..0000000
--- a/debian/libonnxruntime1.16.3.install
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/*/libonnxruntime.so.*
-usr/lib/*/libonnxruntime_providers_shared.so.*
diff --git a/debian/libonnxruntime1.16.3.lintian-overrides b/debian/libonnxruntime1.16.3.lintian-overrides
deleted file mode 100644
index b316f93..0000000
--- a/debian/libonnxruntime1.16.3.lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-# This is a loadable plugin
-libonnxruntime1.16.3: shared-library-lacks-prerequisites [usr/lib/*/libonnxruntime_providers_shared.so.*]
diff --git a/debian/libonnxruntime1.21-dbgsym.lintian-overrides b/debian/libonnxruntime1.21-dbgsym.lintian-overrides
new file mode 100644
index 0000000..54145c5
--- /dev/null
+++ b/debian/libonnxruntime1.21-dbgsym.lintian-overrides
@@ -0,0 +1,2 @@
+# don't know what happend to this debug symbol
+stripped-library [usr/lib/debug/.dwz/x86_64-linux-gnu/libonnxruntime*.debug]
diff --git a/debian/libonnxruntime1.21.install b/debian/libonnxruntime1.21.install
new file mode 100755
index 0000000..4cb3bb5
--- /dev/null
+++ b/debian/libonnxruntime1.21.install
@@ -0,0 +1,4 @@
+#! /usr/bin/dh-exec
+usr/lib/*/libonnxruntime.so.*
+usr/lib/*/libonnxruntime_providers_shared.so
+usr/lib/*/libonnxruntime_providers_dnnl.so [amd64 arm64 ppc64el s390x]
diff --git a/debian/libonnxruntime1.21.lintian-overrides b/debian/libonnxruntime1.21.lintian-overrides
new file mode 100644
index 0000000..e7f8bac
--- /dev/null
+++ b/debian/libonnxruntime1.21.lintian-overrides
@@ -0,0 +1,6 @@
+# loadable plugins
+lacks-unversioned-link-to-shared-library example: usr/lib/*/libonnxruntime_providers_*.so [usr/lib/*/libonnxruntime_providers_*.so]
+shared-library-lacks-prerequisites [usr/lib/*/libonnxruntime_providers_*.so]
+shared-library-lacks-version usr/lib/*/libonnxruntime_providers_*.so libonnxruntime_providers_*.so
+shared-library-symbols-not-tracked libonnxruntime_providers_*.so for usr/lib/*/libonnxruntime_providers_*.so [symbols]
+sharedobject-in-library-directory-missing-soname [usr/lib/*/libonnxruntime_providers_*.so]
diff --git a/debian/libonnxruntime1.21.symbols b/debian/libonnxruntime1.21.symbols
new file mode 100644
index 0000000..6b8ca5b
--- /dev/null
+++ b/debian/libonnxruntime1.21.symbols
@@ -0,0 +1,6 @@
+libonnxruntime.so.1.21 #PACKAGE# #MINVER#
+* Build-Depends-Package: libonnxruntime-dev
+ OrtGetApiBase at VERS_1.21 1.21.0
+ OrtSessionOptionsAppendExecutionProvider_CPU at VERS_1.21 1.21.0
+ (arch=amd64 arm64 ppc64el s390x)OrtSessionOptionsAppendExecutionProvider_Dnnl at VERS_1.21 1.21.0
+ VERS_1.21 at VERS_1.21 1.21.0
diff --git a/debian/onnxruntime-tools.lintian-overrides b/debian/onnxruntime-tools.lintian-overrides
new file mode 100644
index 0000000..4ee534f
--- /dev/null
+++ b/debian/onnxruntime-tools.lintian-overrides
@@ -0,0 +1 @@
+no-manual-page [usr/bin/onnxruntime_test]
diff --git a/debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch b/debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch
deleted file mode 100644
index 268e705..0000000
--- a/debian/patches/17eaf9b053238b3efec303e9c94008201ca42462.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-From 17eaf9b053238b3efec303e9c94008201ca42462 Mon Sep 17 00:00:00 2001
-From: Changming Sun <chasun at microsoft.com>
-Date: Wed, 13 Dec 2023 11:11:13 -0800
-Subject: [PATCH] Fix a build warning in SparseTensor code for 32-bit build
- configs (#18766) and the warning in #18195
-Co-authored-by: Dmitri Smirnov <yuslepukhin at users.noreply.github.com>
-
-Origin: upstream, https://github.com/microsoft/onnxruntime/commit/17eaf9b053
-Bug: https://github.com/microsoft/onnxruntime/issues/18195
-Forwarded: https://github.com/microsoft/onnxruntime/pull/18766
-
-17eaf9b053238b3efec303e9c94008201ca42462
----
- .../cpu/math/sparse_dense_matmul.cc | 73 ++++++++++++-------
- onnxruntime/core/util/math_cpuonly.h | 2 +-
- .../contrib_ops/math/matmul_sparse_test.cc | 2 -
- .../azure-pipelines/linux-ci-pipeline.yml | 3 +-
- 4 files changed, 50 insertions(+), 30 deletions(-)
-
---- a/onnxruntime/contrib_ops/cpu/math/sparse_dense_matmul.cc
-+++ b/onnxruntime/contrib_ops/cpu/math/sparse_dense_matmul.cc
-@@ -47,7 +47,6 @@
- float alpha;
- };
-
--#if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
- template <typename T>
- inline void SparseDenseMatMulImpl(const ComputeCtx& ctx, const ConstSparseMatrixMap<T>& map_A,
- const ConstEigenMatrixMapRowMajor<T>& map_B, EigenMatrixMapRowMajor<T>& output_map) {
-@@ -64,7 +63,8 @@
-
- template <>
- inline void SparseDenseMatMulImpl<float>(const ComputeCtx& ctx, const ConstSparseMatrixMap<float>& map_A,
-- const ConstEigenMatrixMapRowMajor<float>& map_B, EigenMatrixMapRowMajor<float>& output_map) {
-+ const ConstEigenMatrixMapRowMajor<float>& map_B,
-+ EigenMatrixMapRowMajor<float>& output_map) {
- if (ctx.trans_A && ctx.trans_B) {
- output_map = map_A.transpose() * ctx.alpha * map_B.transpose();
- } else if (ctx.trans_A && !ctx.trans_B) {
-@@ -84,21 +84,47 @@
- const auto& b_dims = B.Shape().GetDims();
- const auto& out_dims = output.Shape().GetDims();
- auto csr_view = A.AsCsr();
--
-- ConstSparseMatrixMap<T> map_A(a_dims[0], a_dims[1], A.NumValues(),
-- csr_view.Outer().Data<int64_t>(),
-- csr_view.Inner().Data<int64_t>(),
-+ const Eigen::Index* inner_index_pointer = nullptr;
-+ const Eigen::Index* outer_index_pointer = nullptr;
-+ // For auto-release the above two pointers when they are not NULL.
-+ std::unique_ptr<Eigen::Index[]> buffer_holder_inner, buffer_holder_outer;
-+ if constexpr (std::is_integral<Eigen::Index>::value &&
-+ std::is_signed<Eigen::Index>::value &&
-+ (sizeof(Eigen::Index) == sizeof(int64_t))) {
-+ // On macOS the following reinterpret_cast is necessary because Eigen::Index is an alias of `long` but int64_t is
-+ // `long long`. Though they have the same size, compilers still do not allow an implicit casting between them.
-+ inner_index_pointer = reinterpret_cast<const Eigen::Index*>(csr_view.Inner().Data<int64_t>());
-+ outer_index_pointer = reinterpret_cast<const Eigen::Index*>(csr_view.Outer().Data<int64_t>());
-+ } else {
-+ // In a 32-bit build we need to cast the following two tensors to 32 bits
-+ gsl::span<const int64_t> inner_data = csr_view.Inner().DataAsSpan<int64_t>();
-+ gsl::span<const int64_t> outer_data = csr_view.Outer().DataAsSpan<int64_t>();
-+ buffer_holder_inner.reset(new Eigen::Index[inner_data.size()]);
-+ buffer_holder_outer.reset(new Eigen::Index[outer_data.size()]);
-+ inner_index_pointer = buffer_holder_inner.get();
-+ outer_index_pointer = buffer_holder_outer.get();
-+
-+ std::transform(inner_data.begin(), inner_data.end(),
-+ buffer_holder_inner.get(), [](int64_t v) -> Eigen::Index {
-+ return narrow<Eigen::Index>(v);
-+ });
-+ std::transform(outer_data.begin(), outer_data.end(),
-+ buffer_holder_outer.get(), [](int64_t v) -> Eigen::Index {
-+ return narrow<Eigen::Index>(v);
-+ });
-+ }
-+ ConstSparseMatrixMap<T> map_A(narrow<Eigen::Index>(a_dims[0]), narrow<Eigen::Index>(a_dims[1]),
-+ narrow<Eigen::Index>(A.NumValues()), outer_index_pointer, inner_index_pointer,
- A.Values().Data<T>());
-- ConstEigenMatrixMapRowMajor<T> map_B(B.Data<T>(), b_dims[0], b_dims[1]);
-- EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), out_dims[0], out_dims[1]);
-+ ConstEigenMatrixMapRowMajor<T> map_B(B.Data<T>(), narrow<Eigen::Index>(b_dims[0]), narrow<Eigen::Index>(b_dims[1]));
-+ EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), narrow<Eigen::Index>(out_dims[0]),
-+ narrow<Eigen::Index>(out_dims[1]));
- // XXX: Consider re-writing it as a parallel loop as Eigen requires it to use OpenMP
- // XXX: Consider vectorization
- SparseDenseMatMulImpl(ctx, map_A, map_B, output_map);
- }
- };
-
--#endif //! defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
--
- template <typename T>
- inline T Mul(T a_value, float, T b_value) {
- return a_value * b_value;
-@@ -121,9 +147,11 @@
- auto coo_view = A.AsCoo();
- const auto& ind_dims = coo_view.Indices().Shape().GetDims();
- ORT_RETURN_IF_NOT(ind_dims.size() == 2, "COO indices must be 2-D, got: ", ind_dims.size());
-- ConstEigenMatrixMapRowMajor<int64_t> a_indicies_map(coo_view.Indices().Data<int64_t>(), narrow<size_t>(ind_dims[0]), narrow<size_t>(ind_dims[1]));
-+ ConstEigenMatrixMapRowMajor<int64_t> a_indicies_map(coo_view.Indices().Data<int64_t>(), narrow<size_t>(ind_dims[0]),
-+ narrow<size_t>(ind_dims[1]));
- ConstEigenMatrixMapRowMajor<T> map_b(B.Data<T>(), narrow<size_t>(b_dims[0]), narrow<size_t>(b_dims[1]));
-- EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), narrow<size_t>(out_dims[0]), narrow<size_t>(out_dims[1]));
-+ EigenMatrixMapRowMajor<T> output_map(output.MutableData<T>(), narrow<size_t>(out_dims[0]),
-+ narrow<size_t>(out_dims[1]));
- output_map.setZero();
-
- const auto rhs_right = (ctx.trans_B) ? b_dims[0] : b_dims[1];
-@@ -140,7 +168,8 @@
- ORT_RETURN_IF_NOT(m < out_left, "COO m index: ", m, " is out of bounds of out_left: ", out_left);
- const T a_value = a_values[i];
- for (int64_t n = 0; n < rhs_right; ++n) {
-- const T b_value = (ctx.trans_B) ? map_b(narrow<size_t>(n), narrow<size_t>(k)) : map_b(narrow<size_t>(k), narrow<size_t>(n));
-+ const T b_value =
-+ (ctx.trans_B) ? map_b(narrow<size_t>(n), narrow<size_t>(k)) : map_b(narrow<size_t>(k), narrow<size_t>(n));
- output_map(narrow<size_t>(m), narrow<size_t>(n)) += Mul(a_value, ctx.alpha, b_value);
- }
- }
-@@ -170,8 +199,9 @@
- const auto inner_B = (trans_b_attr_) ? b_dims[1] : b_dims[0];
- const auto outer_B = (trans_b_attr_) ? b_dims[0] : b_dims[1];
-
-- ORT_RETURN_IF_NOT(inner_A == inner_B, "Can not multiply A and B as inner dimension does not match. inner_A: ",
-- inner_A, " vs inner_B: ", inner_B);
-+ ORT_RETURN_IF_NOT(inner_A == inner_B,
-+ "Can not multiply A and B as inner dimension does not match. inner_A: ", inner_A,
-+ " vs inner_B: ", inner_B);
-
- TensorShape output_shape{outer_A, outer_B};
- auto* output = ctx->Output(0, output_shape);
-@@ -184,12 +214,10 @@
- auto coo_view = A->AsCoo();
- const auto num_dims = coo_view.Indices().Shape().NumDimensions();
- ORT_RETURN_IF_NOT(num_dims == 2, "Expecting COO 2-D indices shape");
-- ORT_RETURN_IF_NOT(A->Values().Shape().Size() * 2 == coo_view.Indices().Shape().Size(), "Expecting 2xValues == indices");
-+ ORT_RETURN_IF_NOT(A->Values().Shape().Size() * 2 == coo_view.Indices().Shape().Size(),
-+ "Expecting 2xValues == indices");
- auto status = t_disp.InvokeRet<Status, SparseToDenseCoo>(compute_ctx, *A, *B, *output);
- ORT_RETURN_IF_ERROR(status);
--// Eigen has a bug in x86 where it calculates reallocation size as -1
--// and throws bad_alloc
--#if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
- } else if (A->Format() == SparseFormat::kCsrc) {
- auto csr_view = A->AsCsr();
- ORT_RETURN_IF_NOT(A->Values().Shape().Size() == csr_view.Inner().Shape().Size(),
-@@ -199,11 +227,6 @@
- } else {
- return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "Currently support only COO and CSR(x64) formats");
- }
--#else
-- } else {
-- return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "WASM and 32-bit builds support only COO format");
-- }
--#endif //! defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
-
- return Status::OK();
- }
-@@ -211,4 +234,4 @@
- } // namespace contrib
- } // namespace onnxruntime
-
--#endif //! defined(DISABLE_SPARSE_TENSORS)
-\ No newline at end of file
-+#endif //! defined(DISABLE_SPARSE_TENSORS)
---- a/onnxruntime/core/util/math_cpuonly.h
-+++ b/onnxruntime/core/util/math_cpuonly.h
-@@ -93,7 +93,7 @@
- using ConstEigenMatrixMap = Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>;
-
- template <class T>
--using ConstSparseMatrixMap = Eigen::Map<const Eigen::SparseMatrix<T, Eigen::RowMajor, int64_t>>;
-+using ConstSparseMatrixMap = Eigen::Map<const Eigen::SparseMatrix<T, Eigen::RowMajor, Eigen::Index>>;
-
- template <typename T>
- using ConstEigenArrayMap = Eigen::Map<const Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic>>;
---- a/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
-+++ b/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
-@@ -140,7 +140,6 @@
- }
- */
- #if !defined(DISABLE_SPARSE_TENSORS)
--#if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
- #if !defined(__arm__)
- TEST(SparseToDenseMatMul, TestCsr) {
- constexpr int64_t rows = 9;
-@@ -263,7 +262,6 @@
- }
- }
- #endif // #if !defined(__arm__)
--#endif // //!defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
-
- TEST(SparseToDenseMatMul, TestCoo) {
- constexpr int64_t rows = 9;
diff --git a/debian/patches/Add-missing-include.patch b/debian/patches/Add-missing-include.patch
deleted file mode 100644
index 8896d39..0000000
--- a/debian/patches/Add-missing-include.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Description: Both 'std::setw' and 'std::setfill' are defined in '<iomanip>
-Origin: upstream, https://github.com/microsoft/onnxruntime/commit/bf33919
-Forwarded: not-needed
-
---- a/onnxruntime/test/mlas/unittest/test_activation.cpp
-+++ b/onnxruntime/test/mlas/unittest/test_activation.cpp
-@@ -1,6 +1,6 @@
- // Copyright (c) Microsoft Corporation. All rights reserved.
- // Licensed under the MIT License.
--
-+#include <iomanip>
- #include "test_util.h"
-
- class MlasActivationTest : public MlasTestBase {
---- a/onnxruntime/test/framework/kernel_type_str_resolver_utils_test.cc
-+++ b/onnxruntime/test/framework/kernel_type_str_resolver_utils_test.cc
-@@ -5,7 +5,7 @@
-
- #include <iostream>
- #include <sstream>
--
-+#include <iomanip>
- #include "gtest/gtest.h"
-
- #include "core/flatbuffers/schema/ort.fbs.h"
---- a/onnxruntime/test/mlas/unittest/test_fp16_activation.cpp
-+++ b/onnxruntime/test/mlas/unittest/test_fp16_activation.cpp
-@@ -2,6 +2,7 @@
- // Licensed under the MIT License.
-
- #include "test_fp16.h"
-+#include <iomanip>
-
- #ifdef MLAS_F16VEC_INTRINSICS_SUPPORTED
-
diff --git a/debian/patches/Disable-AVX-tests-on-non-AMD64.patch b/debian/patches/Disable-AVX-tests-on-non-AMD64.patch
deleted file mode 100644
index 7a5853c..0000000
--- a/debian/patches/Disable-AVX-tests-on-non-AMD64.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Subject: Fix build on non-amd64 systems
- /usr/src/packages/BUILD/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc:101:5:
- error: MlasReduceMinimumMaximumF32KernelAvx was not declared in this scope; did you mean MlasReduceMinimumMaximumF32Kernel?
-
---- a/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc
-+++ b/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc
-@@ -91,6 +91,7 @@
- ->Arg(98304)
- ->Arg(160000);
-
-+#if defined(MLAS_TARGET_AMD64)
- // MLAS avx implementation
- static void BM_FindMinMaxMlasAvx(benchmark::State& state) {
- const size_t batch_size = static_cast<size_t>(state.range(0));
-@@ -115,3 +116,4 @@
- ->Arg(80000)
- ->Arg(98304)
- ->Arg(160000);
-+#endif
diff --git a/debian/patches/Disable-failing-tests-on-ARM32.patch b/debian/patches/Disable-failing-tests-on-ARM32.patch
index 6749a43..dbb030b 100644
--- a/debian/patches/Disable-failing-tests-on-ARM32.patch
+++ b/debian/patches/Disable-failing-tests-on-ARM32.patch
@@ -1,9 +1,11 @@
-Subject: ARM32 has a limited support (see docs/Roadmap.md)
+Description: ARM32 has a limited support (see docs/Roadmap.md)
Several tests fail on this architecture, so skipping them for now.
+Author: Dylan Aïssi <daissi at debian.org>
+Forwarded: not-needed
--- a/onnxruntime/test/optimizer/qdq_transformer_test.cc
+++ b/onnxruntime/test/optimizer/qdq_transformer_test.cc
-@@ -116,11 +116,13 @@
+@@ -138,11 +138,13 @@
QDQTransformerConvTests<int8_t, int8_t, int32_t, uint8_t>();
}
@@ -16,16 +18,16 @@ Subject: ARM32 has a limited support (see docs/Roadmap.md)
+#endif // #if !defined(__arm__)
TEST(QDQTransformerTests, ConvMaxPoolReshape_UInt8) {
- auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape, int opset_version) {
-@@ -187,6 +189,7 @@
- test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3}, 19);
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape,
+@@ -215,6 +217,7 @@
+ test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3}, 19, true); // Use com.microsoft QDQ ops
}
+#if !defined(__arm__)
TEST(QDQTransformerTests, ConvMaxPoolReshape_Int8) {
- auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape) {
- auto build_test_case = [&](ModelTestBuilder& builder) {
-@@ -639,10 +642,12 @@
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape,
+ bool use_contrib_qdq = false) {
+@@ -689,10 +692,12 @@
QDQTransformerMatMulTests<uint8_t, int8_t, uint8_t>(true);
}
@@ -38,7 +40,7 @@ Subject: ARM32 has a limited support (see docs/Roadmap.md)
TEST(QDQTransformerTests, MatMul_S8U8U8) {
QDQTransformerMatMulTests<int8_t, uint8_t, uint8_t>(false);
-@@ -654,10 +659,12 @@
+@@ -704,10 +709,12 @@
QDQTransformerMatMulTests<int8_t, uint8_t, int8_t>(true);
}
@@ -51,7 +53,7 @@ Subject: ARM32 has a limited support (see docs/Roadmap.md)
template <typename Input1Type, typename Input2Type, typename OutputType, typename BiasType = int32_t>
void QDQTransformerGemmTests(bool has_output_q, bool has_bias, bool beta_not_one = false) {
-@@ -821,10 +828,12 @@
+@@ -874,10 +881,12 @@
QDQTransformerGemmTests<uint8_t, int8_t, uint8_t, uint8_t>();
}
@@ -64,7 +66,7 @@ Subject: ARM32 has a limited support (see docs/Roadmap.md)
TEST(QDQTransformerTests, Gemm_S8U8U8) {
QDQTransformerGemmTests<int8_t, uint8_t, uint8_t>();
-@@ -836,10 +845,12 @@
+@@ -889,10 +898,12 @@
QDQTransformerGemmTests<int8_t, uint8_t, int8_t, uint8_t>();
}
@@ -75,67 +77,67 @@ Subject: ARM32 has a limited support (see docs/Roadmap.md)
}
+#endif // #if !defined(__arm__)
- TEST(QDQTransformerTests, Gather) {
- auto test_case = [&](const std::vector<int64_t>& input1_shape, const std::vector<int64_t>& weights_shape) {
-@@ -1539,6 +1550,7 @@
- test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3});
+ // Runs a test case that checks if Q/DQ nodes are dropped from DQ -> Gather -> Q.
+ template <typename QuantType>
+@@ -2435,6 +2446,7 @@
+ test_case({1, 12, 37}, {32, 12, 5}, true /*use_contrib_qdq*/);
}
+#if !defined(__arm__)
TEST(QDQTransformerTests, ConvAveragePoolReshape_Int8) {
- auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape) {
- auto build_test_case = [&](ModelTestBuilder& builder) {
-@@ -1675,6 +1687,7 @@
- test_case({1, 23, 13, 13}, {30, 23, 3, 3});
- test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3});
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape,
+ bool use_contrib_qdq) {
+@@ -2577,6 +2589,7 @@
+ test_case({1, 22, 11, 13, 15}, {30, 22, 5, 3, 3}, false /*use_contrib_qdq*/);
+ test_case({1, 12, 37}, {32, 12, 5}, true /*use_contrib_qdq*/);
}
+#endif // #if !defined(__arm__)
template <typename InputType, typename OutputType>
void QDQTransformerLeakyReluTests() {
-@@ -1847,6 +1860,7 @@
+@@ -2753,6 +2766,7 @@
QDQTransformerSigmoidTests<uint8_t, int8_t>();
}
+#if !defined(__arm__)
TEST(QDQTransformerTests, ConvTranspose_QBackward) {
- auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape, const std::vector<int64_t>& perms) {
- auto build_test_case = [&](ModelTestBuilder& builder) {
-@@ -2686,6 +2700,7 @@
-
- test_case({1, 13, 13, 23});
+ auto test_case = [&](const std::vector<int64_t>& input_shape, const std::vector<int64_t>& weights_shape,
+ const std::vector<int64_t>& perms, bool use_contrib_qdq) {
+@@ -3611,6 +3625,7 @@
+ test_case({1, 13, 13, 23}, 4, {0, 3, 1, 2}, true, true, true /*use_contrib_qdq*/);
+ #endif
}
+#endif // #if !defined(__arm__)
- TEST(QDQTransformerTests, QDQ_Selector_Test) {
- const ORTCHAR_T* model_file_name = ORT_TSTR("testdata/transform/qdq_conv.onnx");
-@@ -3076,6 +3091,7 @@
- test_case(true);
- test_case(false);
+ TEST(QDQTransformerTests, QDQPropagation_StopAtOtherQDQ) {
+ auto test_case = [&](const std::vector<int64_t>& input_shape, bool same_scale, bool same_zp,
+@@ -3971,6 +3986,7 @@
+ run_test_case(/*slice_has_graph_output*/ false);
+ run_test_case(/*slice_has_graph_output*/ true);
}
+#endif // #if !defined(__arm__)
- // test removal when we have graph input -> Q/DQ pair -> graph output
- TEST(QDQTransformerTests, QDQFinalCleanupTransformer_GraphInputToOutput) {
+ #if defined(USE_NNAPI) || defined(USE_QNN) || defined(USE_XNNPACK)
+ static void VerifyIODef(const NodeUnitIODef& io_def, const Node& node) {
--- a/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
+++ b/onnxruntime/test/contrib_ops/math/matmul_sparse_test.cc
-@@ -141,6 +141,7 @@
+@@ -140,6 +140,7 @@
+ }
*/
#if !defined(DISABLE_SPARSE_TENSORS)
- #if !defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
+#if !defined(__arm__)
TEST(SparseToDenseMatMul, TestCsr) {
constexpr int64_t rows = 9;
constexpr int64_t cols = 9;
-@@ -261,6 +262,7 @@
+@@ -260,6 +261,7 @@
tester.Run(OpTester::ExpectResult::kExpectSuccess);
}
}
-+#endif // #if !defined(__arm__)
- #endif // //!defined(__i386__) && !defined(_M_IX86) && !defined(__wasm__) && !defined(__ANDROID__)
++#endif // #if !defined(__arm__)
TEST(SparseToDenseMatMul, TestCoo) {
-@@ -383,4 +385,4 @@
+ constexpr int64_t rows = 9;
+@@ -381,4 +383,4 @@
#endif // !defined(DISABLE_SPARSE_TENSORS)
} // namespace test
diff --git a/debian/patches/Skip_python_unit_tests.patch b/debian/patches/Skip_python_unit_tests.patch
new file mode 100644
index 0000000..e61c5e6
--- /dev/null
+++ b/debian/patches/Skip_python_unit_tests.patch
@@ -0,0 +1,84 @@
+Description: These tests use excluded datasets due to unclear licenses.
+Forwarded: not-needed
+Author: Dylan Aïssi <daissi at debian.org>
+
+--- a/cmake/onnxruntime_python.cmake
++++ b/cmake/onnxruntime_python.cmake
+@@ -439,15 +439,15 @@
+ file(GLOB onnxruntime_python_transformers_test_srcs CONFIGURE_DEPENDS
+ "${ONNXRUNTIME_ROOT}/test/python/transformers/*.py"
+ )
+- file(GLOB onnxruntime_python_transformers_testdata_srcs CONFIGURE_DEPENDS
+- "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/*.onnx"
+- )
+- file(GLOB onnxruntime_python_transformers_testdata_whisper CONFIGURE_DEPENDS
+- "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/whisper/*.onnx"
+- )
+- file(GLOB onnxruntime_python_transformers_testdata_conformer CONFIGURE_DEPENDS
+- "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/conformer/*.onnx"
+- )
++# file(GLOB onnxruntime_python_transformers_testdata_srcs CONFIGURE_DEPENDS
++# "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/*.onnx"
++# )
++# file(GLOB onnxruntime_python_transformers_testdata_whisper CONFIGURE_DEPENDS
++# "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/whisper/*.onnx"
++# )
++# file(GLOB onnxruntime_python_transformers_testdata_conformer CONFIGURE_DEPENDS
++# "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/conformer/*.onnx"
++# )
+ endif()
+
+ file(GLOB onnxruntime_python_tools_srcs CONFIGURE_DEPENDS
+@@ -504,10 +504,10 @@
+ file(GLOB onnxruntime_python_datasets_srcs CONFIGURE_DEPENDS
+ "${ONNXRUNTIME_ROOT}/python/datasets/*.py"
+ )
+-file(GLOB onnxruntime_python_datasets_data CONFIGURE_DEPENDS
+- "${ONNXRUNTIME_ROOT}/python/datasets/*.pb"
+- "${ONNXRUNTIME_ROOT}/python/datasets/*.onnx"
+-)
++#file(GLOB onnxruntime_python_datasets_data CONFIGURE_DEPENDS
++# "${ONNXRUNTIME_ROOT}/python/datasets/*.pb"
++# "${ONNXRUNTIME_ROOT}/python/datasets/*.onnx"
++#)
+
+ # ORT Mobile helpers to convert ONNX model to ORT format, analyze model for suitability in mobile scenarios,
+ # and assist with export from PyTorch.
+@@ -609,9 +609,9 @@
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${onnxruntime_python_datasets_srcs}
+ $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/datasets/
+- COMMAND ${CMAKE_COMMAND} -E copy
+- ${onnxruntime_python_datasets_data}
+- $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/datasets/
++# COMMAND ${CMAKE_COMMAND} -E copy
++# ${onnxruntime_python_datasets_data}
++# $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/datasets/
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${onnxruntime_python_tools_srcs}
+ $<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/tools/
+@@ -749,15 +749,15 @@
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${onnxruntime_python_transformers_test_srcs}
+ $<TARGET_FILE_DIR:${build_output_target}>/transformers/
+- COMMAND ${CMAKE_COMMAND} -E copy
+- ${onnxruntime_python_transformers_testdata_srcs}
+- $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/
+- COMMAND ${CMAKE_COMMAND} -E copy
+- ${onnxruntime_python_transformers_testdata_whisper}
+- $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/whisper/
+- COMMAND ${CMAKE_COMMAND} -E copy
+- ${onnxruntime_python_transformers_testdata_conformer}
+- $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/conformer/
++# COMMAND ${CMAKE_COMMAND} -E copy
++# ${onnxruntime_python_transformers_testdata_srcs}
++# $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/
++# COMMAND ${CMAKE_COMMAND} -E copy
++# ${onnxruntime_python_transformers_testdata_whisper}
++# $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/whisper/
++# COMMAND ${CMAKE_COMMAND} -E copy
++# ${onnxruntime_python_transformers_testdata_conformer}
++# $<TARGET_FILE_DIR:${build_output_target}>/transformers/test_data/models/conformer/
+ )
+ endif()
+
diff --git a/debian/patches/disable-power10.patch b/debian/patches/disable-power10.patch
index 71f8bdc..b09cd94 100644
--- a/debian/patches/disable-power10.patch
+++ b/debian/patches/disable-power10.patch
@@ -5,7 +5,7 @@ Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
--- a/cmake/onnxruntime_mlas.cmake
+++ b/cmake/onnxruntime_mlas.cmake
-@@ -377,7 +377,8 @@
+@@ -452,7 +452,8 @@
set_source_files_properties(${MLAS_SRC_DIR}/power/QuantizePowerVSX.cpp PROPERTIES COMPILE_FLAGS "-mcpu=power9")
endif()
diff --git a/debian/patches/disable-propagate-nan-in-eigen3.patch b/debian/patches/disable-propagate-nan-in-eigen3.patch
new file mode 100644
index 0000000..483b75e
--- /dev/null
+++ b/debian/patches/disable-propagate-nan-in-eigen3.patch
@@ -0,0 +1,104 @@
+Author: Shengqi Chen <harry-chen at outlook.com>
+Description: Fix compilation with Eigen 3.4.0
+ onnxruntime >= 1.19.0 invokes eigen3 with PropagateNaN, which is not supported in eigen 3.4.0.
+ This patch removes PropagateNaN from code.
+ See: https://github.com/microsoft/onnxruntime/commit/7543dd040b2d32109a2718d7276d3aca1edadaae
+ See: https://gitlab.com/libeigen/eigen/-/commit/5d918b82a80118ebb19572770a0c8e1f5fe06b91
+Forwarded: not-needed
+
+--- a/onnxruntime/core/providers/cpu/math/element_wise_ops.cc
++++ b/onnxruntime/core/providers/cpu/math/element_wise_ops.cc
+@@ -813,7 +813,7 @@
+ for (int index = 1; index < inputCount; index++) {
+ auto& data_n = *ctx->Input<Tensor>(index);
+ ORT_ENFORCE(data_n.Shape() == shape, "All inputs must have the same shape");
+- min = min.array().template min<Eigen::PropagateNaN>(EigenMap<float>(data_n).array());
++ min = min.array().min(EigenMap<float>(data_n).array());
+ }
+
+ return Status::OK();
+@@ -829,15 +829,15 @@
+ ProcessBroadcastSpanFuncs funcs{
+ [](BroadcastHelper& per_iter_bh) {
+ per_iter_bh.OutputEigen<T>() =
+- per_iter_bh.EigenInput1<T>().array().template min<Eigen::PropagateNaN>(per_iter_bh.ScalarInput0<T>());
++ per_iter_bh.EigenInput1<T>().array().min(per_iter_bh.ScalarInput0<T>());
+ },
+ [](BroadcastHelper& per_iter_bh) {
+ per_iter_bh.OutputEigen<T>() =
+- per_iter_bh.EigenInput0<T>().array().template min<Eigen::PropagateNaN>(per_iter_bh.ScalarInput1<T>());
++ per_iter_bh.EigenInput0<T>().array().min(per_iter_bh.ScalarInput1<T>());
+ },
+ [](BroadcastHelper& per_iter_bh) {
+ per_iter_bh.OutputEigen<T>() =
+- per_iter_bh.EigenInput0<T>().array().template min<Eigen::PropagateNaN>(
++ per_iter_bh.EigenInput0<T>().array().min(
+ per_iter_bh.EigenInput1<T>().array());
+ }};
+
+@@ -865,10 +865,10 @@
+ EigenVectorArrayMap<Eigen::half> output_vec_map(output, num_elements);
+
+ if (is_min) {
+- output_vec_map = input_1_vec_map.template min<Eigen::PropagateNaN>(
++ output_vec_map = input_1_vec_map.min(
+ static_cast<Eigen::half>(per_iter_bh.ScalarInput0<MLFloat16>()));
+ } else {
+- output_vec_map = input_1_vec_map.template max<Eigen::PropagateNaN>(
++ output_vec_map = input_1_vec_map.max(
+ static_cast<Eigen::half>(per_iter_bh.ScalarInput0<MLFloat16>()));
+ }
+ },
+@@ -882,10 +882,10 @@
+ EigenVectorArrayMap<Eigen::half> output_vec_map(output, num_elements);
+
+ if (is_min) {
+- output_vec_map = input_0_vec_map.template min<Eigen::PropagateNaN>(
++ output_vec_map = input_0_vec_map.min(
+ static_cast<Eigen::half>(per_iter_bh.ScalarInput1<MLFloat16>()));
+ } else {
+- output_vec_map = input_0_vec_map.template max<Eigen::PropagateNaN>(
++ output_vec_map = input_0_vec_map.max(
+ static_cast<Eigen::half>(per_iter_bh.ScalarInput1<MLFloat16>()));
+ }
+ },
+@@ -902,9 +902,9 @@
+ EigenVectorArrayMap<Eigen::half> output_vec_map(output, num_elements);
+
+ if (is_min) {
+- output_vec_map = input_0_vec_map.template min<Eigen::PropagateNaN>(input_1_vec_map);
++ output_vec_map = input_0_vec_map.min(input_1_vec_map);
+ } else {
+- output_vec_map = input_0_vec_map.template max<Eigen::PropagateNaN>(input_1_vec_map);
++ output_vec_map = input_0_vec_map.max(input_1_vec_map);
+ }
+ }};
+
+@@ -940,7 +940,7 @@
+ for (int index = 1; index < inputCount; index++) {
+ auto& data_n = *ctx->Input<Tensor>(index);
+ ORT_ENFORCE(data_n.Shape() == shape, "All inputs must have the same shape");
+- max = max.array().template max<Eigen::PropagateNaN>(EigenMap<float>(data_n).array());
++ max = max.array().max(EigenMap<float>(data_n).array());
+ }
+
+ return Status::OK();
+@@ -956,15 +956,15 @@
+ ProcessBroadcastSpanFuncs funcs{
+ [](BroadcastHelper& per_iter_bh) {
+ per_iter_bh.OutputEigen<T>() =
+- per_iter_bh.EigenInput1<T>().array().template max<Eigen::PropagateNaN>(per_iter_bh.ScalarInput0<T>());
++ per_iter_bh.EigenInput1<T>().array().max(per_iter_bh.ScalarInput0<T>());
+ },
+ [](BroadcastHelper& per_iter_bh) {
+ per_iter_bh.OutputEigen<T>() =
+- per_iter_bh.EigenInput0<T>().array().template max<Eigen::PropagateNaN>(per_iter_bh.ScalarInput1<T>());
++ per_iter_bh.EigenInput0<T>().array().max(per_iter_bh.ScalarInput1<T>());
+ },
+ [](BroadcastHelper& per_iter_bh) {
+ per_iter_bh.OutputEigen<T>() =
+- per_iter_bh.EigenInput0<T>().array().template max<Eigen::PropagateNaN>(
++ per_iter_bh.EigenInput0<T>().array().max(
+ per_iter_bh.EigenInput1<T>().array());
+ }};
+
diff --git a/debian/patches/fix-compilation-g++-14.patch b/debian/patches/fix-compilation-g++-14.patch
new file mode 100644
index 0000000..8216f4f
--- /dev/null
+++ b/debian/patches/fix-compilation-g++-14.patch
@@ -0,0 +1,75 @@
+Author: Shengqi Chen <harry at debian.org>
+Description: Fix compilation with latest GCC
+ See also https://github.com/microsoft/onnxruntime/issues/23954
+Forwarded: no
+
+--- a/onnxruntime/core/session/inference_session.cc
++++ b/onnxruntime/core/session/inference_session.cc
+@@ -391,7 +391,10 @@
+ const auto disabled_list = utils::SplitString(disabled_string, ";");
+ InlinedHashSet<std::string> disabled_rules_and_transformers;
+ disabled_rules_and_transformers.reserve(disabled_list.size());
+- disabled_rules_and_transformers.insert(disabled_list.cbegin(), disabled_list.cend());
++ // disabled_rules_and_transformers.insert(disabled_list.cbegin(), disabled_list.cend());
++ for (const auto& rule : disabled_list) {
++ disabled_rules_and_transformers.insert(std::string(rule));
++ }
+ ORT_THROW_IF_ERROR(FilterEnabledOptimizers(std::move(disabled_rules_and_transformers)));
+ }
+ }
+--- a/onnxruntime/test/providers/base_tester.h
++++ b/onnxruntime/test/providers/base_tester.h
+@@ -54,7 +54,11 @@
+
+ // Dims variant is needed to reduce the number of overloads
+ // MS compiler refuses to create a gsl::span from initializer_list especially if it contains a single element
++#if DISABLE_ABSEIL
++ using DimsVariant = std::variant<std::vector<int64_t>>;
++#else
+ using DimsVariant = std::variant<std::vector<int64_t>, TensorShapeVector>;
++#endif
+
+ template <typename T>
+ void AddInput(const char* name, std::initializer_list<int64_t> dims, std::initializer_list<T> values,
+@@ -771,7 +775,11 @@
+ bool testing_function_called_{}; // has the function that performs the actual testing been called yet?
+
+ gsl::span<const int64_t> ToDimsSpan(const DimsVariant& dims_var) {
++#if DISABLE_ABSEIL
++ return gsl::span<const int64_t>(std::get<0>(dims_var));
++#else
+ return std::visit([](auto&& dims) { return gsl::span<const int64_t>(dims); }, dims_var);
++#endif
+ }
+
+ template <typename T>
+--- a/onnxruntime/contrib_ops/cpu/utils/console_dumper.h
++++ b/onnxruntime/contrib_ops/cpu/utils/console_dumper.h
+@@ -3,6 +3,7 @@
+
+ #pragma once
+ #include <string>
++#include <iostream>
+ #include "core/framework/ort_value.h"
+ #include "core/framework/float16.h"
+ #include "contrib_ops/cpu/utils/debug_macros.h"
+--- a/onnxruntime/core/framework/resource_accountant.cc
++++ b/onnxruntime/core/framework/resource_accountant.cc
+@@ -147,8 +147,8 @@
+ size_t initializers_sizes = SafeInt<size_t>(std::stoull(std::string{splits[2]}));
+ size_t total_dynamic_sizes = SafeInt<size_t>(std::stoull(std::string{splits[3]}));
+ size_t total_temp_allocations = SafeInt<size_t>(std::stoull(std::string{splits[4]}));
+- node_stats.insert_or_assign(std::move(node_name), {input_sizes, initializers_sizes,
+- total_dynamic_sizes, total_temp_allocations});
++ const NodeAllocationStats stats = {input_sizes, initializers_sizes, total_dynamic_sizes, total_temp_allocations};
++ node_stats.insert_or_assign(std::move(node_name), stats);
+ }
+
+ result.swap(node_stats);
+@@ -224,4 +224,4 @@
+ return result;
+ }
+
+-} // namespace onnxruntime
+\ No newline at end of file
++} // namespace onnxruntime
diff --git a/debian/patches/fix-cxx20-template-constructor.patch b/debian/patches/fix-cxx20-template-constructor.patch
deleted file mode 100644
index 112bd16..0000000
--- a/debian/patches/fix-cxx20-template-constructor.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Description: Fix C++20 template constructor
-Forwarded: https://github.com/microsoft/onnxruntime/pull/21057
-Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/fix-cxx20-template-constructor.patch
-Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
-
---- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h
-+++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h
-@@ -326,11 +326,11 @@
- template <typename InputType, typename ThresholdType, typename OutputType>
- class TreeAggregatorMax : public TreeAggregator<InputType, ThresholdType, OutputType> {
- public:
-- TreeAggregatorMax<InputType, ThresholdType, OutputType>(size_t n_trees,
-- const int64_t& n_targets_or_classes,
-- POST_EVAL_TRANSFORM post_transform,
-- const std::vector<ThresholdType>& base_values) : TreeAggregator<InputType, ThresholdType, OutputType>(n_trees, n_targets_or_classes,
-- post_transform, base_values) {}
-+ TreeAggregatorMax(size_t n_trees,
-+ const int64_t& n_targets_or_classes,
-+ POST_EVAL_TRANSFORM post_transform,
-+ const std::vector<ThresholdType>& base_values) : TreeAggregator<InputType, ThresholdType, OutputType>(n_trees, n_targets_or_classes,
-+ post_transform, base_values) {}
-
- // 1 output
-
diff --git a/debian/patches/fix_forward_decl_flatbuffers.patch b/debian/patches/fix_forward_decl_flatbuffers.patch
deleted file mode 100644
index 98d86b3..0000000
--- a/debian/patches/fix_forward_decl_flatbuffers.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-Description: Fix compilation with newer flatbuffers
-Forwarded: https://github.com/microsoft/onnxruntime/pull/17164
-Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/fix_forward_decl_flatbuffers.patch
-Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
-Bug-Debian: https://bugs.debian.org/1076959
-
-diff --git a/include/onnxruntime/core/graph/graph.h b/include/onnxruntime/core/graph/graph.h
-index 81015b25bc..9ae5b130b4 100644
---- a/include/onnxruntime/core/graph/graph.h
-+++ b/include/onnxruntime/core/graph/graph.h
-@@ -43,8 +43,9 @@
- #include "core/graph/node_arg.h"
- #include "core/graph/ort_format_load_options.h"
-
-+#include <flatbuffers/flatbuffer_builder.h>
-+
- namespace flatbuffers {
--class FlatBufferBuilder;
- template <typename T>
- struct Offset;
- } // namespace flatbuffers
-diff --git a/onnxruntime/core/flatbuffers/flatbuffers_utils.h b/onnxruntime/core/flatbuffers/flatbuffers_utils.h
-index 4e7db4df9a..e4e100c129 100644
---- a/onnxruntime/core/flatbuffers/flatbuffers_utils.h
-+++ b/onnxruntime/core/flatbuffers/flatbuffers_utils.h
-@@ -8,22 +8,13 @@
- #include "core/common/common.h"
- #include "core/common/path_string.h"
- #include "core/common/status.h"
-+#include <flatbuffers/vector.h>
-+#include <flatbuffers/flatbuffer_builder.h>
-
- namespace ONNX_NAMESPACE {
- class ValueInfoProto;
- }
-
--namespace flatbuffers {
--class FlatBufferBuilder;
--
--template <typename T>
--struct Offset;
--
--struct String;
--
--template <typename T>
--class Vector;
--} // namespace flatbuffers
-
- namespace onnxruntime {
-
-@@ -57,7 +48,7 @@ onnxruntime::common::Status LoadValueInfoOrtFormat(
- const fbs::ValueInfo& fbs_value_info, ONNX_NAMESPACE::ValueInfoProto& value_info_proto);
-
- onnxruntime::common::Status LoadOpsetImportOrtFormat(
-- const flatbuffers::Vector<flatbuffers::Offset<fbs::OperatorSetId>>* fbs_op_set_ids,
-+ const flatbuffers::Vector<flatbuffers::Offset<fbs::OperatorSetId>, uint32_t>* fbs_op_set_ids,
- std::unordered_map<std::string, int>& domain_to_version);
-
- // check if filename ends in .ort
-diff --git a/onnxruntime/core/framework/kernel_type_str_resolver.h b/onnxruntime/core/framework/kernel_type_str_resolver.h
-index 75fc2fa894..e029e5cdae 100644
---- a/onnxruntime/core/framework/kernel_type_str_resolver.h
-+++ b/onnxruntime/core/framework/kernel_type_str_resolver.h
-@@ -17,9 +17,9 @@
- #include "core/graph/op_identifier.h"
- #include "core/graph/graph.h"
- #include "core/platform/ort_mutex.h"
-+#include <flatbuffers/flatbuffer_builder.h>
-
- namespace flatbuffers {
--class FlatBufferBuilder;
- template <typename T>
- struct Offset;
- } // namespace flatbuffers
-diff --git a/onnxruntime/core/framework/session_state.h b/onnxruntime/core/framework/session_state.h
-index d546f264a9..5741a78489 100644
---- a/onnxruntime/core/framework/session_state.h
-+++ b/onnxruntime/core/framework/session_state.h
-@@ -43,8 +43,9 @@
- #include "core/framework/program_region.h"
- #endif
-
-+#include <flatbuffers/flatbuffer_builder.h>
-+
- namespace flatbuffers {
--class FlatBufferBuilder;
- template <typename T>
- struct Offset;
- } // namespace flatbuffers
-diff --git a/onnxruntime/core/graph/graph_flatbuffers_utils.h b/onnxruntime/core/graph/graph_flatbuffers_utils.h
-index f4899ffc12..08b9345eee 100644
---- a/onnxruntime/core/graph/graph_flatbuffers_utils.h
-+++ b/onnxruntime/core/graph/graph_flatbuffers_utils.h
-@@ -8,6 +8,7 @@
- #include "core/common/status.h"
- #include "core/graph/ort_format_load_options.h"
- #include "core/framework/tensor.h"
-+#include <flatbuffers/flatbuffer_builder.h>
-
- namespace ONNX_NAMESPACE {
- class AttributeProto;
-@@ -19,7 +20,6 @@ class SparseTensorProto;
- } // namespace ONNX_NAMESPACE
-
- namespace flatbuffers {
--class FlatBufferBuilder;
- template <typename T>
- struct Offset;
- } // namespace flatbuffers
-diff --git a/onnxruntime/core/graph/model.h b/onnxruntime/core/graph/model.h
-index 5337211ae7..cb03cf9119 100644
---- a/onnxruntime/core/graph/model.h
-+++ b/onnxruntime/core/graph/model.h
-@@ -15,8 +15,9 @@
- #include "core/graph/function_template.h"
- #endif
-
-+#include <flatbuffers/flatbuffer_builder.h>
-+
- namespace flatbuffers {
--class FlatBufferBuilder;
- template <typename T>
- struct Offset;
- } // namespace flatbuffers
-diff --git a/onnxruntime/core/graph/op_identifier_utils.h b/onnxruntime/core/graph/op_identifier_utils.h
-index 265364a88d..4023a5edbf 100644
---- a/onnxruntime/core/graph/op_identifier_utils.h
-+++ b/onnxruntime/core/graph/op_identifier_utils.h
-@@ -9,8 +9,9 @@
- #include "core/graph/graph.h"
- #include "core/graph/onnx_protobuf.h"
-
-+#include <flatbuffers/flatbuffer_builder.h>
-+
- namespace flatbuffers {
--class FlatBufferBuilder;
-
- template <typename T>
- struct Offset;
-diff --git a/onnxruntime/core/graph/runtime_optimization_record_container.h b/onnxruntime/core/graph/runtime_optimization_record_container.h
-index 5db784f1a2..7fecf4a9c5 100644
---- a/onnxruntime/core/graph/runtime_optimization_record_container.h
-+++ b/onnxruntime/core/graph/runtime_optimization_record_container.h
-@@ -12,12 +12,12 @@
- #include "core/common/common.h"
- #include "core/graph/runtime_optimization_record.h"
-
-+#include <flatbuffers/flatbuffer_builder.h>
-+#include <flatbuffers/vector.h>
-+
- namespace flatbuffers {
--class FlatBufferBuilder;
- template <typename T>
- struct Offset;
--template <typename T>
--class Vector;
- } // namespace flatbuffers
-
- namespace onnxruntime {
diff --git a/debian/patches/gcc-false-positive.patch b/debian/patches/gcc-false-positive.patch
index c3f0c67..d6097be 100644
--- a/debian/patches/gcc-false-positive.patch
+++ b/debian/patches/gcc-false-positive.patch
@@ -35,4 +35,4 @@ Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
+
#include "core/optimizer/selectors_actions/selector_action_transformer.h"
- #include <cassert>
+ #include <algorithm>
diff --git a/debian/patches/no-nsync.patch b/debian/patches/no-nsync.patch
deleted file mode 100644
index 180d680..0000000
--- a/debian/patches/no-nsync.patch
+++ /dev/null
@@ -1,210 +0,0 @@
-Description: Replace the use of nsync by pthread
-Forwarded: not-needed
-Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/no-nsync.patch
-
---- a/cmake/CMakeLists.txt
-+++ b/cmake/CMakeLists.txt
-@@ -922,7 +922,7 @@
- target_compile_options(${target_name} PRIVATE "-Wno-unused-parameter")
- endif()
- target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11)
-- onnxruntime_add_include_to_target(${target_name} nsync::nsync_cpp)
-+# onnxruntime_add_include_to_target(${target_name} nsync::nsync_cpp)
- endif()
- foreach(ORT_FLAG ${ORT_PROVIDER_FLAGS})
- target_compile_definitions(${target_name} PRIVATE ${ORT_FLAG})
-@@ -1574,7 +1574,7 @@
- list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${SYS_PATH_LIB})
- list(APPEND onnxruntime_EXTERNAL_LIBRARIES debug Dbghelp)
- else()
-- list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp)
-+# list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp)
- list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${ICONV_LIB} ${CMAKE_DL_LIBS} Threads::Threads)
- endif()
-
---- a/cmake/external/onnxruntime_external_deps.cmake
-+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -64,7 +64,7 @@
- )
- endif()
-
--if (NOT WIN32)
-+if (FALSE AND NOT WIN32)
- FetchContent_Declare(
- google_nsync
- URL ${DEP_URL_google_nsync}
-@@ -270,7 +270,7 @@
- onnxruntime_fetchcontent_makeavailable(google_benchmark)
- endif()
-
--if (NOT WIN32)
-+if (FALSE AND NOT WIN32)
- #nsync tests failed on Mac Build
- set(NSYNC_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
- onnxruntime_fetchcontent_makeavailable(google_nsync)
---- a/cmake/onnxruntime_mlas.cmake
-+++ b/cmake/onnxruntime_mlas.cmake
-@@ -613,7 +613,7 @@
- target_link_libraries(onnxruntime_mlas_q4dq PRIVATE cpuinfo)
- endif()
- if(NOT WIN32)
-- target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
-+# target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
- endif()
- if (CMAKE_SYSTEM_NAME STREQUAL "Android")
- target_link_libraries(onnxruntime_mlas_q4dq PRIVATE ${android_shared_libs})
---- a/cmake/onnxruntime_unittests.cmake
-+++ b/cmake/onnxruntime_unittests.cmake
-@@ -697,7 +697,7 @@
- else()
- target_compile_definitions(onnxruntime_test_utils PUBLIC -DNSYNC_ATOMIC_CPP11)
- target_include_directories(onnxruntime_test_utils PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT})
-- onnxruntime_add_include_to_target(onnxruntime_test_utils nsync::nsync_cpp)
-+ # onnxruntime_add_include_to_target(onnxruntime_test_utils nsync::nsync_cpp)
- endif()
- if (onnxruntime_USE_NCCL)
- target_include_directories(onnxruntime_test_utils PRIVATE ${NCCL_INCLUDE_DIRS})
-@@ -732,7 +732,7 @@
- else()
- target_compile_definitions(onnx_test_runner_common PUBLIC -DNSYNC_ATOMIC_CPP11)
- target_include_directories(onnx_test_runner_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT})
-- onnxruntime_add_include_to_target(onnx_test_runner_common nsync::nsync_cpp)
-+ # onnxruntime_add_include_to_target(onnx_test_runner_common nsync::nsync_cpp)
- endif()
- if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
- #TODO: fix the warnings, they are dangerous
-@@ -1119,7 +1119,7 @@
- # "Global initializer calls a non-constexpr function." BENCHMARK_CAPTURE macro needs this.
- target_compile_options(onnxruntime_mlas_benchmark PRIVATE /wd26426)
- else()
-- target_link_libraries(onnxruntime_mlas_benchmark PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
-+# target_link_libraries(onnxruntime_mlas_benchmark PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
- endif()
- if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
- target_link_libraries(onnxruntime_mlas_benchmark PRIVATE cpuinfo)
-@@ -1196,7 +1196,7 @@
- ${onnxruntime_EXTERNAL_LIBRARIES}
- ${GETOPT_LIB_WIDE} ${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
- if(NOT WIN32)
-- list(APPEND onnxruntime_perf_test_libs nsync::nsync_cpp)
-+ #list(APPEND onnxruntime_perf_test_libs nsync::nsync_cpp)
- if(onnxruntime_USE_SNPE)
- list(APPEND onnxruntime_perf_test_libs onnxruntime_providers_snpe)
- endif()
-@@ -1240,7 +1240,7 @@
- # test inference using shared lib
- set(onnxruntime_shared_lib_test_LIBS onnxruntime_mocked_allocator onnxruntime_test_utils onnxruntime_common onnx_proto)
- if(NOT WIN32)
-- list(APPEND onnxruntime_shared_lib_test_LIBS nsync::nsync_cpp)
-+ #list(APPEND onnxruntime_shared_lib_test_LIBS nsync::nsync_cpp)
- if(onnxruntime_USE_SNPE)
- list(APPEND onnxruntime_shared_lib_test_LIBS onnxruntime_providers_snpe)
- endif()
-@@ -1367,9 +1367,9 @@
- if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
- target_link_libraries(onnxruntime_mlas_test PRIVATE cpuinfo)
- endif()
-- if(NOT WIN32)
-- target_link_libraries(onnxruntime_mlas_test PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
-- endif()
-+ # if(NOT WIN32)
-+ # target_link_libraries(onnxruntime_mlas_test PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
-+ # endif()
- if (CMAKE_SYSTEM_NAME STREQUAL "Android")
- target_link_libraries(onnxruntime_mlas_test PRIVATE ${android_shared_libs})
- endif()
-@@ -1631,9 +1631,9 @@
-
- set(onnxruntime_logging_apis_test_LIBS onnxruntime_common onnxruntime_test_utils)
-
-- if(NOT WIN32)
-- list(APPEND onnxruntime_logging_apis_test_LIBS nsync::nsync_cpp ${CMAKE_DL_LIBS})
-- endif()
-+ #if(NOT WIN32)
-+ # list(APPEND onnxruntime_logging_apis_test_LIBS nsync::nsync_cpp ${CMAKE_DL_LIBS})
-+ #endif()
-
- AddTest(DYN
- TARGET onnxruntime_logging_apis_test
---- a/include/onnxruntime/core/platform/ort_mutex.h
-+++ b/include/onnxruntime/core/platform/ort_mutex.h
-@@ -102,13 +102,13 @@
- }
- } // namespace onnxruntime
- #else
--#include "nsync.h"
-+#include <pthread.h>
- #include <mutex> //for unique_lock
- #include <condition_variable> //for cv_status
- namespace onnxruntime {
-
- class OrtMutex {
-- nsync::nsync_mu data_ = NSYNC_MU_INIT;
-+ pthread_mutex_t data_ = PTHREAD_MUTEX_INITIALIZER;
-
- public:
- constexpr OrtMutex() = default;
-@@ -116,16 +116,16 @@
- OrtMutex(const OrtMutex&) = delete;
- OrtMutex& operator=(const OrtMutex&) = delete;
-
-- void lock() { nsync::nsync_mu_lock(&data_); }
-- bool try_lock() noexcept { return nsync::nsync_mu_trylock(&data_) == 0; }
-- void unlock() noexcept { nsync::nsync_mu_unlock(&data_); }
-+ void lock() { pthread_mutex_lock(&data_); }
-+ bool try_lock() noexcept { return pthread_mutex_lock(&data_) == 0; }
-+ void unlock() noexcept { pthread_mutex_unlock(&data_); }
-
-- using native_handle_type = nsync::nsync_mu*;
-+ using native_handle_type = pthread_mutex_t*;
- native_handle_type native_handle() { return &data_; }
- };
-
- class OrtCondVar {
-- nsync::nsync_cv native_cv_object = NSYNC_CV_INIT;
-+ pthread_cond_t native_cv_object = PTHREAD_COND_INITIALIZER;
-
- public:
- constexpr OrtCondVar() noexcept = default;
-@@ -134,8 +134,8 @@
- OrtCondVar(const OrtCondVar&) = delete;
- OrtCondVar& operator=(const OrtCondVar&) = delete;
-
-- void notify_one() noexcept { nsync::nsync_cv_signal(&native_cv_object); }
-- void notify_all() noexcept { nsync::nsync_cv_broadcast(&native_cv_object); }
-+ void notify_one() noexcept { pthread_cond_signal(&native_cv_object); }
-+ void notify_all() noexcept { pthread_cond_broadcast(&native_cv_object); }
-
- void wait(std::unique_lock<OrtMutex>& lk);
- template <class _Predicate>
-@@ -151,7 +151,7 @@
- */
- template <class Rep, class Period>
- std::cv_status wait_for(std::unique_lock<OrtMutex>& cond_mutex, const std::chrono::duration<Rep, Period>& rel_time);
-- using native_handle_type = nsync::nsync_cv*;
-+ using native_handle_type = pthread_cond_t*;
- native_handle_type native_handle() { return &native_cv_object; }
-
- private:
---- a/onnxruntime/core/platform/posix/ort_mutex.cc
-+++ b/onnxruntime/core/platform/posix/ort_mutex.cc
-@@ -27,7 +27,7 @@
- abs_deadline.tv_sec = ts_sec_max;
- abs_deadline.tv_nsec = 999999999;
- }
-- nsync::nsync_cv_wait_with_deadline(&native_cv_object, lk.mutex()->native_handle(), abs_deadline, nullptr);
-+ pthread_cond_timedwait(&native_cv_object, lk.mutex()->native_handle(), &abs_deadline);
- }
-
- void OrtCondVar::wait(std::unique_lock<OrtMutex>& lk) {
-@@ -36,7 +36,7 @@
- ORT_THROW("OrtCondVar wait failed: mutex not locked");
- }
- #endif
-- nsync::nsync_cv_wait(&native_cv_object, lk.mutex()->native_handle());
-+ pthread_cond_wait(&native_cv_object, lk.mutex()->native_handle());
- }
-
--} // namespace onnxruntime
-\ No newline at end of file
-+} // namespace onnxruntime
diff --git a/debian/patches/remove-wil.patch b/debian/patches/remove-wil.patch
index ee8df80..c0b696c 100644
--- a/debian/patches/remove-wil.patch
+++ b/debian/patches/remove-wil.patch
@@ -5,54 +5,43 @@ Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/remove-wil.pat
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -412,7 +412,7 @@
-
+@@ -508,7 +508,7 @@
+ find_package(wil CONFIG REQUIRED)
+ set(WIL_TARGET "WIL::WIL")
+ else()
+- include(wil) # FetchContent
++ # include(wil) # FetchContent
+ endif()
+ endif()
- include(eigen)
--include(wil)
-+#include(wil)
+@@ -536,7 +536,7 @@
+ endif()
+ endif()
- #if (NOT onnxruntime_MINIMAL_BUILD)
- # onnxruntime_fetchcontent_makeavailable(onnx)
-@@ -449,7 +449,7 @@
- #onnxruntime_EXTERNAL_LIBRARIES could contain onnx, onnx_proto,libprotobuf, cuda/cudnn,
- # dnnl/mklml, onnxruntime_codegen_tvm, tvm and pthread
- # pthread is always at the last
--set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} ${WIL_TARGET} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date_interface)
-+set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date_interface)
- # 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)
+-set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} ${WIL_TARGET} nlohmann_json::nlohmann_json
++set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} nlohmann_json::nlohmann_json
+ onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface
+ flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date::date
+ ${ONNXRUNTIME_CLOG_TARGET_NAME} Eigen3::Eigen)
--- a/cmake/onnxruntime_common.cmake
+++ b/cmake/onnxruntime_common.cmake
-@@ -121,7 +121,7 @@
+@@ -127,7 +127,7 @@
endif()
endif()
--onnxruntime_add_include_to_target(onnxruntime_common date_interface ${WIL_TARGET})
-+onnxruntime_add_include_to_target(onnxruntime_common date_interface)
+-onnxruntime_add_include_to_target(onnxruntime_common date::date ${WIL_TARGET} Eigen3::Eigen)
++onnxruntime_add_include_to_target(onnxruntime_common date::date Eigen3::Eigen)
target_include_directories(onnxruntime_common
- PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}
+ PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}
# propagate include directories of dependencies that are part of public interface
--- a/cmake/onnxruntime_graph.cmake
+++ b/cmake/onnxruntime_graph.cmake
-@@ -87,7 +87,7 @@
+@@ -96,7 +96,7 @@
- onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_lib_src})
+ onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_src} ${orttraining_graph_src})
add_dependencies(onnxruntime_graph onnx_proto flatbuffers::flatbuffers)
-onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common ${WIL_TARGET} onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers safeint_interface Boost::mp11)
+onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers safeint_interface Boost::mp11)
if (MSVC)
set(ONNX_PROTOBUF_NATVIS_FILE "onnx_protobuf.natvis")
---- a/cmake/onnxruntime_providers.cmake
-+++ b/cmake/onnxruntime_providers.cmake
-@@ -1283,7 +1283,7 @@
- source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_dml_cc_srcs})
- onnxruntime_add_static_library(onnxruntime_providers_dml ${onnxruntime_providers_dml_cc_srcs})
- onnxruntime_add_include_to_target(onnxruntime_providers_dml
-- onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers Boost::mp11 safeint_interface ${WIL_TARGET}
-+ onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers Boost::mp11 safeint_interface
- )
- add_dependencies(onnxruntime_providers_dml ${onnxruntime_EXTERNAL_DEPENDENCIES})
- target_include_directories(onnxruntime_providers_dml PRIVATE
diff --git a/debian/patches/series b/debian/patches/series
index 9515602..e0e4fd8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,21 +2,22 @@ system-flatbuffers.patch
system-protobuf.patch
system-onnx.patch
disable-power10.patch
-no-nsync.patch
remove-wil.patch
system-safeint.patch
-versioned-onnxruntime_providers_shared.patch
system-date-and-mp11.patch
system-cpuinfo.patch
system-python.patch
system-re2.patch
system-datadir.patch
system-benchmark.patch
-Disable-AVX-tests-on-non-AMD64.patch
+system-absl.patch
Disable-failing-tests-on-ARM32.patch
-fix-cxx20-template-constructor.patch
gcc-false-positive.patch
-fix_forward_decl_flatbuffers.patch
-
-17eaf9b053238b3efec303e9c94008201ca42462.patch
-Add-missing-include.patch
+disable-propagate-nan-in-eigen3.patch
+fix-compilation-g++-14.patch
+set-soversion.patch
+Skip_python_unit_tests.patch
+use-system-dnnl.patch
+use-system-xnnpack.patch
+use-system-dlpack.patch
+set-noexecstack-linker-flag.patch
diff --git a/debian/patches/set-noexecstack-linker-flag.patch b/debian/patches/set-noexecstack-linker-flag.patch
new file mode 100644
index 0000000..96dfee0
--- /dev/null
+++ b/debian/patches/set-noexecstack-linker-flag.patch
@@ -0,0 +1,21 @@
+Description: Add linker flag to disable executable stack (#1098205)
+Author: Aurelien Jarno <aurel32 at debian.org>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098205
+Last-Update: 2025-02-19
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/cmake/onnxruntime_python.cmake
++++ b/cmake/onnxruntime_python.cmake
+@@ -116,10 +116,10 @@
+ target_link_options(onnxruntime_pybind11_state PRIVATE "LINKER:-exported_symbols_list,${ONNXRUNTIME_ROOT}/python/exported_symbols.lst")
+ elseif(UNIX)
+ if (onnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS)
+- target_link_options(onnxruntime_pybind11_state PRIVATE "LINKER:--version-script=${ONNXRUNTIME_ROOT}/python/version_script_expose_onnx_protobuf.lds" "LINKER:--gc-sections")
++ target_link_options(onnxruntime_pybind11_state PRIVATE "LINKER:--version-script=${ONNXRUNTIME_ROOT}/python/version_script_expose_onnx_protobuf.lds" "LINKER:--gc-sections" "LINKER:-z noexecstack")
+ else()
+ if (NOT CMAKE_SYSTEM_NAME MATCHES "AIX")
+- target_link_options(onnxruntime_pybind11_state PRIVATE "LINKER:--version-script=${ONNXRUNTIME_ROOT}/python/version_script.lds" "LINKER:--gc-sections")
++ target_link_options(onnxruntime_pybind11_state PRIVATE "LINKER:--version-script=${ONNXRUNTIME_ROOT}/python/version_script.lds" "LINKER:--gc-sections" "LINKER:-z noexecstack")
+ endif()
+ endif()
+ else()
diff --git a/debian/patches/set-soversion.patch b/debian/patches/set-soversion.patch
new file mode 100644
index 0000000..e5776bf
--- /dev/null
+++ b/debian/patches/set-soversion.patch
@@ -0,0 +1,32 @@
+Description: set SOVERSION for shared library. Upstream has simplified the
+ SONAME without saying anything about the API/ABI stability, see:
+ https://github.com/microsoft/onnxruntime/pull/21339
+ Until it's clarified let's reuse the previous behavior to avoid unexpected
+ breakage. This will require transition for every release, but it's safer.
+Author: Shengqi Chen <harry-chen at outlook.com>
+Forwarded: not-needed
+
+--- a/cmake/onnxruntime.cmake
++++ b/cmake/onnxruntime.cmake
+@@ -63,9 +63,11 @@
+ endforeach()
+
+ if(NOT CMAKE_SYSTEM_NAME MATCHES "AIX")
++set(ORT_SOVERSION_NUMBER_FILE "${CMAKE_CURRENT_BINARY_DIR}/VERSION_NUMBER")
++file(WRITE "${ORT_SOVERSION_NUMBER_FILE}" "${VERSION_MAJOR_PART}.${VERSION_MINOR_PART}")
+ add_custom_command(OUTPUT ${SYMBOL_FILE} ${CMAKE_CURRENT_BINARY_DIR}/generated_source.c
+ COMMAND ${Python_EXECUTABLE} "${REPO_ROOT}/tools/ci_build/gen_def.py"
+- --version_file "${ONNXRUNTIME_ROOT}/../VERSION_NUMBER" --src_root "${ONNXRUNTIME_ROOT}"
++ --version_file "${ORT_SOVERSION_NUMBER_FILE}" --src_root "${ONNXRUNTIME_ROOT}"
+ --config ${ONNXRUNTIME_PROVIDER_NAMES} --style=${OUTPUT_STYLE} --output ${SYMBOL_FILE}
+ --output_source ${CMAKE_CURRENT_BINARY_DIR}/generated_source.c
+ DEPENDS ${SYMBOL_FILES}
+@@ -272,7 +274,7 @@
+ PUBLIC_HEADER "${ONNXRUNTIME_PUBLIC_HEADERS}"
+ LINK_DEPENDS ${SYMBOL_FILE}
+ VERSION ${ORT_VERSION}
+- SOVERSION 1
++ SOVERSION "${VERSION_MAJOR_PART}.${VERSION_MINOR_PART}"
+ FOLDER "ONNXRuntime")
+ endif()
+ else()
diff --git a/debian/patches/system-absl.patch b/debian/patches/system-absl.patch
new file mode 100644
index 0000000..22ba435
--- /dev/null
+++ b/debian/patches/system-absl.patch
@@ -0,0 +1,15 @@
+Description: Use system absl lib (libabsl-dev), not yet enabled
+Forwarded: not-needed
+Author: Shengqi Chen <harry-chen at outlook.com>
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -31,7 +31,7 @@
+ include(FetchContent)
+
+ # ABSL should be included before protobuf because protobuf may use absl
+-include(external/abseil-cpp.cmake)
++find_package(absl)
+
+ set(RE2_BUILD_TESTING OFF CACHE BOOL "" FORCE)
+
diff --git a/debian/patches/system-benchmark.patch b/debian/patches/system-benchmark.patch
index c1c520f..8403612 100644
--- a/debian/patches/system-benchmark.patch
+++ b/debian/patches/system-benchmark.patch
@@ -1,15 +1,22 @@
-Description: Use system benchmark lib (libbenchmark-dev)
+Description: Use system benchmark lib (libbenchmark-dev), not enabled
Forwarded: not-needed
Author: Dylan Aïssi <daissi at debian.org>
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -274,7 +274,7 @@
+@@ -79,14 +79,7 @@
+ # We will not need to install benchmark since we link it statically.
+ set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable benchmark install to avoid overwriting vendor install.")
-
- if (onnxruntime_BUILD_BENCHMARKS)
+- onnxruntime_fetchcontent_declare(
+- google_benchmark
+- URL ${DEP_URL_google_benchmark}
+- URL_HASH SHA1=${DEP_SHA1_google_benchmark}
+- EXCLUDE_FROM_ALL
+- FIND_PACKAGE_ARGS NAMES benchmark
+- )
- onnxruntime_fetchcontent_makeavailable(google_benchmark)
-+ find_package(benchmark REQUIRED)
++ find_package(benchmark)
endif()
- if (FALSE AND NOT WIN32)
+
diff --git a/debian/patches/system-cpuinfo.patch b/debian/patches/system-cpuinfo.patch
index 34a4077..7d90a59 100644
--- a/debian/patches/system-cpuinfo.patch
+++ b/debian/patches/system-cpuinfo.patch
@@ -4,29 +4,36 @@ Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-cpuinfo
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -382,13 +382,7 @@
+@@ -330,31 +330,7 @@
+ endif()
- if (CPUINFO_SUPPORTED)
-- onnxruntime_fetchcontent_makeavailable(pytorch_cpuinfo)
-- if (pytorch_cpuinfo_SOURCE_DIR)
-- # shouldn't need to define these aliases after we use a version of cpuinfo with this commit:
-- # https://github.com/pytorch/cpuinfo/commit/082deffc80ce517f81dc2f3aebe6ba671fcd09c9
-- add_library(cpuinfo::cpuinfo ALIAS cpuinfo)
-- add_library(cpuinfo::clog ALIAS clog)
+- set(CPUINFO_BUILD_TOOLS OFF CACHE INTERNAL "")
+- set(CPUINFO_BUILD_UNIT_TESTS OFF CACHE INTERNAL "")
+- set(CPUINFO_BUILD_MOCK_TESTS OFF CACHE INTERNAL "")
+- set(CPUINFO_BUILD_BENCHMARKS OFF CACHE INTERNAL "")
+- if (onnxruntime_target_platform STREQUAL "ARM64EC" OR onnxruntime_target_platform STREQUAL "ARM64")
+- message(STATUS "Applying a patch for Windows ARM64/ARM64EC in cpuinfo")
+- onnxruntime_fetchcontent_declare(
+- pytorch_cpuinfo
+- URL ${DEP_URL_pytorch_cpuinfo}
+- URL_HASH SHA1=${DEP_SHA1_pytorch_cpuinfo}
+- EXCLUDE_FROM_ALL
+- PATCH_COMMAND ${Patch_EXECUTABLE} -p1 < ${PROJECT_SOURCE_DIR}/patches/cpuinfo/9bb12d342fd9479679d505d93a478a6f9cd50a47.patch
+- FIND_PACKAGE_ARGS NAMES cpuinfo
+- )
+- else()
+- onnxruntime_fetchcontent_declare(
+- pytorch_cpuinfo
+- URL ${DEP_URL_pytorch_cpuinfo}
+- URL_HASH SHA1=${DEP_SHA1_pytorch_cpuinfo}
+- EXCLUDE_FROM_ALL
+- FIND_PACKAGE_ARGS NAMES cpuinfo
+- )
- endif()
+- set(ONNXRUNTIME_CPUINFO_PROJ pytorch_cpuinfo)
+- onnxruntime_fetchcontent_makeavailable(${ONNXRUNTIME_CPUINFO_PROJ})
+ find_package(cpuinfo REQUIRED)
- endif()
-
-
---- a/cmake/onnxruntime_common.cmake
-+++ b/cmake/onnxruntime_common.cmake
-@@ -208,7 +208,7 @@
- # Its functionality in detecting x86 cpu features are lacking, so is support for Windows.
- if (CPUINFO_SUPPORTED)
- onnxruntime_add_include_to_target(onnxruntime_common cpuinfo::cpuinfo)
-- list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::cpuinfo cpuinfo::clog)
-+ list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo::cpuinfo)
- endif()
- endif()
- endif()
+ if(TARGET cpuinfo::cpuinfo AND NOT TARGET cpuinfo)
+ message(STATUS "Aliasing cpuinfo::cpuinfo to cpuinfo")
+ add_library(cpuinfo ALIAS cpuinfo::cpuinfo)
diff --git a/debian/patches/system-datadir.patch b/debian/patches/system-datadir.patch
index de931d5..a9805ec 100644
--- a/debian/patches/system-datadir.patch
+++ b/debian/patches/system-datadir.patch
@@ -4,16 +4,16 @@ Author: Andre Moreira Magalhaes <andrunko at gmail.com>
--- a/cmake/onnxruntime_unittests.cmake
+++ b/cmake/onnxruntime_unittests.cmake
-@@ -909,7 +909,7 @@
- onnxruntime_add_include_to_target(onnx_test_data_proto onnx_proto)
- target_include_directories(onnx_test_data_proto PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
- set_target_properties(onnx_test_data_proto PROPERTIES FOLDER "ONNXRuntimeTest")
+@@ -1024,7 +1024,7 @@
+ if(NOT DEFINED onnx_SOURCE_DIR)
+ find_path(onnx_SOURCE_DIR NAMES "onnx/onnx-ml.proto3" "onnx/onnx-ml.proto" REQUIRED)
+ endif()
-onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${onnx_SOURCE_DIR} TARGET onnx_test_data_proto)
+onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${onnxruntime_ONNX_PROTO_DATA_DIR} TARGET onnx_test_data_proto)
#
# onnxruntime_ir_graph test data
-@@ -1133,9 +1133,9 @@
+@@ -1205,9 +1205,9 @@
if (NOT onnxruntime_REDUCED_OPS_BUILD AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
add_test(NAME onnx_test_pytorch_converted
@@ -27,13 +27,13 @@ Author: Andre Moreira Magalhaes <andrunko at gmail.com>
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
-@@ -104,6 +104,9 @@
+@@ -115,6 +115,9 @@
option(onnxruntime_GCOV_COVERAGE "Compile with options necessary to run code coverage" OFF)
option(onnxruntime_DONT_VECTORIZE "Do not vectorize operations in Eigen" OFF)
+option(onnxruntime_ONNX_PROTO_DATA_DIR "Path where onnx/onnx-data.proto is located in your system, only used when onnxruntime_PREFER_SYSTEM_LIB is set")
+option(onnxruntime_ONNX_TEST_DATA_DIR "Path where onnx's pytorch-converted|operator test data in your system, only used when onnxruntime_PREFER_SYSTEM_LIB is set")
+
- #It's preferred to turn it OFF when onnxruntime is dynamically linked to PROTOBUF. But Tensort always required the full version of protobuf.
- cmake_dependent_option(onnxruntime_USE_FULL_PROTOBUF "Link to libprotobuf instead of libprotobuf-lite when this option is ON" OFF "NOT onnxruntime_USE_TENSORRT" ON)
- option(tensorflow_C_PACKAGE_PATH "Path to tensorflow C package installation dir")
+ option(onnxruntime_USE_FULL_PROTOBUF "Link to libprotobuf instead of libprotobuf-lite when this option is ON" OFF)
+ option(onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS "Dump debug information about node inputs and outputs when executing the model." OFF)
+ cmake_dependent_option(onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS_ENABLE_DUMP_TO_SQLDB "Build dump debug information about node inputs and outputs with support for sql database." OFF "onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS" OFF)
diff --git a/debian/patches/system-date-and-mp11.patch b/debian/patches/system-date-and-mp11.patch
index 177eb1b..df7f3ba 100644
--- a/debian/patches/system-date-and-mp11.patch
+++ b/debian/patches/system-date-and-mp11.patch
@@ -4,102 +4,23 @@ Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-date-an
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -169,20 +169,8 @@
- set(ENABLE_DATE_TESTING OFF CACHE BOOL "" FORCE)
- set(USE_SYSTEM_TZ_DB ON CACHE BOOL "" FORCE)
-
--FetchContent_Declare(
-- date
-- URL ${DEP_URL_date}
-- URL_HASH SHA1=${DEP_SHA1_date}
-- )
+@@ -247,7 +247,8 @@
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS 3...<4 NAMES date
+ )
-onnxruntime_fetchcontent_makeavailable(date)
--
--
--
--FetchContent_Declare(
-- mp11
-- URL ${DEP_URL_mp11}
-- URL_HASH SHA1=${DEP_SHA1_mp11}
--)
-+find_package(date)
-+find_package(Boost COMPONENTS mp11)
-
- set(JSON_BuildTests OFF CACHE INTERNAL "")
- set(JSON_Install OFF CACHE INTERNAL "")
-@@ -297,7 +285,7 @@
- endif()
-
- # The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
--onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 GSL flatbuffers)
-+onnxruntime_fetchcontent_makeavailable(nlohmann_json re2 GSL flatbuffers)
- if(NOT flatbuffers_FOUND)
- if(NOT TARGET flatbuffers::flatbuffers)
- add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
-@@ -443,7 +431,7 @@
- #onnxruntime_EXTERNAL_LIBRARIES could contain onnx, onnx_proto,libprotobuf, cuda/cudnn,
- # dnnl/mklml, onnxruntime_codegen_tvm, tvm and pthread
- # pthread is always at the last
--set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date_interface)
-+set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::boost safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date::date)
- # 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)
---- a/cmake/onnxruntime_common.cmake
-+++ b/cmake/onnxruntime_common.cmake
-@@ -121,7 +121,7 @@
- endif()
- endif()
-
--onnxruntime_add_include_to_target(onnxruntime_common date_interface)
-+onnxruntime_add_include_to_target(onnxruntime_common date::date)
- target_include_directories(onnxruntime_common
- PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}
- # propagate include directories of dependencies that are part of public interface
---- a/cmake/onnxruntime_unittests.cmake
-+++ b/cmake/onnxruntime_unittests.cmake
-@@ -61,7 +61,7 @@
- target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock ${onnxruntime_EXTERNAL_LIBRARIES})
- endif()
-
-- onnxruntime_add_include_to_target(${_UT_TARGET} date_interface flatbuffers::flatbuffers)
-+ onnxruntime_add_include_to_target(${_UT_TARGET} date::date flatbuffers::flatbuffers)
- target_include_directories(${_UT_TARGET} PRIVATE ${TEST_INC_DIR})
- if (onnxruntime_USE_CUDA)
- target_include_directories(${_UT_TARGET} PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${onnxruntime_CUDNN_HOME}/include)
-@@ -147,7 +147,7 @@
- else()
- target_link_libraries(${_UT_TARGET}_xc PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock ${onnxruntime_EXTERNAL_LIBRARIES})
++#onnxruntime_fetchcontent_makeavailable(date)
++find_package(date REQUIRED)
+
+ if(NOT TARGET Boost::mp11)
+ if(onnxruntime_USE_VCPKG)
+@@ -261,7 +262,8 @@
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS NAMES Boost
+ )
+- onnxruntime_fetchcontent_makeavailable(mp11)
++ #onnxruntime_fetchcontent_makeavailable(mp11)
++ find_package(Boost REQUIRED)
+ if(NOT TARGET Boost::mp11)
+ add_library(Boost::mp11 ALIAS Boost::headers)
endif()
-- onnxruntime_add_include_to_target(${_UT_TARGET}_xc date_interface flatbuffers::flatbuffers)
-+ onnxruntime_add_include_to_target(${_UT_TARGET}_xc date::date flatbuffers::flatbuffers)
- target_include_directories(${_UT_TARGET}_xc PRIVATE ${TEST_INC_DIR})
- get_target_property(${_UT_TARGET}_DEFS ${_UT_TARGET} COMPILE_DEFINITIONS)
- target_compile_definitions(${_UT_TARGET}_xc PRIVATE ${_UT_TARGET}_DEFS)
-@@ -705,7 +705,7 @@
- if (onnxruntime_USE_ROCM)
- target_include_directories(onnxruntime_test_utils PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/onnxruntime ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/orttraining)
- endif()
--onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_common onnxruntime_framework onnxruntime_session GTest::gtest GTest::gmock onnx onnx_proto flatbuffers::flatbuffers nlohmann_json::nlohmann_json Boost::mp11 safeint_interface)
-+onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_common onnxruntime_framework onnxruntime_session GTest::gtest GTest::gmock onnx onnx_proto flatbuffers::flatbuffers nlohmann_json::nlohmann_json Boost::boost safeint_interface)
-
-
-
-@@ -739,7 +739,7 @@
- target_compile_options(onnx_test_runner_common PRIVATE "/wd4244")
- endif()
- onnxruntime_add_include_to_target(onnx_test_runner_common onnxruntime_common onnxruntime_framework
-- onnxruntime_test_utils onnx onnx_proto re2::re2 flatbuffers::flatbuffers Boost::mp11 safeint_interface)
-+ onnxruntime_test_utils onnx onnx_proto re2::re2 flatbuffers::flatbuffers Boost::boost safeint_interface)
-
- add_dependencies(onnx_test_runner_common onnx_test_data_proto ${onnxruntime_EXTERNAL_DEPENDENCIES})
- target_include_directories(onnx_test_runner_common PRIVATE ${eigen_INCLUDE_DIRS}
-@@ -1683,7 +1683,7 @@
-
- onnxruntime_add_shared_library_module(test_execution_provider ${test_execution_provider_srcs})
- add_dependencies(test_execution_provider onnxruntime_providers_shared onnx ${ABSEIL_LIBS})
-- target_link_libraries(test_execution_provider PRIVATE onnxruntime_providers_shared ${ABSEIL_LIBS} Boost::mp11)
-+ target_link_libraries(test_execution_provider PRIVATE onnxruntime_providers_shared ${ABSEIL_LIBS} Boost::boost)
- target_include_directories(test_execution_provider PRIVATE $<TARGET_PROPERTY:onnx,INTERFACE_INCLUDE_DIRECTORIES>)
- target_include_directories(test_execution_provider PRIVATE $<TARGET_PROPERTY:onnxruntime_common,INTERFACE_INCLUDE_DIRECTORIES>)
- target_include_directories(test_execution_provider PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${ORTTRAINING_ROOT})
diff --git a/debian/patches/system-flatbuffers.patch b/debian/patches/system-flatbuffers.patch
index 7547d2b..86d49eb 100644
--- a/debian/patches/system-flatbuffers.patch
+++ b/debian/patches/system-flatbuffers.patch
@@ -4,12 +4,12 @@ Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-flatbuf
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -103,7 +103,7 @@
- URL ${DEP_URL_flatbuffers}
+@@ -463,7 +463,7 @@
URL_HASH SHA1=${DEP_SHA1_flatbuffers}
PATCH_COMMAND ${ONNXRUNTIME_FLATBUFFERS_PATCH_COMMAND}
-- FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES Flatbuffers
-+ FIND_PACKAGE_ARGS 1.12.0...<2.0.0 NAMES FlatBuffers
+ EXCLUDE_FROM_ALL
+- FIND_PACKAGE_ARGS 23.5.9 NAMES Flatbuffers flatbuffers
++ FIND_PACKAGE_ARGS 23.5.9 NAMES Flatbuffers flatbuffers FlatBuffers
)
- # Download a protoc binary from Internet if needed
+ onnxruntime_fetchcontent_makeavailable(flatbuffers)
diff --git a/debian/patches/system-onnx.patch b/debian/patches/system-onnx.patch
index 4ebecbb..f93c325 100644
--- a/debian/patches/system-onnx.patch
+++ b/debian/patches/system-onnx.patch
@@ -5,36 +5,37 @@ Author: Alejandro Alvarez Ayllon <a.alvarezayllon at gmail.com>
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -414,11 +414,12 @@
- include(eigen)
- include(wil)
-
+@@ -486,11 +486,7 @@
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS NAMES ONNX onnx
+ )
-if (NOT onnxruntime_MINIMAL_BUILD)
-- onnxruntime_fetchcontent_makeavailable(onnx)
+- onnxruntime_fetchcontent_makeavailable(onnx)
-else()
- include(onnx_minimal)
-endif()
-+#if (NOT onnxruntime_MINIMAL_BUILD)
-+# onnxruntime_fetchcontent_makeavailable(onnx)
-+#else()
-+# include(onnx_minimal)
-+#endif()
+find_package(ONNX REQUIRED)
- set(GSL_TARGET "Microsoft.GSL::GSL")
- set(GSL_INCLUDE_DIR "$<TARGET_PROPERTY:${GSL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>")
-@@ -453,10 +454,10 @@
- # The other libs do not have the problem. All the sources are already there. We can compile them in any order.
+ if(TARGET ONNX::onnx AND NOT TARGET onnx)
+ message(STATUS "Aliasing ONNX::onnx to onnx")
+@@ -503,7 +499,8 @@
+ if(onnxruntime_USE_VCPKG)
+ find_package(Eigen3 CONFIG REQUIRED)
+ else()
+- include(external/eigen.cmake)
++ #include(external/eigen.cmake)
++ find_package(Eigen3 CONFIG REQUIRED)
+ endif()
+
+ if(WIN32)
+@@ -549,10 +546,6 @@
set(onnxruntime_EXTERNAL_DEPENDENCIES onnx_proto flatbuffers::flatbuffers)
--target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
--if (NOT onnxruntime_USE_FULL_PROTOBUF)
-- target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
--endif()
-+#target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
-+#if (NOT onnxruntime_USE_FULL_PROTOBUF)
-+# target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
-+#endif()
+ if(NOT (onnx_FOUND OR ONNX_FOUND)) # building ONNX from source
+- target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
+- if (NOT onnxruntime_USE_FULL_PROTOBUF)
+- target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
+- endif()
+ endif()
if (onnxruntime_RUN_ONNX_TESTS)
- add_definitions(-DORT_RUN_EXTERNAL_ONNX_TESTS)
diff --git a/debian/patches/system-protobuf.patch b/debian/patches/system-protobuf.patch
index caa4c41..4eedbfd 100644
--- a/debian/patches/system-protobuf.patch
+++ b/debian/patches/system-protobuf.patch
@@ -5,36 +5,65 @@ Author: Alejandro Álvarez Ayllón <a.alvarezayllon at gmail.com>
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -161,22 +161,8 @@
- else()
+@@ -107,23 +107,6 @@
+ FetchContent_MakeAvailable(mimalloc)
+ endif()
+
+-#Protobuf depends on utf8_range
+-onnxruntime_fetchcontent_declare(
+- utf8_range
+- URL ${DEP_URL_utf8_range}
+- URL_HASH SHA1=${DEP_SHA1_utf8_range}
+- EXCLUDE_FROM_ALL
+- FIND_PACKAGE_ARGS NAMES utf8_range
+-)
+-
+-set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Build test suite" FORCE)
+-set(utf8_range_ENABLE_INSTALL OFF CACHE BOOL "Configure installation" FORCE)
+-
+-# The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
+-onnxruntime_fetchcontent_makeavailable(utf8_range)
+-# protobuf's cmake/utf8_range.cmake has the following line
+-include_directories(${utf8_range_SOURCE_DIR})
+-
+ # Download a protoc binary from Internet if needed
+ if(NOT ONNX_CUSTOM_PROTOC_EXECUTABLE AND NOT onnxruntime_USE_VCPKG)
+ # This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
+@@ -201,36 +184,10 @@
set(ONNXRUNTIME_PROTOBUF_PATCH_COMMAND "")
endif()
--FetchContent_Declare(
+
+-#Protobuf depends on absl and utf8_range
+-onnxruntime_fetchcontent_declare(
- Protobuf
- URL ${DEP_URL_protobuf}
- URL_HASH SHA1=${DEP_SHA1_protobuf}
- PATCH_COMMAND ${ONNXRUNTIME_PROTOBUF_PATCH_COMMAND}
-- FIND_PACKAGE_ARGS 3.21.12 NAMES Protobuf
+- EXCLUDE_FROM_ALL
+- FIND_PACKAGE_ARGS NAMES Protobuf protobuf
-)
+-
-set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE)
--if (CMAKE_SYSTEM_NAME STREQUAL "Android")
-- set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protobuf tests" FORCE)
-- set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE)
+-#TODO: we'd better to turn the following option off. However, it will cause
+-# ".\build.bat --config Debug --parallel --skip_submodule_sync --update" fail with an error message:
+-# install(EXPORT "ONNXTargets" ...) includes target "onnx_proto" which requires target "libprotobuf-lite" that is
+-# not in any export set.
+-#set(protobuf_INSTALL OFF CACHE BOOL "Install protobuf binaries and files" FORCE)
+-set(protobuf_USE_EXTERNAL_GTEST ON CACHE BOOL "" FORCE)
+-
+-if (ANDROID)
+- set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build protobuf with zlib support" FORCE)
-endif()
+-
-if (onnxruntime_DISABLE_RTTI)
- set(protobuf_DISABLE_RTTI ON CACHE BOOL "Remove runtime type information in the binaries" FORCE)
-endif()
-
+-
+find_package(Protobuf REQUIRED)
include(protobuf_function)
#protobuf end
-@@ -317,7 +303,7 @@
- )
-
- # The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
--onnxruntime_fetchcontent_makeavailable(Protobuf nlohmann_json mp11 re2 safeint GSL flatbuffers)
-+onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 safeint GSL flatbuffers)
- if(NOT flatbuffers_FOUND)
- if(NOT TARGET flatbuffers::flatbuffers)
- add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
+-onnxruntime_fetchcontent_makeavailable(Protobuf)
+ if(Protobuf_FOUND)
+ message(STATUS "Using protobuf from find_package(or vcpkg). Protobuf version: ${Protobuf_VERSION}")
+ else()
diff --git a/debian/patches/system-python.patch b/debian/patches/system-python.patch
index fa94bea..5333e85 100644
--- a/debian/patches/system-python.patch
+++ b/debian/patches/system-python.patch
@@ -4,18 +4,22 @@ Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/system-python.
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
-@@ -531,12 +531,12 @@
+@@ -671,16 +671,16 @@
if (onnxruntime_BUILD_SHARED_LIB OR onnxruntime_ENABLE_PYTHON)
if (onnxruntime_ENABLE_PYTHON)
- if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS OR onnxruntime_REQUIRE_PYTHON_EMBED_LIB)
-- find_package(Python 3.8 COMPONENTS Interpreter Development NumPy)
+ if (onnxruntime_REQUIRE_PYTHON_EMBED_LIB)
+- find_package(Python 3.10 COMPONENTS Interpreter Development NumPy)
+ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development NumPy)
else()
-- find_package(Python 3.8 COMPONENTS Interpreter Development.Module NumPy)
+- find_package(Python 3.10 COMPONENTS Interpreter Development.Module NumPy)
+ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development.Module NumPy)
endif()
+ message("Numpy version: ${Python_NumPy_VERSION}")
+ if(Python_NumPy_VERSION VERSION_LESS "2.0.0")
+ message(WARNING "The build binary will not be compatible with NumPy 2.0 because the NumPy installed on this machine is too low.")
+ endif()
else()
-- find_package(Python 3.8 COMPONENTS Interpreter)
+- find_package(Python 3.10 COMPONENTS Interpreter)
+ find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter)
endif()
endif()
diff --git a/debian/patches/system-re2.patch b/debian/patches/system-re2.patch
index 5ac87c3..c8eb36b 100644
--- a/debian/patches/system-re2.patch
+++ b/debian/patches/system-re2.patch
@@ -4,10 +4,19 @@ Author: Dylan Aïssi <daissi at debian.org>
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -30,6 +30,25 @@
- URL_HASH SHA1=${DEP_SHA1_re2}
+@@ -42,7 +42,7 @@
+ EXCLUDE_FROM_ALL
FIND_PACKAGE_ARGS NAMES re2
)
+-onnxruntime_fetchcontent_makeavailable(re2)
++#onnxruntime_fetchcontent_makeavailable(re2)
+
+ if (onnxruntime_BUILD_UNIT_TESTS)
+ # WebAssembly threading support in Node.js is still an experimental feature and
+@@ -399,6 +399,25 @@
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS 23.5.9 NAMES Flatbuffers flatbuffers FlatBuffers
+ )
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(RE2 re2)
+if(RE2_FOUND)
@@ -28,5 +37,5 @@ Author: Dylan Aïssi <daissi at debian.org>
+ message(STATUS "Found RE2 via pkg-config.")
+endif()
- if (onnxruntime_BUILD_UNIT_TESTS)
- # WebAssembly threading support in Node.js is still an experimental feature and
+ onnxruntime_fetchcontent_makeavailable(flatbuffers)
+ if(NOT flatbuffers_FOUND)
diff --git a/debian/patches/system-safeint.patch b/debian/patches/system-safeint.patch
index 8150508..4b7a301 100644
--- a/debian/patches/system-safeint.patch
+++ b/debian/patches/system-safeint.patch
@@ -5,31 +5,18 @@ Author: Alejandro Alvarez Ayllon <a.alvarezayllon at gmail.com>, Dylan Aïssi <dais
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
-@@ -296,14 +296,8 @@
+@@ -392,10 +392,9 @@
)
- endif()
-
--FetchContent_Declare(
-- safeint
-- URL ${DEP_URL_safeint}
-- URL_HASH SHA1=${DEP_SHA1_safeint}
--)
--
- # The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
--onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 safeint GSL flatbuffers)
-+onnxruntime_fetchcontent_makeavailable(nlohmann_json mp11 re2 GSL flatbuffers)
- if(NOT flatbuffers_FOUND)
- if(NOT TARGET flatbuffers::flatbuffers)
- add_library(flatbuffers::flatbuffers ALIAS flatbuffers)
-@@ -425,7 +419,7 @@
- set(GSL_INCLUDE_DIR "$<TARGET_PROPERTY:${GSL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>")
+ # use fetch content rather than makeavailable because safeint only includes unconditional test targets
+- FetchContent_Populate(safeint)
+ endif()
add_library(safeint_interface INTERFACE)
-target_include_directories(safeint_interface INTERFACE ${safeint_SOURCE_DIR})
+target_include_directories(safeint_interface INTERFACE /usr/include/safeint)
- # XNNPACK EP
- if (onnxruntime_USE_XNNPACK)
+
+ # Flatbuffers
--- a/onnxruntime/core/common/safeint.h
+++ b/onnxruntime/core/common/safeint.h
@@ -24,6 +24,7 @@
diff --git a/debian/patches/use-system-dlpack.patch b/debian/patches/use-system-dlpack.patch
new file mode 100644
index 0000000..2ffb0e3
--- /dev/null
+++ b/debian/patches/use-system-dlpack.patch
@@ -0,0 +1,16 @@
+Description: Use dlpack from system
+Author: Shengqi Chen <harry at debian.org>
+Forwarded: not-needed
+
+--- a/cmake/external/onnxruntime_external_deps.cmake
++++ b/cmake/external/onnxruntime_external_deps.cmake
+@@ -551,7 +551,8 @@
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS NAMES dlpack
+ )
+- onnxruntime_fetchcontent_makeavailable(dlpack)
++ #onnxruntime_fetchcontent_makeavailable(dlpack)
++ find_package(dlpack REQUIRED)
+ endif()
+
+ if(onnxruntime_ENABLE_TRAINING OR (onnxruntime_ENABLE_TRAINING_APIS AND onnxruntime_BUILD_UNIT_TESTS))
diff --git a/debian/patches/use-system-dnnl.patch b/debian/patches/use-system-dnnl.patch
new file mode 100644
index 0000000..e873fbc
--- /dev/null
+++ b/debian/patches/use-system-dnnl.patch
@@ -0,0 +1,65 @@
+Description: Use libdnnl from system
+Author: Mo Zhou <lumin at debian.org>
+Forwarded: not-needed
+
+--- a/cmake/external/dnnl.cmake
++++ b/cmake/external/dnnl.cmake
+@@ -1,9 +1,3 @@
+-include (ExternalProject)
+-
+-set(DNNL_URL https://github.com/oneapi-src/onednn.git)
+-# If DNNL_TAG is updated, check if MKLML_VERSION and platform.cmake.patch need to be updated.
+-set(DNNL_TAG v3.0.1)
+-
+ if(WIN32)
+ set(DNNL_SHARED_LIB dnnl.dll)
+ set(DNNL_IMPORT_LIB dnnl.lib)
+@@ -36,32 +30,5 @@
+ endif()
+
+ if (onnxruntime_USE_DNNL)
+- set(DNNL_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/dnnl/src/dnnl/src)
+- set(DNNL_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/dnnl/install)
+- set(DNNL_LIB_DIR ${DNNL_INSTALL}/${CMAKE_INSTALL_LIBDIR})
+- if(WIN32)
+- set(DNNL_DLL_PATH ${DNNL_INSTALL}/${CMAKE_INSTALL_BINDIR}/${DNNL_SHARED_LIB})
+- else()
+- set(DNNL_DLL_PATH ${DNNL_LIB_DIR}/${DNNL_SHARED_LIB})
+- endif()
+- set(DNNL_INCLUDE_DIR ${DNNL_INSTALL}/include)
+- set(DNNL_CMAKE_EXTRA_ARGS)
+- # set(DNNL_PATCH_COMMAND git apply ${CMAKE_SOURCE_DIR}/patches/mkldnn/constexpr.patch)
+- # discard prior changes due to patching in mkldnn source to unblock incremental builds.
+- # set(MKLDNN_PATCH_DISCARD_COMMAND cd ${DNNL_SOURCE} && git checkout -- .)
+- # if(NOT onnxruntime_BUILD_FOR_NATIVE_MACHINE)
+- # pre-v1.0
+- # list(APPEND DNNL_CMAKE_EXTRA_ARGS "-DARCH_OPT_FLAGS=")
+- # v1.0
+- # list(APPEND DNNL_CMAKE_EXTRA_ARGS "-DDNNL_ARCH_OPT_FLAGS=")
+- # endif()
+- ExternalProject_Add(project_dnnl
+- PREFIX dnnl
+- GIT_REPOSITORY ${DNNL_URL}
+- GIT_TAG ${DNNL_TAG}
+- # PATCH_COMMAND ${MKLDNN_PATCH_DISCARD_COMMAND} COMMAND ${DNNL_PATCH_COMMAND}
+- SOURCE_DIR ${DNNL_SOURCE}
+- CMAKE_ARGS -DDNNL_BUILD_TESTS=OFF -DDNNL_ENABLE_CONCURRENT_EXEC=ON -DDNNL_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${DNNL_INSTALL} ${DNNL_GPU_CMAKE_ARGS} ${DNNL_AARCH64_CMAKE_ARGS}
+- )
+- link_directories(${DNNL_LIB_DIR})
++ find_package(dnnl REQUIRED)
+ endif()
+--- a/cmake/onnxruntime_providers_dnnl.cmake
++++ b/cmake/onnxruntime_providers_dnnl.cmake
+@@ -16,10 +16,10 @@
+ target_compile_options(onnxruntime_providers_dnnl PRIVATE "/analyze:stacksize 131072")
+ endif()
+
+- add_dependencies(onnxruntime_providers_dnnl onnxruntime_providers_shared project_dnnl ${onnxruntime_EXTERNAL_DEPENDENCIES})
++ add_dependencies(onnxruntime_providers_dnnl onnxruntime_providers_shared DNNL::dnnl ${onnxruntime_EXTERNAL_DEPENDENCIES})
+ target_include_directories(onnxruntime_providers_dnnl PRIVATE ${ONNXRUNTIME_ROOT} ${DNNL_INCLUDE_DIR} ${DNNL_OCL_INCLUDE_DIR})
+ # ${CMAKE_CURRENT_BINARY_DIR} is so that #include "onnxruntime_config.h" inside tensor_shape.h is found
+- target_link_libraries(onnxruntime_providers_dnnl PRIVATE dnnl ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11 ${ABSEIL_LIBS} ${GSL_TARGET} safeint_interface Eigen3::Eigen)
++ target_link_libraries(onnxruntime_providers_dnnl PRIVATE DNNL::dnnl ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11 ${ABSEIL_LIBS} ${GSL_TARGET} safeint_interface Eigen3::Eigen)
+ install(FILES ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/dnnl/dnnl_provider_options.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/)
+ set_target_properties(onnxruntime_providers_dnnl PROPERTIES FOLDER "ONNXRuntime")
diff --git a/debian/patches/use-system-xnnpack.patch b/debian/patches/use-system-xnnpack.patch
new file mode 100644
index 0000000..e942f7e
--- /dev/null
+++ b/debian/patches/use-system-xnnpack.patch
@@ -0,0 +1,47 @@
+Description: Use xnnpack from system
+ do not try to download anything and do not link against -lkleidiai, which does not exist in archive at all
+ See https://buildd.debian.org/status/fetch.php?pkg=onnxruntime&arch=arm64&ver=1.20.1%2Bdfsg-1%7Eexp1&stamp=1738119490&raw=0
+Forward: not-need
+Author: Mo Zhou <lumin at debian.org>
+Last-Update: 2025-02-18
+--- a/cmake/external/xnnpack.cmake
++++ b/cmake/external/xnnpack.cmake
+@@ -18,11 +18,11 @@
+
+ # pthreadpool depends on fxdiv
+ onnxruntime_fetchcontent_declare(fxdiv URL ${DEP_URL_fxdiv} URL_HASH SHA1=${DEP_SHA1_fxdiv} EXCLUDE_FROM_ALL FIND_PACKAGE_ARGS NAMES fxdiv)
+-onnxruntime_fetchcontent_makeavailable(fxdiv)
++#onnxruntime_fetchcontent_makeavailable(fxdiv)
+ set(FXDIV_SOURCE_DIR ${fxdiv_SOURCE_DIR})
+
+ onnxruntime_fetchcontent_declare(pthreadpool URL ${DEP_URL_pthreadpool} URL_HASH SHA1=${DEP_SHA1_pthreadpool} EXCLUDE_FROM_ALL FIND_PACKAGE_ARGS NAMES unofficial-pthreadpool)
+-onnxruntime_fetchcontent_makeavailable(pthreadpool)
++#onnxruntime_fetchcontent_makeavailable(pthreadpool)
+
+ # --- Determine target processor
+ # Why ORT_TARGET_PROCESSOR is only for XNNPACK
+@@ -76,7 +76,7 @@
+ # https://gitlab.arm.com/kleidi/kleidiai/-/blob/main/CMakeLists.txt#L134
+ set(CMAKE_SYSTEM_PROCESSOR arm64)
+ onnxruntime_fetchcontent_declare(kleidiai URL ${DEP_URL_kleidiai} URL_HASH SHA1=${DEP_SHA1_kleidiai} EXCLUDE_FROM_ALL)
+- onnxruntime_fetchcontent_makeavailable(kleidiai)
++ #onnxruntime_fetchcontent_makeavailable(kleidiai)
+ set(KLEIDIAI_SOURCE_DIR ${kleidiai_SOURCE_DIR})
+ endif()
+
+@@ -86,14 +86,11 @@
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS NAMES xnnpack
+ )
+-onnxruntime_fetchcontent_makeavailable(googlexnnpack)
++#onnxruntime_fetchcontent_makeavailable(googlexnnpack)
+ set(XNNPACK_DIR ${googlexnnpack_SOURCE_DIR})
+ set(XNNPACK_INCLUDE_DIR ${XNNPACK_DIR}/include)
+
+ set(onnxruntime_EXTERNAL_LIBRARIES_XNNPACK XNNPACK microkernels-prod pthreadpool)
+-if(ORT_TARGET_PROCESSOR MATCHES "^arm64.*" AND NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+- list(APPEND onnxruntime_EXTERNAL_LIBRARIES_XNNPACK kleidiai)
+-endif()
+
+ # the XNNPACK CMake setup doesn't include the WASM kernels so we have to manually set those up
+ if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
diff --git a/debian/patches/versioned-onnxruntime_providers_shared.patch b/debian/patches/versioned-onnxruntime_providers_shared.patch
deleted file mode 100644
index 7460e91..0000000
--- a/debian/patches/versioned-onnxruntime_providers_shared.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Description: Make onnxruntime_providers_shared versioned
-Forwarded: not-needed
-Origin: https://src.fedoraproject.org/rpms/onnxruntime/blob/f40/f/versioned-onnxruntime_providers_shared.patch
-
---- a/cmake/onnxruntime_providers.cmake
-+++ b/cmake/onnxruntime_providers.cmake
-@@ -338,6 +338,7 @@
- onnxruntime_add_shared_library(onnxruntime_providers_shared ${onnxruntime_providers_shared_cc_srcs} "${ONNXRUNTIME_ROOT}/core/dll/onnxruntime.rc")
- set_target_properties(onnxruntime_providers_shared PROPERTIES FOLDER "ONNXRuntime")
- set_target_properties(onnxruntime_providers_shared PROPERTIES LINKER_LANGUAGE CXX)
-+ set_target_properties(onnxruntime_providers_shared PROPERTIES VERSION ${ORT_VERSION})
-
- target_compile_definitions(onnxruntime_providers_shared PRIVATE VER_MAJOR=${VERSION_MAJOR_PART})
- target_compile_definitions(onnxruntime_providers_shared PRIVATE VER_MINOR=${VERSION_MINOR_PART})
diff --git a/debian/python3-onnxruntime.install b/debian/python3-onnxruntime.install
new file mode 100644
index 0000000..607c065
--- /dev/null
+++ b/debian/python3-onnxruntime.install
@@ -0,0 +1 @@
+usr/lib/python*
diff --git a/debian/rules b/debian/rules
index 7065187..f25a863 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,32 +1,86 @@
#!/usr/bin/make -f
-COMPILE_SCHEMA = onnxruntime/core/flatbuffers/schema/compile_schema.py
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
+export DEB_CFLAGS_MAINT_STRIP = -O3
+export DEB_CXXFLAGS_MAINT_STRIP = -O3
+
+FULLVERSION=1.21.0
+SOVERSION=1.21
+
+# xnnpack is only available on several architectures.
+# on riscv64 the provider is not usable: https://ci.debian.net/packages/o/onnxruntime/testing/riscv64/57967709/
+ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armhf i386 x32))
+USE_XNNPACK=ON
+else
+USE_XNNPACK=OFF
+endif
+
+# dnnl is only available on several architectures.
+# riscv64 is temporarily disabled until onednn has openmp support on it,
+# because onnxruntime always sets DNNL_OPENMP when onnxruntime_USE_DNNL is set.
+ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 ppc64el s390x))
+USE_DNNL=ON
+else
+USE_DNNL=OFF
+endif
+
+PYVERS=$(shell python3 -c 'import sysconfig;print (sysconfig.get_python_version())')
+
+PATH_LIB=usr/lib/${DEB_HOST_MULTIARCH}
+PATH_LIB_PYTHON=usr/lib/python3/dist-packages/onnxruntime/capi
%:
- dh $@ -Scmake -Dcmake
+ dh $@ --buildsystem=cmake+ninja --sourcedirectory=cmake --builddirectory=.
override_dh_auto_configure:
- # Rebuild autogenerated flatbuffers files
- chmod +x ${COMPILE_SCHEMA}
- ${COMPILE_SCHEMA} --flatc /usr/bin/flatc
dh_auto_configure -- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_INCLUDEDIR=include \
-Deigen_SOURCE_PATH=/usr/include/eigen3 \
- -Donnxruntime_BUILD_BENCHMARKS=ON \
+ -Donnxruntime_BUILD_BENCHMARKS=OFF \
-Donnxruntime_BUILD_SHARED_LIB=ON \
- -Donnxruntime_BUILD_UNIT_TESTS=ON \
+ -Donnxruntime_BUILD_UNIT_TESTS=OFF \
-Donnxruntime_DISABLE_ABSEIL=ON \
-Donnxruntime_ENABLE_CPUINFO=ON \
- -Donnxruntime_ENABLE_PYTHON=OFF \
+ -Donnxruntime_ENABLE_DLPACK=ON \
+ -Donnxruntime_ENABLE_PYTHON=ON \
-Donnxruntime_ONNX_PROTO_DATA_DIR=/usr/lib/python3/dist-packages \
-Donnxruntime_ONNX_TEST_DATA_DIR=/usr/share/libonnx-testdata/data \
-Donnxruntime_USE_FULL_PROTOBUF=ON \
-Donnxruntime_USE_PREINSTALLED_EIGEN=ON \
- -Donnxruntime_USE_XNNPACK=ON \
- -Duse_flatbuffers_from_environment=OFF \
+ -Donnxruntime_USE_XNNPACK=$(USE_XNNPACK) \
+ -Donnxruntime_USE_DNNL=$(USE_DNNL) \
+ -DPYTHON_VERSION=${PYVERS} \
$(NULL)
+override_dh_auto_build:
+ dh_auto_build
+ # Build Python bindings
+ dh_auto_build --buildsystem=pybuild --sourcedirectory=.
+
+override_dh_auto_install:
+ dh_auto_install
+ # Install Python bindings
+ dh_auto_install --buildsystem=pybuild --sourcedirectory=.
+
+execute_after_dh_link:
+ # To avoid having large duplicated libraries
+ dh_link -ppython3-onnxruntime \
+ ${PATH_LIB}/libonnxruntime.so.$(SOVERSION) ${PATH_LIB_PYTHON}/libonnxruntime.so.$(SOVERSION) \
+ ${PATH_LIB}/libonnxruntime.so.$(FULLVERSION) ${PATH_LIB_PYTHON}/libonnxruntime.so.$(FULLVERSION)
+
+override_dh_python3:
+ dh_python3
+ # remove loadable plugins already installed in libonnxruntime
+ -find debian/python3-onnxruntime -type f -name 'libonnxruntime_providers_*.so*' -delete
+
override_dh_auto_test:
# Do NOT run tests, they depend on *.onnx dataset with unclear license
# See https://github.com/microsoft/onnxruntime/issues/8963
+
+override_dh_auto_clean:
+
+override_dh_makeshlibs:
+ dh_makeshlibs \
+ --exclude=/usr/lib/$(DEB_HOST_MULTIARCH)/libonnxruntime_providers_ \
+ -- -c4
diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml
index 7971007..51fb7e5 100644
--- a/debian/salsa-ci.yml
+++ b/debian/salsa-ci.yml
@@ -5,6 +5,7 @@ include:
variables:
SALSA_CI_DISABLE_BUILD_PACKAGE_I386: 1
+ SALSA_CI_DISABLE_BUILD_PACKAGE_ARM64: 0
blhc:
allow_failure: true
diff --git a/debian/tests/control b/debian/tests/control
index 759ff82..3d18271 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,3 +1,22 @@
Tests: build
Depends: build-essential, pkgconf, libonnxruntime-dev
Restrictions: superficial
+
+Test-Command: python3 debian/tests/inference.py
+Depends: @, python3-torch, python3-numpy, python3-onnx,
+Restrictions: allow-stderr
+Architecture: amd64 arm64 ppc64el s390x riscv64
+Features: test-name=test-inference-simple
+
+Test-Command: python3 debian/tests/providers.py
+Depends: @, python3-torch, python3-numpy, python3-onnx,
+Restrictions: allow-stderr
+Architecture: amd64 arm64 ppc64el s390x riscv64
+Features: test-name=test-execution-providers
+
+# this needs python3-onnxscript, which is net yet packaged.
+#Test-Command: python3 transformer.py
+#Depends: @, python3-torch, python3-numpy,
+#Restrictions: allow-stderr
+#Architecture: amd64 arm64 ppc64el s390x riscv64
+#Features: test-name=test-inference-transformers
diff --git a/debian/tests/inference.py b/debian/tests/inference.py
new file mode 100644
index 0000000..57cffe1
--- /dev/null
+++ b/debian/tests/inference.py
@@ -0,0 +1,36 @@
+# step 1: create a dummy neural network with pytorch, and export
+import torch
+
+model = torch.nn.Sequential(
+ torch.nn.Linear(128, 16),
+ torch.nn.ReLU(),
+ torch.nn.Linear(16, 1),
+ )
+
+input_tensor = torch.rand((1, 128), dtype=torch.float32)
+
+filename = 'test_model.onnx'
+torch.onnx.export(
+ model,
+ (input_tensor,),
+ filename,
+ input_names=['feature'],
+ dynamo=False,
+ verbose=True,
+ )
+print('Exported a dummy neural network at', filename)
+
+# step 2: load with onnxruntime and do the inference
+import numpy as np
+import onnxruntime as rt
+
+print('ORT: available providers:', rt.get_available_providers())
+session = rt.InferenceSession('test_model.onnx', providers=rt.get_available_providers())
+print('ORT: loaded the dummy network')
+input_name = session.get_inputs()[0].name
+inputs_onnx = {'feature': np.random.randn(1, 128).astype(np.float32)}
+pred_onnx = session.run(None, inputs_onnx)[0]
+print('pred_onnx:', pred_onnx, 'shape:', pred_onnx.shape)
+assert pred_onnx.shape == (1, 1)
+
+print('Test OK')
diff --git a/debian/tests/providers.py b/debian/tests/providers.py
new file mode 100644
index 0000000..6f76a92
--- /dev/null
+++ b/debian/tests/providers.py
@@ -0,0 +1,55 @@
+# step 1: create a dummy neural network with pytorch, and export
+import sys
+import os
+import torch
+
+B = 128
+N = 4096
+model = torch.nn.Sequential(
+ torch.nn.Linear(N, N),
+ torch.nn.ReLU(),
+ torch.nn.Linear(N, N),
+ )
+
+input_tensor = torch.rand((B, N), dtype=torch.float32)
+
+print('[..] Exporting dummy neural network for mainly GEMM test')
+filename = 'test_provider.onnx'
+torch.onnx.export(
+ model,
+ (input_tensor,),
+ filename,
+ input_names=['feature'],
+ dynamo=False,
+ verbose=True,
+ )
+print('[OK] Exported dummy neural network for mainly GEMM test:', filename)
+
+# step 2: load with onnxruntime and do the inference, try different providers.
+import numpy as np
+import onnxruntime as rt
+import time
+import math
+elapsed_time = {}
+repeat = 10
+
+print('ORT: available providers:', rt.get_available_providers())
+session = rt.InferenceSession('test_provider.onnx', providers=rt.get_available_providers())
+
+for provider in rt.get_available_providers():
+ print('Testing provider:', provider)
+ session.set_providers([provider])
+ input_name = session.get_inputs()[0].name
+ inputs_onnx = {input_name: np.random.randn(B, N).astype(np.float32)}
+ tmp = []
+ for _ in range(repeat):
+ time_start = time.time()
+ pred_onnx = session.run(None, inputs_onnx)[0]
+ time_end = time.time()
+ elapsed = time_end - time_start
+ print(' elapsed:', elapsed)
+ tmp.append(elapsed)
+ assert pred_onnx.shape == (B, N)
+ elapsed_time[provider] = sum(tmp) / float(repeat)
+
+print(elapsed_time)
diff --git a/debian/tests/transformer.py b/debian/tests/transformer.py
new file mode 100644
index 0000000..dba1117
--- /dev/null
+++ b/debian/tests/transformer.py
@@ -0,0 +1,34 @@
+# step 1: create dummy model with pytorch
+import torch
+
+model = torch.nn.Transformer(d_model=64, nhead=4, num_encoder_layers=2, num_decoder_layers=2, batch_first=True)
+model.eval()
+src = torch.rand((1, 10, 64))
+tgt = torch.rand((1, 20, 64))
+out = model(src, tgt)
+assert out.shape == (1, 20, 64)
+
+filename = 'test_transformer.onnx'
+torch.onnx.export(
+ model,
+ (src, tgt),
+ filename,
+ input_names=['src', 'tgt'],
+ dynamo=True, # see pytorch github issue #110255
+ verbose=True,
+ )
+print('Exported a dummy transformer at', filename)
+
+# step 2: load with onnxruntime and do the inference
+import numpy as np
+import onnxruntime as rt
+
+print('ORT: available providers:', rt.get_available_providers())
+session = rt.InferenceSession('test_transformer.onnx', providers=rt.get_available_providers())
+print('ORT: loaded the dummy transformer')
+inputs_onnx = {'src': np.random.randn(1, 10, 64).astype(np.float32),
+ 'tgt': np.random.randn(1, 20, 64).astype(np.float32)}
+pred_onnx = session.run(None, inputs_onnx)[0]
+print('pred_onnx:', pred_onnx, 'shape:', pred_onnx.shape)
+
+print('Test OK')
diff --git a/debian/upstream/metadata b/debian/upstream/metadata
new file mode 100644
index 0000000..72a71dd
--- /dev/null
+++ b/debian/upstream/metadata
@@ -0,0 +1,5 @@
+---
+Bug-Database: https://github.com/microsoft/onnxruntime/issues
+Bug-Submit: https://github.com/microsoft/onnxruntime/issues/new
+Repository: https://github.com/microsoft/onnxruntime.git
+Repository-Browse: https://github.com/microsoft/onnxruntime
diff --git a/debian/watch b/debian/watch
index 5ef1734..945a0b4 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,4 +1,4 @@
version=4
opts="repacksuffix=+dfsg,dversionmangle=s/\+dfsg//g,\
filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE at -$1.tar.gz%" \
- https://github.com/microsoft/onnxruntime/tags?after=v1.20.1 (?:.*?/)?v?(\d[\d.]*)\.tar\.gz
+ https://github.com/microsoft/onnxruntime/tags?after=v1.24.1 (?:.*?/)?v?(\d[\d.]*)\.tar\.gz
More information about the Neon-commits
mailing list