Skip to content

Commit d79b3ed

Browse files
authored
Merge branch 'microsoft:main' into img_patch1
2 parents 35d7d29 + 20d9464 commit d79b3ed

File tree

502 files changed

+14004
-25109
lines changed

Some content is hidden

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

502 files changed

+14004
-25109
lines changed

.github/workflows/mac.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,90 @@ jobs:
5858
--use_xnnpack \
5959
--use_binskim_compliant_compile_flags
6060
61+
Vcpkg:
62+
runs-on: macos-13
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: actions/setup-python@v5
66+
with:
67+
python-version: ${{ env.python_version }}
68+
69+
- name: "Run vcpkg(x64-osx)"
70+
uses: lukka/run-vcpkg@v11
71+
with:
72+
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
73+
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
74+
runVcpkgInstall: true
75+
vcpkgJsonGlob: "cmake/vcpkg.json"
76+
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
77+
env:
78+
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
79+
VCPKG_DEFAULT_TRIPLET: "x64-osx"
80+
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
81+
82+
- name: "Run compile_schema.py"
83+
run: |
84+
# Runner's host triplet should be x64-osx or arm64-osx
85+
export FLATC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/flatbuffers"
86+
export PATH="$FLATC_DIR:$PATH"
87+
flatc --version
88+
python onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc "$(which flatc)"
89+
90+
- name: "Detect protoc"
91+
id: protoc-detect
92+
run: |
93+
export PROTOC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/protobuf"
94+
export PATH="$PROTOC_DIR:$PATH"
95+
protoc --version
96+
echo "protoc_path=$(which protoc)" >> "$GITHUB_OUTPUT"
97+
98+
- name: "Run build.py(x64-osx)"
99+
run: |
100+
python ./tools/ci_build/build.py \
101+
--build_dir "build/x64-osx" \
102+
--skip_submodule_sync \
103+
--skip_tests \
104+
--compile_no_warning_as_error \
105+
--parallel \
106+
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
107+
--osx_arch x86_64 \
108+
--use_vcpkg \
109+
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
110+
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=x64-osx" \
111+
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
112+
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
113+
shell: bash
114+
115+
- name: "Run vcpkg(arm64-osx)"
116+
uses: lukka/run-vcpkg@v11
117+
with:
118+
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
119+
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
120+
runVcpkgInstall: true
121+
vcpkgJsonGlob: "cmake/vcpkg.json"
122+
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
123+
env:
124+
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
125+
VCPKG_DEFAULT_TRIPLET: "arm64-osx"
126+
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
127+
128+
- name: "Run build.py(arm64-osx)"
129+
run: |
130+
python ./tools/ci_build/build.py \
131+
--build_dir "build/arm64-osx" \
132+
--skip_submodule_sync \
133+
--skip_tests \
134+
--compile_no_warning_as_error \
135+
--parallel \
136+
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
137+
--osx_arch arm64 \
138+
--use_vcpkg \
139+
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
140+
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=arm64-osx" \
141+
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
142+
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
143+
shell: bash
144+
61145
Objective-C-StaticAnalysis:
62146
runs-on: macos-14
63147

.github/workflows/publish-c-apidocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ jobs:
4949
with:
5050
name: onnxruntime-c-apidocs
5151
path: _site
52-
retention-days: 60
52+
retention-days: 30

.github/workflows/publish-csharp-apidocs.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,25 @@ jobs:
2828
- name: Setup .NET
2929
uses: actions/setup-dotnet@v4
3030
with:
31-
dotnet-version: 6.0.x
31+
dotnet-version: 8.0.x
32+
- name: Install DocFX
33+
run: |
34+
dotnet tool update -g docfx
35+
# NOTE: We need to restore Microsoft.ML.OnnxRuntime.csproj manually to set IncludeMobileTargets=false
36+
# docfx doesn't seem to be able to do that properly resulting in build errors
3237
- name: Restore dependencies
33-
run: dotnet restore csharp/ApiDocs/ApiDocs.csproj
34-
- name: Download DocFX
3538
run: |
36-
mkdir -p build/docfx
37-
wget https://github.com/dotnet/docfx/releases/download/v${DOCFXVERSION}/docfx-linux-x64-v${DOCFXVERSION}.zip -O build/docfx/docfx.zip
38-
unzip build/docfx/docfx.zip -d build/docfx
39-
- name: Install NuGet
40-
uses: nuget/setup-nuget@v2
41-
- name: Build Documentation
39+
dotnet restore csharp/ApiDocs/ApiDocs.csproj
40+
dotnet restore /p:IncludeMobileTargets=false csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj
41+
- name: docfx metadata
42+
run: |
43+
docfx metadata csharp/ApiDocs/docfx.json
44+
- name: Build ApiDocs project
4245
run: |
43-
build/docfx/docfx metadata csharp/ApiDocs/docfx.json
4446
dotnet build csharp/ApiDocs/ApiDocs.csproj --no-restore
45-
build/docfx/docfx build csharp/ApiDocs/docfx.json
47+
- name: docfx build
48+
run: |
49+
docfx build csharp/ApiDocs/docfx.json
4650
- name: Log source commit
4751
run: git rev-parse --short HEAD > csharp/ApiDocs/csharp/source-version.txt
4852
- name: Move C# docs into site
@@ -55,4 +59,4 @@ jobs:
5559
with:
5660
name: onnxruntime-csharp-apidocs
5761
path: _site
58-
retention-days: 60
62+
retention-days: 30

.github/workflows/publish-java-apidocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
with:
4848
name: onnxruntime-java-apidocs
4949
path: _site
50-
retention-days: 60
50+
retention-days: 30

.github/workflows/publish-js-apidocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
with:
4848
name: onnxruntime-node-apidocs
4949
path: _site
50-
retention-days: 60
50+
retention-days: 30

.github/workflows/publish-objectivec-apidocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ jobs:
4848
with:
4949
name: onnxruntime-objectivec-apidocs
5050
path: ./_site
51-
retention-days: 60
51+
retention-days: 30

.github/workflows/publish-python-apidocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ jobs:
5353
with:
5454
name: onnxruntime-python-apidocs
5555
path: _site
56-
retention-days: 60
56+
retention-days: 30

.github/workflows/windows.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,90 @@ jobs:
4242
# The build machine doesn't have a GPU. So the value of CMAKE_CUDA_ARCHITECTURES doesn't matter.
4343
- name: Build code
4444
run: python tools\ci_build\build.py --windows_sdk_version 10.0.22621.0 --enable_training --build_java --config Debug --build_dir D:\b --skip_submodule_sync --build_csharp --update --build --parallel --cmake_generator "Visual Studio 17 2022" --build_shared_lib --enable_pybind --use_cuda --cuda_home=${{ github.workspace }}\cuda_sdk\v12.2 --enable_cuda_profiling --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=75
45+
46+
Vcpkg:
47+
runs-on: "windows-latest"
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: actions/setup-python@v5
51+
with:
52+
python-version: '3.11.x'
53+
architecture: 'x64'
54+
55+
- name: "Run vcpkg(x64-windows)"
56+
uses: lukka/run-vcpkg@v11
57+
with:
58+
vcpkgDirectory: "C:/vcpkg" # use VCPKG_INSTALLATION_ROOT of the image
59+
doNotUpdateVcpkg: true
60+
runVcpkgInstall: true
61+
vcpkgJsonGlob: "cmake/vcpkg.json"
62+
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
63+
env:
64+
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
65+
VCPKG_DEFAULT_TRIPLET: "x64-windows"
66+
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
67+
68+
- name: "Run compile_schema.py"
69+
run: |
70+
# Runner's host triplet should be x64-windows or arm64-windows
71+
$FLATC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-windows/tools/flatbuffers"
72+
$env:PATH="$FLATC_DIR;$env:PATH"
73+
flatc --version
74+
$FLATC_PATH = Join-Path "$FLATC_DIR" "flatc.exe"
75+
python onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc "$FLATC_PATH"
76+
shell: pwsh
77+
78+
- name: "Detect protoc"
79+
id: protoc-detect
80+
run: |
81+
$PROTOC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-windows/tools/protobuf"
82+
$env:PATH="$PROTOC_DIR;$env:PATH"
83+
protoc --version
84+
$PROTOC_PATH = Join-Path "$PROTOC_DIR" "protoc.exe"
85+
"protoc_path=$PROTOC_PATH" >> $env:GITHUB_OUTPUT
86+
shell: pwsh
87+
88+
- name: "Run build.py(x64-windows)"
89+
run: |
90+
python tools\ci_build\build.py `
91+
--build_dir "cmake_build/x64-windows" `
92+
--skip_submodule_sync `
93+
--skip_tests `
94+
--compile_no_warning_as_error `
95+
--parallel `
96+
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" `
97+
--use_vcpkg `
98+
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
99+
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=x64-windows" `
100+
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" `
101+
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
102+
shell: pwsh
103+
104+
- name: "Run vcpkg(arm64-windows)"
105+
uses: lukka/run-vcpkg@v11
106+
with:
107+
vcpkgDirectory: "C:/vcpkg" # use VCPKG_INSTALLATION_ROOT of the image
108+
doNotUpdateVcpkg: true
109+
runVcpkgInstall: true
110+
vcpkgJsonGlob: "cmake/vcpkg.json"
111+
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
112+
env:
113+
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
114+
VCPKG_DEFAULT_TRIPLET: "arm64-windows"
115+
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
116+
117+
- name: "Run build.py(arm64-windows)"
118+
run: |
119+
python tools\ci_build\build.py `
120+
--build_dir "cmake_build/arm64-windows" --arm64 `
121+
--skip_submodule_sync `
122+
--skip_tests `
123+
--compile_no_warning_as_error `
124+
--parallel `
125+
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" `
126+
--use_vcpkg `
127+
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
128+
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=arm64-windows" `
129+
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" `
130+
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
131+
shell: pwsh

.vscode/settings.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,5 @@
2222
"-build/include_subdir",
2323
"-runtime/references"
2424
],
25-
"files.associations": {
26-
"span": "cpp"
27-
}
25+
"C_Cpp.autoAddFileAssociations": false
2826
}

NuGet.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<packageSources>
77
<clear />
88
<add key="NuGet Official" value="https://api.nuget.org/v3/index.json" />
9+
<add key="MAUI DeviceRunners" value="https://pkgs.dev.azure.com/mattleibow/OpenSource/_packaging/test-device-runners/nuget/v3/index.json" />
10+
<add key="XHarness" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
911
</packageSources>
1012
<disabledPackageSources>
1113
<clear />

cgmanifests/cgmanifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@
469469
"type": "pip",
470470
"pip": {
471471
"Name": "transformers",
472-
"Version": "4.36.0"
472+
"Version": "4.38.0"
473473
},
474474
"comments": "Installed in the training docker image"
475475
}

cgmanifests/generated/cgmanifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,16 @@
361361
},
362362
"comments": "cudnn_frontend"
363363
}
364+
},
365+
{
366+
"component": {
367+
"type": "git",
368+
"git": {
369+
"commitHash": "511eb80847afe6bded34ec491a38d5d78ba2d604",
370+
"repositoryUrl": "https://github.com/google/dawn.git"
371+
},
372+
"comments": "dawn"
373+
}
364374
}
365375
]
366376
}

cmake/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ include(CheckLanguage)
3838
include(CMakeDependentOption)
3939
include(FetchContent)
4040
include(CheckFunctionExists)
41+
include(GNUInstallDirs) # onnxruntime_providers_* require CMAKE_INSTALL_* variables
4142

4243
# TODO: update this once all system adapt c++20
4344
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@@ -69,6 +70,7 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_
6970
endif()
7071

7172
# Options
73+
option(onnxruntime_USE_VCPKG "Build with the vcpkg package manager" OFF)
7274
option(onnxruntime_RUN_ONNX_TESTS "Enable ONNX Compatibility Testing" OFF)
7375
option(onnxruntime_GENERATE_TEST_REPORTS "Enable test report generation" OFF)
7476
option(onnxruntime_ENABLE_STATIC_ANALYSIS "Enable static analysis" OFF)
@@ -413,8 +415,8 @@ endif(MSVC_Z7_OVERRIDE)
413415
set_msvc_c_cpp_compiler_warning_level(3)
414416

415417
# Fuzz test has only been tested with BUILD_SHARED_LIB option,
416-
# using the MSVC compiler and on windows OS.
417-
if (MSVC AND WIN32 AND onnxruntime_FUZZ_TEST AND onnxruntime_BUILD_SHARED_LIB AND onnxruntime_USE_FULL_PROTOBUF)
418+
# using the MSVC compiler and on windows OS and clang/gcc compiler on Linux.
419+
if (onnxruntime_FUZZ_TEST AND onnxruntime_BUILD_SHARED_LIB AND onnxruntime_USE_FULL_PROTOBUF)
418420
# Fuzz test library dependency, protobuf-mutator,
419421
# needs the onnx message to be compiled using "non-lite protobuf version"
420422
set(onnxruntime_FUZZ_ENABLED ON)
@@ -595,6 +597,7 @@ get_filename_component(ORTTRAINING_ROOT "${ORTTRAINING_ROOT}" ABSOLUTE)
595597
get_filename_component(REPO_ROOT "${REPO_ROOT}" ABSOLUTE)
596598
set(ONNXRUNTIME_INCLUDE_DIR ${REPO_ROOT}/include/onnxruntime)
597599

600+
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external)
598601
include(external/onnxruntime_external_deps.cmake)
599602

600603
set(ORT_WARNING_FLAGS)
@@ -1041,6 +1044,9 @@ function(onnxruntime_set_compile_flags target_name)
10411044
#external/protobuf/src/google/protobuf/arena.h:445:18: error: unused parameter 'p'
10421045
target_compile_options(${target_name} PRIVATE "-Wno-unused-parameter")
10431046
endif()
1047+
if (CMAKE_CXX_COMPILER_ID STREQUAL "IBMClang")
1048+
target_compile_options(${target_name} PRIVATE "-Wno-unused-function")
1049+
endif()
10441050
target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11)
10451051
onnxruntime_add_include_to_target(${target_name} nsync::nsync_cpp)
10461052
endif()

0 commit comments

Comments
 (0)