diff --git a/.bazelrc b/.bazelrc index 03208385283..b81b153e02c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -602,6 +602,10 @@ build:release_windows_common --config=release_common build:release_windows_common --define=no_tensorflow_py_deps=true build:release_windows_common --announce_rc +# First available in VS 16.4. Speeds Windows compile times by a lot. See +# https://groups.google.com/a/tensorflow.org/d/topic/build/SsW98Eo7l3o/discussion +build:release_windows_common --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions + build:release_cpu_windows --config=release_windows_common build:release_gpu_windows --config=release_windows_common diff --git a/RELEASE.md b/RELEASE.md index 765f0d790be..237e03f11fa 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -60,6 +60,11 @@ (`tf.Graph` or `tf.compat.v1.GraphDef`) as a summary. This is not a replacement for the trace-based API. +* Set `/d2ReducedOptimizeHugeFunctions` by default for Windows builds. This + provides a big compile-time speedup, and effectively raises the minimum + supported MSVC version to 16.4 (current: 16.8). + * See: https://groups.google.com/a/tensorflow.org/d/topic/build/SsW98Eo7l3o/discussion + ## Thanks to our Contributors This release contains contributions from many people at Google, as well as: diff --git a/configure.py b/configure.py index 2f9902bc93e..6566afe76ec 100644 --- a/configure.py +++ b/configure.py @@ -1168,41 +1168,13 @@ def set_system_libs_flag(environ_cp): write_to_bazelrc('build --define=%s=%s' % (varname, environ_cp[varname])) -def is_reduced_optimize_huge_functions_available(environ_cp): - """Check to see if the system supports /d2ReducedOptimizeHugeFunctions. - - The above compiler flag is a new compiler flag introduced to the Visual Studio - compiler in version 16.4 (available in Visual Studio 2019, Preview edition - only, as of 2019-11-19). TensorFlow needs this flag to massively reduce - compile times, but until 16.4 is officially released, we can't depend on it. - - See also - https://groups.google.com/a/tensorflow.org/d/topic/build/SsW98Eo7l3o/discussion - - Because it's very annoying to check this manually (to check the MSVC installed - versions, you need to use the registry, and it's not clear if Bazel will be - using that install version anyway), we expect enviroments who know they may - use this flag to export TF_VC_VERSION=16.4 - - TODO(angerson, gunan): Remove this function when TensorFlow's minimum VS - version is upgraded to 16.4. - - Arguments: - environ_cp: Environment of the current execution - - Returns: - boolean, whether or not /d2ReducedOptimizeHugeFunctions is available on this - machine. - """ - return float(environ_cp.get('TF_VC_VERSION', '0')) >= 16.4 - - def set_windows_build_flags(environ_cp): """Set Windows specific build options.""" - if is_reduced_optimize_huge_functions_available(environ_cp): - write_to_bazelrc( - 'build --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions' - ) + + # First available in VS 16.4. Speeds up Windows compile times by a lot. See + # https://groups.google.com/a/tensorflow.org/d/topic/build/SsW98Eo7l3o/discussion + # pylint: disable=line-too-long + write_to_bazelrc('build --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions') if get_var( environ_cp, 'TF_OVERRIDE_EIGEN_STRONG_INLINE', 'Eigen strong inline',