Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer compile with -march=native. #46229

Merged
merged 2 commits into from Jan 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions configure.py
Expand Up @@ -526,18 +526,19 @@ def set_cc_opt_flags(environ_cp):
elif is_windows():
default_cc_opt_flags = '/arch:AVX'
else:
default_cc_opt_flags = '-Wno-sign-compare' # TODO(mihaimaruseac): Was '-march=native -Wno-sign-compare'
# On all other platforms, no longer use `-march=native` as this can result
# in instructions that are too modern being generated. Users that want
# maximum performance should compile TF in their environment and can pass
# `-march=native` there.
# See https://github.com/tensorflow/tensorflow/issues/45744 and duplicates
default_cc_opt_flags = '-Wno-sign-compare'
question = ('Please specify optimization flags to use during compilation when'
' bazel option "--config=opt" is specified [Default is %s]: '
) % default_cc_opt_flags
cc_opt_flags = get_from_env_or_user_or_default(environ_cp, 'CC_OPT_FLAGS',
question, default_cc_opt_flags)
for opt in cc_opt_flags.split():
write_to_bazelrc('build:opt --copt=%s' % opt)
# It should be safe on the same build host.
# TODO(mihaimaruseac): we removed `-march=native` above
#if not is_ppc64le() and not is_windows():
# write_to_bazelrc('build:opt --host_copt=-march=native')
write_to_bazelrc('build:opt --define with_default_optimizations=true')


Expand Down