Skip to content

Commit 095d55b

Browse files
duli2012askhadeDu LiyuslepukhinCraigacp
authored
Cherry picking for Rel-1.6 (microsoft#6006)
* Update onnx (microsoft#5720) * update onnx * update docker image for testing (cherry picked from commit 705d093) * cherry pick PR 5720 * C#: Add CreateFromMemory to FixedBufferOnnxValue to allow bind user buffers and pass custom binary compatible types (microsoft#5886) Add CreateFromMemory to FixedBufferOnnxValue so users can bind their own custom binary compatible buffers to feed/fetch data. (cherry picked from commit c2d6100) * [Java] Initial Apple Silicon support (microsoft#5891) * Rearranging checks in onnxruntime_mlas.cmake to pickup Apple Silicon. On an M1 Macbook Pro clang reports: $ clang -dumpmachine arm64-apple-darwin20.1.0 So the regex check needs to look for "arm64" first, as otherwise it matches 32-bit ARM and you get NEON compilation failures. * Adding Java side library loading support for Apple Silicon (and other aarch64 architectures). * Adding Qgemm fix from @tracysh * Fixes the java packaging on Windows. * Missed a check in the java platform detector. (cherry picked from commit 8b83c51) * Add OpenVINO EP shared lib to Py Wheel (microsoft#5920) * Add OpenVINO EP shared lib to Py Wheel Include the libonnxruntime_providers_openvino.so/.dll to the wheel * Follow libs.extend pattern as other EPs (cherry picked from commit 4092686) * Make NNAPI EP reject nodes with no-shape inputs (microsoft#5927) (cherry picked from commit 8736865) * Sahar/fix documentation shared lib (microsoft#5926) * Update OpenVINO-ExecutionProvider.Md update openvino-executionprovider.md for shared library * Update Build.md updated --build_shared_lib flag for building openvino shared provider lib * Update Dockerfile.openvino building for shared library with the new changes for openvino shared lib * Revert "Update Build.md" This reverts commit c9cf5fe. * Revert "Update Dockerfile.openvino " This reverts commit e1624e4. * Update OpenVINO-ExecutionProvider.md fix documentation to the shared library Co-authored-by: sfatimar <sahar.fatima@intel/com> (cherry picked from commit 8168c91) * Update dockerfiles (microsoft#5929) 1. Remove conda from the images. Because conda contains a file named /opt/miniconda/lib/libcrypto.so.1.0.0 which can't pass our security scan. Also, it will be easier for us to manage the third party usage registrations. 2. Remove openssh from the images. Because the official openssh package provided by Ubuntu can't pass our security scan. 3. Reduce the image size to 1/3 by using stages. Also, because it contains less packages, it will be less often needed to update. 4. Put the LICENSE-IMAGE.txt file in right place. It is missed in current images. You can see it was added to a temp folder "/code" but it got deleted afterwards. 5. Update the CPU docker image's base image to Ubuntu 18.04. The GPU one is already 18.04. It's better to keep them the same. 6. Remove the build arg ONNXRUNTIME_REPO/ONNXRUNTIME_BRANCH. Instead, the new one always uses the local source. I feel it can reduce confusion. (cherry picked from commit 1dbabb2) * Add Longformer Attention Cuda Op(microsoft#5932) Limitation: Global tokens must be at the beginning of sequence. (cherry picked from commit 31a6be3) * Bug fix for MaskRCNN and FasterRCNN (microsoft#5935) Signed-off-by: MaajidKhan <[email protected]> (cherry picked from commit e39e82b) * Fix publishing pipelines. (microsoft#5942) Fix publishing pipelines. (cherry picked from commit c4b55d2) * Fix Python Linux GPU package name (microsoft#5943) Fix Python Linux GPU package name. I accidentally added "noopenmp" to it. (cherry picked from commit 5fdd9f0) * Update BUILD.md with shared provider information (microsoft#5944) * Update build instructions to include information about shared providers (cherry picked from commit 27513d1) * [OpenVINO]Fix memory leak in `IsDebugEnabled()` under Windows (microsoft#5948) * w * w Co-authored-by: modav <[email protected]> (cherry picked from commit e207589) * Add support for Python 3.8+ on Windows when CUDA is enabled (microsoft#5956) (cherry picked from commit 015fbb3) * Support the cross compiling for Apple Silicon (microsoft#5974) * support macos_arm64 cross compiling * update the build docs * update as commented. * Update BUILD.md (cherry picked from commit 2ec211e) * Update docker files to put 'unattended-upgrades' in a right place(microsoft#5983) (cherry picked from commit 3323fb6) * Enable the xcode build for Apple Silicon (arm64 MacOS) (microsoft#5924) * fix the build script for macos/xcode * add the version check * correct the osx-arch configuration * typo (cherry picked from commit 1852ade) * Add python 3.9 support (microsoft#5874) 1. Add python 3.9 support(except Linux ARM) 2. Add Windows GPU python 3.8 to our packaging pipeline. * Revert some pipeline changes in microsoft#5874 Co-authored-by: Ashwini Khade <[email protected]> Co-authored-by: Du Li <duli@OrtTrainingDev0.af05slrtruoetgaxwwjv5nsq5e.px.internal.cloudapp.net> Co-authored-by: Dmitri Smirnov <[email protected]> Co-authored-by: Adam Pocock <[email protected]> Co-authored-by: S. Manohar Karlapalem <[email protected]> Co-authored-by: Guoyu Wang <[email protected]> Co-authored-by: sfatimar <[email protected]> Co-authored-by: Changming Sun <[email protected]> Co-authored-by: Tianlei Wu <[email protected]> Co-authored-by: Maajid khan <[email protected]> Co-authored-by: Ryan Hill <[email protected]> Co-authored-by: Moshe David <[email protected]> Co-authored-by: Ivan Stojiljkovic <[email protected]> Co-authored-by: Wenbing Li <[email protected]>
1 parent 846c5fb commit 095d55b

File tree

72 files changed

+2219
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2219
-262
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.git
22
.gitignore
33
.gitattributes
4-
docs
54

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ cmake-build-debug
1414
gen
1515
*~
1616
.vs
17+
.DS_Store
1718
TestResults/
1819
.idea/
1920
onnxruntime.egg-info

BUILD.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* [Reduced Operator Kernel Build](#Reduced-Operator-Kernel-Build)
1212
* [ONNX Runtime for Mobile Platforms](#ONNX-Runtime-for-Mobile-Platforms)
1313
* [ONNX Runtime Server (Linux)](#Build-ONNX-Runtime-Server-on-Linux)
14+
* [Execution Provider Shared Libraries](#Execution-Provider-Shared-Libraries)
1415
* Execution Providers
1516
* [NVIDIA CUDA](#CUDA)
1617
* [NVIDIA TensorRT](#TensorRT)
@@ -59,24 +60,23 @@ Open Developer Command Prompt for Visual Studio version you are going to use. Th
5960
The default Windows CMake Generator is Visual Studio 2017, but you can also use the newer Visual Studio 2019 by passing `--cmake_generator "Visual Studio 16 2019"` to `.\build.bat`
6061

6162

62-
#### Linux/macOS
63+
#### Linux
6364
```
6465
./build.sh --config RelWithDebInfo --build_shared_lib --parallel
6566
```
67+
68+
6669
##### macOS
6770
By default, ORT is configured to be built for a minimum target macOS version of 10.12.
6871
The shared library in the release Nuget(s) and the Python wheel may be installed on macOS versions of 10.12+.
6972

70-
If you would like to use [Xcode](https://developer.apple.com/xcode/) to build the onnxruntime for x86_64 macOS, use
71-
* With Xcode 11
73+
If you would like to use [Xcode](https://developer.apple.com/xcode/) to build the onnxruntime for x86_64 macOS, please add the --user_xcode argument in the command line
7274
```
7375
./build.sh --config RelWithDebInfo --build_shared_lib --parallel --use_xcode
7476
```
75-
* With Xcode 12
76-
```
77-
./build.sh --config RelWithDebInfo --build_shared_lib --parallel --use_xcode \
78-
--cmake_extra_defines CMAKE_OSX_ARCHITECTURES=x86_64
79-
```
77+
While without this flag, the cmake build generator will be Unix makefile by default.
78+
Also, if you want to try cross compiling for Apple Silicon in an Intel-based MacOS machine, please add the argument --osx_arch arm64 with a cmake > 3.19, however the unit tests will be skipped due to the incompatible CPU instruction set.
79+
8080

8181
#### Notes
8282

@@ -177,6 +177,24 @@ Nuget packages are created under <native_build_dir>\nuget-artifacts
177177
178178
---
179179
180+
## Execution Provider Shared Libraries
181+
The DNNL, TensorRT, and OpenVINO providers are built as shared libraries vs being statically linked into the main onnxruntime. This enables them to be loaded only when needed, and if the dependent libraries of the provider are not installed onnxruntime will still run fine, it just will not be able to use that provider. For non shared library providers, all dependencies of the provider must exist to load onnxruntime.
182+
183+
### Built files
184+
On Windows, shared provider libraries will be named 'onnxruntime_providers_\*.dll' (for example onnxruntime_providers_openvino.dll).
185+
On Unix, they will be named 'libonnxruntime_providers_\*.so'
186+
On Mac, they will be named 'libonnxruntime_providers_\*.dylib'.
187+
188+
There is also a shared library that shared providers depend on called onnxruntime_providers_shared (with the same naming convension applied as above).
189+
190+
Note: It is not recommended to put these libraries in a system location or added to a library search path (like LD_LIBRARY_PATH on Unix). If multiple versions of onnxruntime are installed on the system this can make them find the wrong libraries and lead to undefined behavior.
191+
192+
### Loading the shared providers
193+
Shared provider libraries are loaded by the onnxruntime code (do not load or depend on them in your client code). The API for registering shared or non shared providers is identical, the difference is that shared ones will be loaded at runtime when the provider is added to the session options (through a call like OrtSessionOptionsAppendExecutionProvider_OpenVINO or SessionOptionsAppendExecutionProvider_OpenVINO in the C API).
194+
If a shared provider library cannot be loaded (if the file doesn't exist, or its dependencies don't exist or not in the path) then an error will be returned.
195+
196+
The onnxruntime code will look for the provider shared libraries in the same location as the onnxruntime shared library is (or the executable statically linked to the static library version).
197+
180198
## Execution Providers
181199
182200
### CUDA
@@ -235,6 +253,8 @@ See more information on the TensorRT Execution Provider [here](./docs/execution_
235253
* The path to TensorRT installation must be provided via the `--tensorrt_home` parameter.
236254
237255
#### Build Instructions
256+
Note that TensorRT is built as a [shared provider library](#Execution-Provider-Shared-Libraries)
257+
238258
##### Windows
239259
```
240260
.\build.bat --cudnn_home <path to cuDNN home> --cuda_home <path to CUDA home> --use_tensorrt --tensorrt_home <path to TensorRT home>
@@ -309,6 +329,8 @@ See more information on DNNL and MKL-ML [here](./docs/execution_providers/DNNL-E
309329
#### Build Instructions
310330
The DNNL execution provider can be built for Intel CPU or GPU. To build for Intel GPU, install [Intel SDK for OpenCL Applications](https://software.intel.com/content/www/us/en/develop/tools/opencl-sdk.html). Install the latest GPU driver - [Windows graphics driver](https://downloadcenter.intel.com/product/80939/Graphics), [Linux graphics compute runtime and OpenCL driver](https://github.com/intel/compute-runtime/releases).
311331
332+
Note that DNNL is built as a [shared provider library](#Execution-Provider-Shared-Libraries)
333+
312334
##### Windows
313335
`.\build.bat --use_dnnl`
314336
@@ -365,6 +387,8 @@ See more information on the OpenVINO Execution Provider [here](./docs/execution_
365387
366388
367389
#### Build Instructions
390+
Note that OpenVINO is built as a [shared provider library](#Execution-Provider-Shared-Libraries)
391+
368392
##### Windows
369393
```
370394
.\build.bat --config RelWithDebInfo --use_openvino <hardware_option>

cgmanifests/cgmanifest.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@
343343
"component": {
344344
"type": "git",
345345
"git": {
346-
"commitHash": "f97fd8664fa824e5d081d776cf4a811dbf09bca4",
346+
"commitHash": "bc8ce45b35ade9b8f08d88d4d9fdfd12b4f6f310",
347347
"repositoryUrl": "https://github.com/pypa/manylinux"
348348
},
349349
"comments": "For building our CI build docker image"
@@ -363,20 +363,20 @@
363363
"component": {
364364
"type": "git",
365365
"git": {
366-
"commitHash": "439c93d51f45c50541fc755b597725168ecd939a",
366+
"commitHash": "9cf6752276e6fcfd0c23fdb064ad27f448aaaf75",
367367
"repositoryUrl": "https://github.com/python/cpython"
368368
},
369-
"comments": "Python 3.9.0rc1"
369+
"comments": "Python 3.9.0"
370370
}
371371
},
372372
{
373373
"component": {
374374
"type": "git",
375375
"git": {
376-
"commitHash": "580fbb018fd0844806119614d752b41fc69660f9",
376+
"commitHash": "db455296be5f792b8c12b7cd7f3962b52e4f44ee",
377377
"repositoryUrl": "https://github.com/python/cpython"
378378
},
379-
"comments": "Python 3.8.5"
379+
"comments": "Python 3.8.6"
380380
}
381381
},
382382
{
@@ -403,10 +403,10 @@
403403
"component": {
404404
"type": "git",
405405
"git": {
406-
"commitHash": "e5f6aba872e66bfd86eb592214696a519cded197",
406+
"commitHash": "426b022776672fdf3d71ddd98d89af341c88080f",
407407
"repositoryUrl": "https://github.com/python/cpython"
408408
},
409-
"comments": "Python 3.5.9"
409+
"comments": "Python 3.5.10"
410410
}
411411
},
412412
{

cgmanifests/submodules/cgmanifest.json

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,50 @@
11
{
22
"Version": 1,
33
"Registrations": [
4+
{
5+
"Component": {
6+
"Type": "other",
7+
"other": {
8+
"Name": "automake",
9+
"Version": "1.16.2",
10+
"DownloadUrl": "http://ftp.gnu.org/gnu/automake/automake-1.16.2.tar.gz"
11+
},
12+
"comments": "manylinux dependency"
13+
}
14+
},
15+
{
16+
"Component": {
17+
"Type": "other",
18+
"other": {
19+
"Name": "libtool",
20+
"Version": "2.4.6",
21+
"DownloadUrl": "http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz"
22+
},
23+
"comments": "manylinux dependency"
24+
}
25+
},
26+
{
27+
"Component": {
28+
"Type": "other",
29+
"other": {
30+
"Name": "sqlite",
31+
"Version": "3330000",
32+
"DownloadUrl": "https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz"
33+
},
34+
"comments": "manylinux dependency"
35+
}
36+
},
37+
{
38+
"Component": {
39+
"Type": "other",
40+
"other": {
41+
"Name": "git",
42+
"Version": "2.29.1",
43+
"DownloadUrl": "https://www.kernel.org/pub/software/scm/git/git-2.29.1.tar.gz"
44+
},
45+
"comments": "manylinux dependency"
46+
}
47+
},
448
{
549
"component": {
650
"type": "git",
@@ -345,7 +389,7 @@
345389
"component": {
346390
"type": "git",
347391
"git": {
348-
"commitHash": "63a586914d51fdfd6d8668e81de043e3d9b0b382",
392+
"commitHash": "994c6181247d7b419b28889fc57d5817e2089419",
349393
"repositoryUrl": "https://github.com/onnx/onnx"
350394
},
351395
"comments": "git submodule at cmake/external/onnx"

cgmanifests/submodules/generate_submodule_cgmanifest.py

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,54 @@
44
import os
55
import subprocess
66
import sys
7+
import re
78

89
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
910
REPO_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, "..", ".."))
1011

12+
package_name = None
13+
package_filename = None
14+
package_url = None
15+
16+
registrations = []
17+
18+
with open(os.path.join(REPO_DIR,'tools','ci_build','github','linux','docker','manylinux2014_build_scripts','build_env.sh'), "r") as f:
19+
for line in f:
20+
if not line.strip():
21+
package_name = None
22+
package_filename = None
23+
package_url = None
24+
if package_filename is None:
25+
m = re.match("(.+?)_ROOT=(.*)$",line)
26+
if m != None:
27+
package_name = m.group(1)
28+
package_filename = m.group(2)
29+
else:
30+
m = re.match("(.+?)_AUTOCONF_VERSION=(.*)$",line)
31+
if m != None:
32+
package_name = m.group(1)
33+
package_filename = m.group(2)
34+
elif package_url is None:
35+
m = re.match("(.+?)_DOWNLOAD_URL=(.+)$",line)
36+
if m != None:
37+
package_url = m.group(2) + "/" + package_filename + ".tar.gz"
38+
registration = {
39+
"Component": {
40+
"Type": "other",
41+
"other": {
42+
"Name": package_name.lower(),
43+
"Version": package_filename.split("-")[-1],
44+
"DownloadUrl": package_url,
45+
},
46+
"comments": "manylinux dependency"
47+
}
48+
}
49+
registrations.append(registration)
50+
package_name = None
51+
package_filename = None
52+
package_url = None
53+
54+
1155
proc = subprocess.run(
1256
["git", "submodule", "foreach", "--quiet", "--recursive", "{} {} $toplevel/$sm_path".format(
1357
sys.executable, os.path.join(SCRIPT_DIR, "print_submodule_info.py"))],
@@ -17,7 +61,7 @@
1761
stderr=subprocess.PIPE,
1862
universal_newlines=True)
1963

20-
registrations = []
64+
2165
submodule_lines = proc.stdout.splitlines()
2266
for submodule_line in submodule_lines:
2367
(absolute_path, url, commit) = submodule_line.split(" ")

cmake/external/pybind11.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(NOT TARGET pybind11::module)
88

99
set(pybind11_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/pybind11/src/pybind11/include)
1010
set(pybind11_URL https://github.com/pybind/pybind11.git)
11-
set(pybind11_TAG v2.4.0)
11+
set(pybind11_TAG v2.6.1)
1212

1313
ExternalProject_Add(pybind11
1414
PREFIX pybind11
@@ -21,4 +21,4 @@ if(NOT TARGET pybind11::module)
2121
set(pybind11_dep pybind11)
2222
else()
2323
set(pybind11_lib pybind11::module)
24-
endif()
24+
endif()

cmake/onnxruntime_java.cmake

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,31 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
100100
file(MAKE_DIRECTORY ${ANDROID_PACKAGE_OUTPUT_DIR})
101101
endif()
102102

103-
# Set platform and ach for packaging
103+
# Set platform and arch for packaging
104+
# Checks the names set by MLAS on non-Windows platforms first
104105
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
105106
set(JNI_ARCH ${ANDROID_ABI})
106-
elseif (CMAKE_SIZEOF_VOID_P EQUAL "8")
107+
elseif (ARM64)
108+
set(JNI_ARCH aarch64)
109+
elseif (X86_64)
107110
set(JNI_ARCH x64)
111+
elseif (POWER)
112+
set(JNI_ARCH ppc64)
108113
else()
109-
message(FATAL_ERROR "Java is currently not supported for x86 architecture")
114+
# Now mirror the checks used with MSVC
115+
if(MSVC)
116+
if(onnxruntime_target_platform STREQUAL "ARM64")
117+
set(JNI_ARCH aarch64)
118+
elseif(onnxruntime_target_platform STREQUAL "x64")
119+
set(JNI_ARCH x64)
120+
else()
121+
# if everything else failed then we're on a 32-bit arch and Java isn't supported
122+
message(FATAL_ERROR "Java is currently not supported on 32-bit x86 architecture")
123+
endif()
124+
else()
125+
# if everything else failed then we're on a 32-bit arch and Java isn't supported
126+
message(FATAL_ERROR "Java is currently not supported on 32-bit x86 architecture")
127+
endif()
110128
endif()
111129

112130
if (WIN32)

cmake/onnxruntime_mlas.cmake

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ if(MSVC)
124124
)
125125
endif()
126126
else()
127+
if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
128+
set(ARM64 TRUE)
129+
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "arm")
130+
set(ARM TRUE)
131+
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
132+
set(X86_64 TRUE)
133+
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "i386")
134+
set(X86 TRUE)
135+
endif()
127136
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
128137
if (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
129138
set(ARM TRUE)
@@ -136,22 +145,15 @@ else()
136145
endif()
137146
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "iOSCross")
138147
set(IOS TRUE)
139-
if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
140-
set(ARM64 TRUE)
141-
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "arm")
142-
set(ARM TRUE)
143-
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
144-
set(X86_64 TRUE)
145-
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "i386")
146-
set(X86 TRUE)
147-
endif()
148148
else()
149149
execute_process(
150150
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
151151
OUTPUT_VARIABLE dumpmachine_output
152152
ERROR_QUIET
153153
)
154-
if(dumpmachine_output MATCHES "^arm.*")
154+
if(dumpmachine_output MATCHES "^arm64.*")
155+
set(ARM64 TRUE)
156+
elseif(dumpmachine_output MATCHES "^arm.*")
155157
set(ARM TRUE)
156158
elseif(dumpmachine_output MATCHES "^aarch64.*")
157159
set(ARM64 TRUE)

0 commit comments

Comments
 (0)