mirror of
https://github.com/zebrajr/tensorflow.git
synced 2026-01-15 12:15:41 +00:00
Enable /d2ReducedOptimizeHugeFunctions on Windows by default
This flag was first made available in Visual Studio 16.4, (as of 2020-11-11, VS is at version 16.8), and can now be considered generally available. See also #38254 PiperOrigin-RevId: 342158585 Change-Id: Ice96be9a1392313357b314407262a005a2436a4d
This commit is contained in:
committed by
TensorFlower Gardener
parent
ac9d374a7b
commit
9983bb3dee
4
.bazelrc
4
.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
|
||||
|
||||
@@ -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:
|
||||
|
||||
38
configure.py
38
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',
|
||||
|
||||
Reference in New Issue
Block a user