From feec8efae4b2d4e8d7766fa0bf40225c615fab2c Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Wed, 12 Jun 2024 14:23:00 -0700 Subject: [PATCH] Add "-allow-unsupported-compiler" flags to Windows CUDA flags (#21004) ### Description Add "-allow-unsupported-compiler" flags to Windows CUDA flags. This change only impacts our pipelines. By default it would not reach this code path. ### Motivation and Context nvcc refuses working with the latest VS toolset unless this flag is set. If without this change, our CI build will fail with the compiler is the latest VS 2022 17.10. Here is the log: https://dev.azure.com/onnxruntime/onnxruntime/_build/results?buildId=1405549&view=logs&j=6df8fe70-7b8f-505a-8ef0-8bf93da2bac7&t=c7e55e04-f02b-57dc-d19a-29b7d3528c44&l=715 The error message is: `D:\a\_work\_temp\v11.8\include\crt/host_config.h(153): fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. [D:\a\_work\1\b\RelWithDebInfo\CMakeFiles\CMakeScratch\TryCompile-g5rudf\cmTC_7b8ff.vcxproj]` --- tools/ci_build/build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index f2f450b93d131..857c8499092bf 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -1589,6 +1589,7 @@ def generate_build_tree( cuda_compile_flags_str = cuda_compile_flags_str + " " + compile_flag if len(cuda_compile_flags_str) != 0: cudaflags.append('-Xcompiler="%s"' % cuda_compile_flags_str) + cudaflags.append("-allow-unsupported-compiler") elif is_linux() or is_macOS(): if is_linux(): ldflags = ["-Wl,-Bsymbolic-functions", "-Wl,-z,relro", "-Wl,-z,now", "-Wl,-z,noexecstack"]