Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Jan 22, 2024
1 parent 424e84b commit 53f6796
Show file tree
Hide file tree
Showing 32 changed files with 51 additions and 61 deletions.
16 changes: 3 additions & 13 deletions tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def convert_arg_line_to_args(self, arg_line):
"--enable_address_sanitizer", action="store_true", help="Enable address sanitizer. Windows/Linux/MacOS only."
)
# The following feature requires installing some special Visual Studio components that do not get installed by default. Therefore the options is default OFF.
parser.add_argument("--enable_qspectre", action="store_true", help="Enable Qspectre. Windows only.")
parser.add_argument("--use_preset_compile_flags", action="store_true", help="Enable Qspectre. Windows only.")
parser.add_argument(
"--disable_memleak_checker",
action="store_true",
Expand Down Expand Up @@ -1460,16 +1460,7 @@ def generate_build_tree(
for config in configs:
# Setup default values for cflags/cxxflags/ldflags.
# The values set here are purely for security and compliance purposes. ONNX Runtime should work fine without these flags.
if (
"CFLAGS" not in os.environ
and "CXXFLAGS" not in os.environ
and (not args.use_cuda or "CUDAFLAGS" not in os.environ)
and not args.ios
and not args.android
and not args.build_wasm
and not args.use_rocm
and not (is_linux() and platform.machine() != "aarch64" and platform.machine() != "x86_64")
):
if args.use_preset_compile_flags and not args.ios and not args.android and not args.build_wasm:
if is_windows():
cflags = ["/guard:cf", "/DWIN32", "/D_WINDOWS"]
njobs = number_of_parallel_jobs(args)
Expand All @@ -1489,8 +1480,7 @@ def generate_build_tree(
# The "/profile" flag implies "/DEBUG:FULL /DEBUGTYPE:cv,fixup /OPT:REF /OPT:NOICF /INCREMENTAL:NO /FIXED:NO". We set it for satisfying a Microsoft internal compliance requirement. External users
# do not need to have it.
ldflags = ["/profile", "/DYNAMICBASE"]
if args.enable_qspectre:
cflags += ["/Qspectre"]
cflags += ["/Qspectre"]
if config == "Release":
cflags += ["/O2", "/Ob2", "/DNDEBUG"]
elif config == "RelWithDebInfo":
Expand Down
6 changes: 3 additions & 3 deletions tools/ci_build/github/azure-pipelines/linux-ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ stages:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_csharp \
--enable_onnx_tests --enable_address_sanitizer \
--update --build;
Expand All @@ -102,7 +102,7 @@ stages:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_csharp \
--enable_onnx_tests --enable_address_sanitizer \
--test;"
Expand Down Expand Up @@ -228,7 +228,7 @@ stages:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--build_csharp \
--enable_onnx_tests \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--skip_tests \
--cmake_extra_defines onnxruntime_ENABLE_ATEN=ON \
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--test \
--cmake_extra_defines onnxruntime_ENABLE_ATEN=ON"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--enable_lazy_tensor --enable_training --build_wheel --skip_test \
workingDirectory: $(Build.SourcesDirectory)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--skip_tests \
--minimal_build \
--disable_exceptions \
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
--build_dir /build/5 --cmake_generator Ninja \
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--build_shared_lib --use_preset_compile_flags \
--parallel \
--minimal_build extended
workingDirectory: $(Build.SourcesDirectory)
Expand All @@ -246,7 +246,7 @@ jobs:
--skip_submodule_sync \
--build_shared_lib \
--build_wheel \
--parallel \
--parallel --use_preset_compile_flags \
--skip_tests \
--disable_ml_ops \
--disable_types sparsetensor float8 optional \
Expand All @@ -272,7 +272,7 @@ jobs:
--config MinSizeRel \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--minimal_build \
--disable_exceptions \
--disable_ml_ops \
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
--cmake_generator Ninja \
--config MinSizeRel \
--skip_submodule_sync \
--build_shared_lib \
--build_shared_lib --use_preset_compile_flags \
--parallel \
--minimal_build extended \
--disable_exceptions \
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
--cmake_generator Ninja \
--config MinSizeRel \
--skip_submodule_sync \
--parallel \
--parallel --use_preset_compile_flags \
--android \
--android_sdk_path /android_home \
--android_ndk_path /ndk_home \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
--config Release --update --build \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--enable_onnx_tests --use_cuda --cuda_version=${{parameters.CudaVersion}} --cuda_home=/usr/local/cuda-${{parameters.CudaVersion}} --cudnn_home=/usr/local/cuda-${{parameters.CudaVersion}} \
--enable_cuda_profiling --enable_cuda_nhwc_ops \
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
cd /onnxruntime_src/java && /onnxruntime_src/java/gradlew cmakeCheck -DcmakeBuildDir=/build/Release -DUSE_CUDA=1; \
cd /tmp; \
/tmp/python3 /onnxruntime_src/tools/ci_build/build.py \
--build_dir /build --config Release --test --skip_submodule_sync --build_shared_lib --parallel --build_wheel --enable_onnx_tests \
--build_dir /build --config Release --test --skip_submodule_sync --build_shared_lib --parallel --use_preset_compile_flags --build_wheel --enable_onnx_tests \
--use_cuda --cuda_version=${{parameters.CudaVersion}} --cuda_home=/usr/local/cuda --cudnn_home=/usr/local/cuda \
--enable_pybind --build_java --ctest_path '' "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--enable_onnx_tests \
--use_cuda --cuda_home=/usr/local/cuda-${{ parameters.CudaVersion }} --cudnn_home=/usr/local/cuda-${{ parameters.CudaVersion }} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
python3 tools/ci_build/build.py \
--build_dir build \
--config Release \
--parallel \
--parallel --use_preset_compile_flags \
--use_qnn \
--qnn_home $(QNN_SDK_ROOT) \
--cmake_generator=Ninja \
Expand All @@ -73,7 +73,7 @@ jobs:
- script: |
python3 tools/ci_build/build.py \
--build_dir build \
--config Release \
--config Release --use_preset_compile_flags \
--test \
--qnn_home $(QNN_SDK_ROOT) \
--cmake_generator=Ninja \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
--build_dir build \
--skip_submodule_sync \
--cmake_generator=Ninja \
--parallel \
--parallel --use_preset_compile_flags \
--build_shared_lib \
--config Debug \
--use_cache \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
--use_xcode \
--config RelWithDebInfo \
--build_apple_framework \
--parallel
--parallel --use_preset_compile_flags
displayName: (CPU, CoreML, XNNPACK EPs) Build onnxruntime for iOS x86_64 and run tests using simulator
env:
CC: clang
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
--enable_training_apis \
--cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON \
--update --skip_submodule_sync \
--build --parallel --target onnx_proto
--build --parallel --use_preset_compile_flags --target onnx_proto
displayName: Generate compile_commands.json and ONNX protobuf files
- script: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ stages:
displayName: 'Generate cmake config'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '$(BuildCommand) --path_to_protoc_exe $(Build.BinariesDirectory)\installed\bin\protoc.exe --build_csharp --update --config $(BuildConfig) ${{ variables.build_py_lto_flag }}'
arguments: '$(BuildCommand) --use_preset_compile_flags --parallel --path_to_protoc_exe $(Build.BinariesDirectory)\installed\bin\protoc.exe --build_csharp --update --config $(BuildConfig) ${{ variables.build_py_lto_flag }}'
workingDirectory: '$(Build.BinariesDirectory)'

- ${{ if notIn(parameters['sln_platform'], 'Win32', 'x64') }}:
Expand Down Expand Up @@ -176,7 +176,7 @@ stages:
python.exe -m pip install -q --upgrade %WHEEL_FILENAME%
set PATH=%PATH%;$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)
@echo %PATH%
python $(Build.SourcesDirectory)\tools\ci_build\build.py $(BuildCommand) --test --config $(BuildConfig) ${{ variables.build_py_lto_flag }}
python $(Build.SourcesDirectory)\tools\ci_build\build.py $(BuildCommand) --parallel --use_preset_compile_flags --test --config $(BuildConfig) ${{ variables.build_py_lto_flag }}
workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)'
displayName: 'Run tests'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--enable_onnx_tests \
--enable_training \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ stages:
--config Debug Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--enable_onnx_tests \
--enable_pybind --enable_training
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
buildArch: x64
setVcvars: true
ALLOW_RELEASED_ONNX_OPSET_ONLY: '1'
commonBuildArgs: '--compile_no_warning_as_error --build_dir $(Build.BinariesDirectory)\Windows --skip_submodule_sync --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --use_qnn --qnn_home C:\data\qnnsdk\${{parameters.QnnSdk}} --parallel'
commonBuildArgs: '--compile_no_warning_as_error --build_dir $(Build.BinariesDirectory)\Windows --skip_submodule_sync --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --use_qnn --qnn_home C:\data\qnnsdk\${{parameters.QnnSdk}} --parallel --use_preset_compile_flags '

steps:
- template: templates/set-version-number-variables-step.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
docker run --rm --volume /data/onnx:/data/onnx:ro --volume $(Build.SourcesDirectory):/onnxruntime_src --volume $(Build.BinariesDirectory):/build \
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx -e NIGHTLY_BUILD onnxruntimecpubuildcentos8${{parameters.OnnxruntimeArch}} /bin/bash -c "python3.9 \
/onnxruntime_src/tools/ci_build/build.py --enable_lto --build_java --build_nodejs --build_dir /build --config Release \
--skip_submodule_sync --parallel --build_shared_lib ${{ parameters.AdditionalBuildFlags }} && cd /build/Release && make install DESTDIR=/build/linux-${{parameters.OnnxruntimeArch}}"
--skip_submodule_sync --parallel --use_preset_compile_flags --build_shared_lib ${{ parameters.AdditionalBuildFlags }} && cd /build/Release && make install DESTDIR=/build/linux-${{parameters.OnnxruntimeArch}}"
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Build'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
Today: $(TODAY)
CacheDir: $(ORT_CACHE_DIR)
AdditionalKey: " $(System.StageName) | ${{ parameters.BuildConfig }} "
BuildPyArguments: '--config ${{ parameters.BuildConfig }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_csharp --update --parallel --cmake_generator "Visual Studio 17 2022" --build_shared_lib --enable_onnx_tests ${{ parameters.additionalBuildFlags }}'
BuildPyArguments: '--config ${{ parameters.BuildConfig }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_csharp --update --parallel --use_preset_compile_flags --cmake_generator "Visual Studio 17 2022" --build_shared_lib --enable_onnx_tests ${{ parameters.additionalBuildFlags }}'
MsbuildArguments: '-maxcpucount'
BuildArch: ${{ parameters.buildArch }}
Platform: ${{ parameters.msbuildPlatform }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ steps:
BuildStep:
- script: |
rm -rf $(Build.BinariesDirectory)/Release
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --update --build ${{ parameters.AdditionalBuildFlags }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_shared_lib --config Release
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --update --build ${{ parameters.AdditionalBuildFlags }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --use_preset_compile_flags --build_shared_lib --config Release
displayName: 'Build ${{ parameters.MacosArch }}'
env:
CCACHE_DIR: ${{ parameters.CacheDir }}
- ${{ if eq(parameters.MacosArch, 'x86_64') }}:
- script: |
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --test ${{ parameters.AdditionalBuildFlags }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --build_shared_lib --config Release
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --test ${{ parameters.AdditionalBuildFlags }} --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --use_preset_compile_flags --build_shared_lib --config Release
displayName: 'Running Tests'
- task: ShellScript@2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ stages:
--enable_pybind
--enable_onnx_tests
${{ parameters.build_py_parameters }}
--parallel --update
--parallel --use_preset_compile_flags --update
$(TelemetryOption)
workingDirectory: '$(Build.BinariesDirectory)'

Expand Down Expand Up @@ -383,7 +383,7 @@ stages:
set -e -x
export _PYTHON_HOST_PLATFORM=macosx-${{variables.MACOSX_DEPLOYMENT_TARGET}}-universal2
python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --use_coreml --skip_submodule_sync --parallel --config Release --build_wheel ${{ parameters.build_py_parameters }} --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64" --update --build
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --use_coreml --skip_submodule_sync --parallel --use_preset_compile_flags --config Release --build_wheel ${{ parameters.build_py_parameters }} --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64" --update --build
displayName: 'Command Line Script'
- script: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ stages:
--build_dir /build \
--config ${{ variables['buildConfig'] }} \
--skip_submodule_sync \
--parallel \
--parallel --use_preset_compile_flags \
--build_wheel \
--enable_onnx_tests \
${{ parameters.build_py_parameters }} \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ jobs:
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: >
--config RelWithDebInfo --enable_qspectre
--config RelWithDebInfo
--build_dir $(Build.BinariesDirectory)
--skip_submodule_sync
--cmake_generator "$(VSGenerator)"
--enable_pybind
--enable_onnx_tests
--parallel --update
--parallel --use_preset_compile_flags --update
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }} ${{ parameters.EP_BUILD_FLAGS }}
workingDirectory: '$(Build.BinariesDirectory)'

Expand Down
Loading

0 comments on commit 53f6796

Please sign in to comment.