Fix a build issue: /MP was not enabled correctly (#19190)

### Description

In PR #19073 I mistunderstood the value of "--parallel". Instead of
testing if args.parallel is None or not , I should test the returned
value of number_of_parallel_jobs function.

If build.py was invoked without --parallel, then args.parallel equals to
1. Because it is the default value. Then we should not add "/MP".
However, the current code adds it. Because if `args.paralllel` is
evaluated to `if 1` , which is True.
If build.py was invoked with --parallel with additional numbers, then
args.parallel equals to 0. Because it is unspecified. Then we should add
"/MP". However, the current code does not add it. Because `if
args.paralllel` is evaluated to `if 0` , which is False.

This also adds a new build flag: use_binskim_compliant_compile_flags, which is intended to be only used in ONNX Runtime team's build pipelines for compliance reasons. 

### Motivation and Context
This commit is contained in:
Changming Sun 2024-01-29 12:45:38 -08:00 committed by GitHub
parent 4ee222413f
commit e91d91ae4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 72 additions and 69 deletions

View file

@ -84,7 +84,7 @@ jobs:
7z x cmake-3.26.3-windows-x86_64.zip
set PYTHONHOME=$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools
set PYTHONPATH=$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools
$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools\python.exe "$(Build.SourcesDirectory)\tools\ci_build\build.py" --build_dir $(Build.BinariesDirectory) --build_shared_lib --enable_onnx_tests --ms_experimental --use_dml --use_winml --cmake_generator "Visual Studio 17 2022" --update --config RelWithDebInfo --enable_qspectre --enable_lto --use_telemetry --disable_rtti --enable_wcos $(BuildFlags) --cmake_extra_defines "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO=/PROFILE" "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO=/PROFILE" CMAKE_SYSTEM_VERSION=10.0.19041.0 --cmake_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\ctest.exe
$(Build.BinariesDirectory)\${{ parameters.PythonPackageName }}.3.9.7\tools\python.exe "$(Build.SourcesDirectory)\tools\ci_build\build.py" --build_dir $(Build.BinariesDirectory) --parallel --use_binskim_compliant_compile_flags --build_shared_lib --enable_onnx_tests --ms_experimental --use_dml --use_winml --cmake_generator "Visual Studio 17 2022" --update --config RelWithDebInfo --enable_lto --use_telemetry --disable_rtti --enable_wcos $(BuildFlags) --cmake_extra_defines "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO=/PROFILE" "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO=/PROFILE" CMAKE_SYSTEM_VERSION=10.0.19041.0 --cmake_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake-3.26.3-windows-x86_64\bin\ctest.exe
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Generate cmake config'

View file

@ -442,8 +442,8 @@ def parse_arguments():
parser.add_argument(
"--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.")
# The following flag is mostly designed to be used in ONNX Runtime's Azure DevOps/Github build pipelines. Its main purpose is to make the built binaries pass BinSkim scan.
parser.add_argument("--use_binskim_compliant_compile_flags", action="store_true", help="Use preset compile flags.")
parser.add_argument(
"--disable_memleak_checker",
action="store_true",
@ -1484,27 +1484,29 @@ def generate_build_tree(
f"-DVERSION_PRIVATE_PART={MM}{DD}",
f"-DVERSION_STRING={ort_major}.{ort_minor}.{build_number}.{source_version[0:7]}",
]
cflags = None
cxxflags = None
ldflags = None
cudaflags = []
for config in configs:
cflags = []
cxxflags = None
ldflags = None
cudaflags = []
if is_windows() and not args.ios and not args.android and not args.build_wasm:
njobs = number_of_parallel_jobs(args)
if njobs > 1:
if args.parallel == 0:
cflags += ["/MP"]
else:
cflags += ["/MP%d" % njobs]
# 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)
(args.use_binskim_compliant_compile_flags or args.enable_address_sanitizer)
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 is_windows():
cflags = ["/guard:cf", "/DWIN32", "/D_WINDOWS"]
if args.parallel:
cflags += ["/MP"]
cflags += ["/guard:cf", "/DWIN32", "/D_WINDOWS"]
if not args.use_gdk:
# Target Windows 10
cflags += [
@ -1516,7 +1518,8 @@ 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:
# Address Sanitizer libs do not have a Qspectre version. So they two cannot be both enabled.
if not args.enable_address_sanitizer:
cflags += ["/Qspectre"]
if config == "Release":
cflags += ["/O2", "/Ob2", "/DNDEBUG"]
@ -1524,13 +1527,11 @@ def generate_build_tree(
cflags += ["/O2", "/Ob1", "/DNDEBUG"]
elif config == "Debug":
cflags += ["/Ob0", "/Od", "/RTC1"]
if args.enable_address_sanitizer:
cflags += ["/fsanitize=address"]
elif config == "MinSizeRel":
cflags += ["/O1", "/Ob1", "/DNDEBUG"]
if args.enable_address_sanitizer:
cflags += ["/fsanitize=address"]
cxxflags = cflags.copy()
if not args.disable_exceptions:
cxxflags += ["/EHsc"]
if args.use_cuda:
# On Windows, nvcc passes /EHsc to the host compiler by default.
cuda_compile_flags_str = ""
@ -1590,6 +1591,8 @@ def generate_build_tree(
cxxflags = cflags.copy()
if args.use_cuda:
cudaflags = cflags.copy()
if cxxflags is None and cflags is not None and len(cflags) != 0:
cxxflags = cflags.copy()
config_build_dir = get_config_build_dir(build_dir, config)
os.makedirs(config_build_dir, exist_ok=True)
if args.use_tvm:
@ -1604,7 +1607,7 @@ def generate_build_tree(
)
preinstalled_dir = Path(build_dir) / config
temp_cmake_args = cmake_args.copy()
if cflags is not None and cxxflags is not None:
if cflags is not None and cxxflags is not None and len(cflags) != 0 and len(cxxflags) != 0:
temp_cmake_args += [
"-DCMAKE_C_FLAGS=%s" % (" ".join(cflags)),
"-DCMAKE_CXX_FLAGS=%s" % (" ".join(cxxflags)),

View file

@ -93,7 +93,7 @@ stages:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_csharp \
--enable_onnx_tests --enable_address_sanitizer \
--update --build;
@ -102,7 +102,7 @@ stages:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_csharp \
--enable_onnx_tests --enable_address_sanitizer \
--test;"
@ -228,7 +228,7 @@ stages:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--build_csharp \
--enable_onnx_tests \

View file

@ -94,7 +94,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--skip_tests \
--cmake_extra_defines onnxruntime_ENABLE_ATEN=ON \
@ -126,7 +126,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--test \
--cmake_extra_defines onnxruntime_ENABLE_ATEN=ON"

View file

@ -80,7 +80,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--enable_lazy_tensor --enable_training --build_wheel --skip_test \
workingDirectory: $(Build.SourcesDirectory)

View file

@ -141,7 +141,7 @@ jobs:
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--skip_tests \
--minimal_build \
--disable_exceptions \
@ -222,7 +222,7 @@ jobs:
--build_dir /build/5 --cmake_generator Ninja \
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--build_shared_lib --use_binskim_compliant_compile_flags \
--parallel \
--minimal_build extended
workingDirectory: $(Build.SourcesDirectory)
@ -246,7 +246,7 @@ jobs:
--skip_submodule_sync \
--build_shared_lib \
--build_wheel \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--skip_tests \
--disable_ml_ops \
--disable_types sparsetensor float8 optional \
@ -272,7 +272,7 @@ jobs:
--config MinSizeRel \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--minimal_build \
--disable_exceptions \
--disable_ml_ops \
@ -300,7 +300,7 @@ jobs:
--cmake_generator Ninja \
--config MinSizeRel \
--skip_submodule_sync \
--build_shared_lib \
--build_shared_lib --use_binskim_compliant_compile_flags \
--parallel \
--minimal_build extended \
--disable_exceptions \
@ -330,7 +330,7 @@ jobs:
--cmake_generator Ninja \
--config MinSizeRel \
--skip_submodule_sync \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--android \
--android_sdk_path /android_home \
--android_ndk_path /ndk_home \

View file

@ -131,7 +131,7 @@ jobs:
--config Release --update --build \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_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 \
@ -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_binskim_compliant_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 '' "

View file

@ -114,7 +114,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--enable_onnx_tests \
--use_cuda --cuda_home=/usr/local/cuda-${{ parameters.CudaVersion }} --cudnn_home=/usr/local/cuda-${{ parameters.CudaVersion }} \

View file

@ -63,7 +63,7 @@ jobs:
python3 tools/ci_build/build.py \
--build_dir build \
--config Release \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--use_qnn \
--qnn_home $(QNN_SDK_ROOT) \
--cmake_generator=Ninja \
@ -73,7 +73,7 @@ jobs:
- script: |
python3 tools/ci_build/build.py \
--build_dir build \
--config Release \
--config Release --use_binskim_compliant_compile_flags \
--test \
--qnn_home $(QNN_SDK_ROOT) \
--cmake_generator=Ninja \

View file

@ -57,7 +57,7 @@ jobs:
--build_dir build \
--skip_submodule_sync \
--cmake_generator=Ninja \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_shared_lib \
--config Debug \
--use_cache \

View file

@ -62,7 +62,7 @@ jobs:
--use_xcode \
--config RelWithDebInfo \
--build_apple_framework \
--parallel
--parallel --use_binskim_compliant_compile_flags
displayName: (CPU, CoreML, XNNPACK EPs) Build onnxruntime for iOS x86_64 and run tests using simulator
env:
CC: clang

View file

@ -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_binskim_compliant_compile_flags --target onnx_proto
displayName: Generate compile_commands.json and ONNX protobuf files
- script: |

View file

@ -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_binskim_compliant_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') }}:
@ -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_binskim_compliant_compile_flags --test --config $(BuildConfig) ${{ variables.build_py_lto_flag }}
workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)'
displayName: 'Run tests'

View file

@ -102,7 +102,7 @@ jobs:
--config Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--enable_onnx_tests \
--enable_training \

View file

@ -69,7 +69,7 @@ stages:
--config Debug Release \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--enable_onnx_tests \
--enable_pybind --enable_training

View file

@ -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_binskim_compliant_compile_flags '
steps:
- template: templates/set-version-number-variables-step.yml

View file

@ -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_binskim_compliant_compile_flags --build_shared_lib ${{ parameters.AdditionalBuildFlags }} && cd /build/Release && make install DESTDIR=/build/linux-${{parameters.OnnxruntimeArch}}"
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Build'

View file

@ -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_binskim_compliant_compile_flags --cmake_generator "Visual Studio 17 2022" --build_shared_lib --enable_onnx_tests ${{ parameters.additionalBuildFlags }}'
MsbuildArguments: '-maxcpucount'
BuildArch: ${{ parameters.buildArch }}
Platform: ${{ parameters.msbuildPlatform }}

View file

@ -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_binskim_compliant_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_binskim_compliant_compile_flags --build_shared_lib --config Release
displayName: 'Running Tests'
- task: ShellScript@2

View file

@ -182,7 +182,7 @@ stages:
--enable_pybind
--enable_onnx_tests
${{ parameters.build_py_parameters }}
--parallel --update
--parallel --use_binskim_compliant_compile_flags --update
$(TelemetryOption)
workingDirectory: '$(Build.BinariesDirectory)'
@ -388,7 +388,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_binskim_compliant_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: |

View file

@ -171,7 +171,7 @@ stages:
--build_dir /build \
--config ${{ variables['buildConfig'] }} \
--skip_submodule_sync \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--enable_onnx_tests \
${{ parameters.build_py_parameters }} \

View file

@ -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_binskim_compliant_compile_flags --update
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }} ${{ parameters.EP_BUILD_FLAGS }}
workingDirectory: '$(Build.BinariesDirectory)'

View file

@ -150,9 +150,9 @@ stages:
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
${{ if eq(parameters['UseIncreasedTimeoutForTests'], 'true') }}:
arguments: '--config RelWithDebInfo --enable_qspectre --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} --test_all_timeout 72000'
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} --test_all_timeout 72000'
${{ else }}:
arguments: '--config RelWithDebInfo --enable_qspectre --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} '
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }} '
workingDirectory: '$(Build.BinariesDirectory)'
- task: VSBuild@1
@ -172,7 +172,7 @@ stages:
condition: and(succeeded(), eq('${{ parameters.runTests}}', true))
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '--config RelWithDebInfo --enable_qspectre --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }}'
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "$(VSGenerator)" --enable_onnx_tests $(TelemetryOption) ${{ parameters.buildparameter }}'
workingDirectory: '$(Build.BinariesDirectory)'
- script: |

View file

@ -74,7 +74,7 @@ stages:
displayName: 'Build and Test'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: --config Debug --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --cmake_generator "Visual Studio 17 2022" --disable_memleak_checker --enable_address_sanitizer
arguments: --config Debug --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --use_binskim_compliant_compile_flags --cmake_generator "Visual Studio 17 2022" --disable_memleak_checker --enable_address_sanitizer
workingDirectory: '$(Build.BinariesDirectory)'

View file

@ -54,7 +54,7 @@ jobs:
WithCache: True
Today: $(TODAY)
AdditionalKey: "gpu-tensorrt | RelWithDebInfo"
BuildPyArguments: '--config RelWithDebInfo --enable_qspectre --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 17 2022" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-8.6.1.6.Windows10.x86_64.cuda-11.8" --cuda_home="$(Agent.TempDirectory)\v11.8" --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=75'
BuildPyArguments: '--config RelWithDebInfo --parallel --use_binskim_compliant_compile_flags --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 17 2022" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-8.6.1.6.Windows10.x86_64.cuda-11.8" --cuda_home="$(Agent.TempDirectory)\v11.8" --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=75'
MsbuildArguments: $(MsbuildArguments)
BuildArch: 'x64'
Platform: 'x64'
@ -74,7 +74,7 @@ jobs:
del wheel_filename_file
python.exe -m pip install -q --upgrade %WHEEL_FILENAME%
set PATH=$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo;%PATH%
python $(Build.SourcesDirectory)\tools\ci_build\build.py --config RelWithDebInfo --enable_qspectre --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 17 2022" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-8.6.1.6.Windows10.x86_64.cuda-11.8" --cuda_home="$(Agent.TempDirectory)\v11.8" --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=75
python $(Build.SourcesDirectory)\tools\ci_build\build.py --config RelWithDebInfo --use_binskim_compliant_compile_flags --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --cmake_generator "Visual Studio 17 2022" --build_wheel --enable_onnx_tests --use_tensorrt --tensorrt_home="C:\local\TensorRT-8.6.1.6.Windows10.x86_64.cuda-11.8" --cuda_home="$(Agent.TempDirectory)\v11.8" --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=75
workingDirectory: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
displayName: 'Run tests'

View file

@ -76,7 +76,7 @@ jobs:
WithCache: True
Today: $(TODAY)
AdditionalKey: "win-qnn | $(BuildConfig)"
BuildPyArguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --compile_no_warning_as_error --update --cmake_generator "Visual Studio 17 2022" --use_qnn --qnn_home $(QNN_SDK_ROOT) --parallel'
BuildPyArguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --compile_no_warning_as_error --update --cmake_generator "Visual Studio 17 2022" --use_qnn --qnn_home $(QNN_SDK_ROOT) --parallel --use_binskim_compliant_compile_flags'
MsbuildArguments: $(MsbuildArguments)
BuildArch: $(buildArch)
Platform: 'x64'

View file

@ -4,6 +4,6 @@ docker run --gpus all -e NVIDIA_VISIBLE_DEVICES=all --rm --volume \
$BUILD_SOURCESDIRECTORY:/onnxruntime_src --volume $BUILD_BINARIESDIRECTORY:/build \
--volume /data/models:/build/models:ro --volume /data/onnx:/data/onnx:ro -e NIGHTLY_BUILD onnxruntimecuda${CUDA_VERSION_MAJOR}build \
/usr/bin/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 --use_cuda --cuda_version=$CUDA_VERSION \
--skip_submodule_sync --parallel --use_binskim_compliant_compile_flags --build_shared_lib --use_cuda --cuda_version=$CUDA_VERSION \
--cuda_home=/usr/local/cuda-$CUDA_VERSION --cudnn_home=/usr/local/cuda-$CUDA_VERSION \
--cmake_extra_defines 'CMAKE_CUDA_ARCHITECTURES=60;61;70;75;80'

View file

@ -23,7 +23,7 @@ c) BUILD_CONFIG=${OPTARG};;
esac
done
BUILD_ARGS=("--build_dir" "/build" "--config" "$BUILD_CONFIG" "--update" "--build" "--skip_submodule_sync" "--parallel" "--build_wheel")
BUILD_ARGS=("--build_dir" "/build" "--config" "$BUILD_CONFIG" "--update" "--build" "--skip_submodule_sync" "--parallel" "--use_binskim_compliant_compile_flags" "--build_wheel")
if [ "$BUILD_CONFIG" != "Debug" ]; then
BUILD_ARGS+=("--enable_lto")

View file

@ -4,4 +4,4 @@ mkdir -p $HOME/.onnx
docker run --gpus all -e CFLAGS -e CXXFLAGS -e NVIDIA_VISIBLE_DEVICES=all --rm --volume /data/onnx:/data/onnx:ro --volume $BUILD_SOURCESDIRECTORY:/onnxruntime_src --volume $BUILD_BINARIESDIRECTORY:/build \
--volume /data/models:/build/models:ro --volume $HOME/.onnx:/home/onnxruntimedev/.onnx -e NIGHTLY_BUILD onnxruntimecuda${CUDA_VERSION_MAJOR}xtrt86build \
/opt/python/cp38-cp38/bin/python3 /onnxruntime_src/tools/ci_build/build.py --build_dir /build --config Release \
--skip_submodule_sync --parallel --build_shared_lib --build_java --build_nodejs --use_tensorrt --cuda_version=$CUDA_VERSION --cuda_home=/usr/local/cuda-$CUDA_VERSION --cudnn_home=/usr --tensorrt_home=/usr --cmake_extra_defines 'CMAKE_CUDA_ARCHITECTURES=60;61;70;75;80'
--skip_submodule_sync --parallel --use_binskim_compliant_compile_flags --build_shared_lib --build_java --build_nodejs --use_tensorrt --cuda_version=$CUDA_VERSION --cuda_home=/usr/local/cuda-$CUDA_VERSION --cudnn_home=/usr --tensorrt_home=/usr --cmake_extra_defines 'CMAKE_CUDA_ARCHITECTURES=60;61;70;75;80'

View file

@ -22,7 +22,7 @@ python3 /onnxruntime_src/tools/ci_build/build.py \
--build_dir ${BUILD_DIR} --cmake_generator Ninja \
--config Debug \
--skip_submodule_sync \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--build_wheel \
--skip_tests \
--enable_training_ops \

View file

@ -72,7 +72,7 @@ python3 /onnxruntime_src/tools/ci_build/build.py \
--config Debug \
--skip_submodule_sync \
--build_shared_lib \
--parallel \
--parallel --use_binskim_compliant_compile_flags \
--minimal_build ${MINIMAL_BUILD_ARGS} \
--disable_ml_ops \
--include_ops_by_config ${REDUCED_OPS_CONFIG_FILE} \

View file

@ -37,7 +37,7 @@ if [ $BUILD_OS = "yocto" ]; then
make -j$(nproc)
else
COMMON_BUILD_ARGS="--skip_submodule_sync --enable_onnx_tests --parallel --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest"
COMMON_BUILD_ARGS="--skip_submodule_sync --enable_onnx_tests --parallel --use_binskim_compliant_compile_flags --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest"
if [ $BUILD_DEVICE = "gpu" ]; then
_CUDNN_VERSION=$(echo $CUDNN_VERSION | cut -d. -f1-2)

View file

@ -24,5 +24,5 @@ python3 -m pip install $build_dir/$config/dist/*.whl
echo Run $config unit tests
pushd $build_dir/$config/
python3 $src_dir/tools/ci_build/build.py --build_dir $build_dir --cmake_generator Ninja --config $config --test --skip_submodule_sync --build_shared_lib --parallel --build_wheel --enable_onnx_tests --enable_transformers_tool_test --ctest_path ""
python3 $src_dir/tools/ci_build/build.py --build_dir $build_dir --cmake_generator Ninja --config $config --test --skip_submodule_sync --build_shared_lib --parallel --use_binskim_compliant_compile_flags --build_wheel --enable_onnx_tests --enable_transformers_tool_test --ctest_path ""
popd