aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorGravatar Martin Wicke <wicke@google.com>2016-12-14 15:46:53 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-12-14 16:04:11 -0800
commit2e4869af1afe55135d522142be3a2a483162a1b1 (patch)
treec676b228682e796ff0c2896b20faf97b66b8a1f2 /third_party
parent811629aed466db32eeefbd60783e199d2fe154a9 (diff)
Merge changes from github.
Change: 142074581
Diffstat (limited to 'third_party')
-rwxr-xr-xthird_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl12
-rw-r--r--third_party/gpus/cuda_configure.bzl13
-rwxr-xr-xthird_party/sycl/crosstool/computecpp.tpl42
-rw-r--r--third_party/sycl/sycl_configure.bzl11
4 files changed, 55 insertions, 23 deletions
diff --git a/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl b/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
index d3bb93c036..b7d6cc61dd 100755
--- a/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
+++ b/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc.tpl
@@ -53,6 +53,7 @@ CURRENT_DIR = os.path.dirname(sys.argv[0])
NVCC_PATH = CURRENT_DIR + '/../../../cuda/bin/nvcc'
LLVM_HOST_COMPILER_PATH = ('/usr/bin/gcc')
PREFIX_DIR = os.path.dirname(GCC_HOST_COMPILER_PATH)
+NVCC_VERSION = '%{cuda_version}'
def Log(s):
print('gpus/crosstool: {0}'.format(s))
@@ -114,6 +115,14 @@ def GetHostCompilerOptions(argv):
return opts
+def _update_options(nvcc_options):
+ if NVCC_VERSION in ("7.0",):
+ return nvcc_options
+
+ update_options = { "relaxed-constexpr" : "expt-relaxed-constexpr" }
+ return [ update_options[opt] if opt in update_options else opt
+ for opt in nvcc_options ]
+
def GetNvccOptions(argv):
"""Collect the -nvcc_options values from argv.
@@ -130,7 +139,8 @@ def GetNvccOptions(argv):
args, _ = parser.parse_known_args(argv)
if args.nvcc_options:
- return ' '.join(['--'+a for a in sum(args.nvcc_options, [])])
+ options = _update_options(sum(args.nvcc_options, []))
+ return ' '.join(['--'+a for a in options])
return ''
diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl
index 06694d902c..1db24435e9 100644
--- a/third_party/gpus/cuda_configure.bzl
+++ b/third_party/gpus/cuda_configure.bzl
@@ -584,6 +584,18 @@ def _create_dummy_repository(repository_ctx):
"%{curand_lib}": _lib_name("curand", cpu_value),
"%{cupti_lib}": _lib_name("cupti", cpu_value),
})
+ _tpl(repository_ctx, "cuda:BUILD",
+ {
+ "%{cudart_static_lib}": _lib_name("cudart_static", cpu_value,
+ static=True),
+ "%{cudart_static_linkopt}": _cudart_static_linkopt(cpu_value),
+ "%{cudart_lib}": _lib_name("cudart", cpu_value),
+ "%{cublas_lib}": _lib_name("cublas", cpu_value),
+ "%{cudnn_lib}": _lib_name("cudnn", cpu_value),
+ "%{cufft_lib}": _lib_name("cufft", cpu_value),
+ "%{curand_lib}": _lib_name("curand", cpu_value),
+ "%{cupti_lib}": _lib_name("cupti", cpu_value),
+ })
_tpl(repository_ctx, "cuda:platform.bzl",
{
"%{cuda_version}": _DEFAULT_CUDA_VERSION,
@@ -701,6 +713,7 @@ def _create_cuda_repository(repository_ctx):
"crosstool:clang/bin/crosstool_wrapper_driver_is_not_gcc",
{
"%{cpu_compiler}": str(cc),
+ "%{cuda_version}": cuda_config.cuda_version,
"%{gcc_host_compiler_path}": str(cc),
"%{cuda_compute_capabilities}": ", ".join(
["\"%s\"" % c for c in cuda_config.compute_capabilities]),
diff --git a/third_party/sycl/crosstool/computecpp.tpl b/third_party/sycl/crosstool/computecpp.tpl
index 0c7611d298..e90d51bf87 100755
--- a/third_party/sycl/crosstool/computecpp.tpl
+++ b/third_party/sycl/crosstool/computecpp.tpl
@@ -13,22 +13,28 @@ COMPUTECPP_DRIVER= COMPUTECPP_ROOT + 'bin/compute++'
COMPUTECPP_INCLUDE = COMPUTECPP_ROOT + 'include'
def main():
- computecpp_compiler_flags = [flag for flag in sys.argv[1:]]
+ compiler_flags = []
- output_file_index = computecpp_compiler_flags.index('-o') + 1
- output_file_name = computecpp_compiler_flags[output_file_index]
+ # remove -fsamotoze-coverage from string
+ if CPU_CXX_COMPILER.find("g++") != -1:
+ compiler_flags = [flag for flag in sys.argv[1:] if not flag.startswith(('-Wl,--no-undefined', '-fsanitize-coverage', '-Wno-unused-but-set-variable', '-Wignored-attributes'))]
+ else:
+ compiler_flags = [flag for flag in sys.argv[1:] if not flag.startswith(('-Wl,--no-undefined', '-Wno-unused-but-set-variable', '-Wignored-attributes'))]
+
+ output_file_index = compiler_flags.index('-o') + 1
+ output_file_name = compiler_flags[output_file_index]
if(output_file_index == 1):
# we are linking
- return subprocess.call([CPU_CXX_COMPILER] + computecpp_compiler_flags)
+ return subprocess.call([CPU_CXX_COMPILER] + compiler_flags)
- computecpp_compiler_flags = computecpp_compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0']
+ compiler_flags = compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DEIGEN_USE_SYCL=1']
# find what we compile
compiling_cpp = 0
- if('-c' in computecpp_compiler_flags):
- compiled_file_index = computecpp_compiler_flags.index('-c') + 1
- compited_file_name = computecpp_compiler_flags[compiled_file_index]
+ if('-c' in compiler_flags):
+ compiled_file_index = compiler_flags.index('-c') + 1
+ compited_file_name = compiler_flags[compiled_file_index]
if(compited_file_name.endswith(('.cc', '.c++', '.cpp', '.CPP', '.C', '.cxx'))):
compiling_cpp = 1;
@@ -36,22 +42,24 @@ def main():
filename, file_extension = os.path.splitext(output_file_name)
bc_out = filename + '.sycl'
- computecpp_compiler_flags = ['--sycl-no-diags', '-sycl-compress-name', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '-isystem',
- COMPUTECPP_INCLUDE, '-std=c++11', '-sycl', '-emit-llvm', '-no-serial-memop'] + computecpp_compiler_flags
+ # strip asan for the device
+ computecpp_device_compiler_flags = [flag for flag in compiler_flags if not flag.startswith(('-fsanitize'))]
+ computecpp_device_compiler_flags = ['-sycl-compress-name', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '-isystem',
+ COMPUTECPP_INCLUDE, '-std=c++11', '-sycl', '-emit-llvm', '-no-serial-memop'] + computecpp_device_compiler_flags
- # dont want that in case of compiling with computecpp first
- host_compiler_flags = [flag for flag in sys.argv[1:]
- if not flag.startswith(('-MF', '-MD',))
- if not '.d' in flag]
-
- x = subprocess.call([COMPUTECPP_DRIVER] + computecpp_compiler_flags )
+ x = subprocess.call([COMPUTECPP_DRIVER] + computecpp_device_compiler_flags )
if(x == 0):
+ # dont want that in case of compiling with computecpp first
+ host_compiler_flags = [flag for flag in compiler_flags
+ if not flag.startswith(('-MF', '-MD',))
+ if not '.d' in flag]
+
host_compiler_flags = ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '--include', bc_out] + host_compiler_flags
x = subprocess.call([CPU_CXX_COMPILER] + host_compiler_flags)
return x
else:
# compile for C
- return subprocess.call([CPU_C_COMPILER] + computecpp_compiler_flags)
+ return subprocess.call([CPU_C_COMPILER] + compiler_flags)
if __name__ == '__main__':
sys.exit(main())
diff --git a/third_party/sycl/sycl_configure.bzl b/third_party/sycl/sycl_configure.bzl
index 38bd7759de..6ad498487f 100644
--- a/third_party/sycl/sycl_configure.bzl
+++ b/third_party/sycl/sycl_configure.bzl
@@ -102,7 +102,7 @@ def _tpl(repository_ctx, tpl, substitutions={}, out=None):
def _file(repository_ctx, label):
repository_ctx.template(
label.replace(":", "/"),
- Label("//third_party/sycl/%s.tpl" % label),
+ Label("//third_party/sycl/%s" % label),
{})
_DUMMY_CROSSTOOL_BZL_FILE = """
@@ -133,9 +133,9 @@ error_sycl_disabled()
def _create_dummy_repository(repository_ctx):
# Set up BUILD file for sycl/.
- _file(repository_ctx, "sycl:build_defs.bzl")
+ _tpl(repository_ctx, "sycl:build_defs.bzl")
_tpl(repository_ctx, "sycl:BUILD")
- _tpl(repository_ctx, "sycl:LICENSE.text")
+ _file(repository_ctx, "sycl:LICENSE.text")
_tpl(repository_ctx, "sycl:platform.bzl")
# Create dummy files for the SYCL toolkit since they are still required by
@@ -157,10 +157,11 @@ def _sycl_autoconf_imp(repository_ctx):
_create_dummy_repository(repository_ctx)
else:
# copy template files
- _file(repository_ctx, "sycl:build_defs.bzl")
+ _tpl(repository_ctx, "sycl:build_defs.bzl")
_tpl(repository_ctx, "sycl:BUILD")
_tpl(repository_ctx, "sycl:platform.bzl")
- _file(repository_ctx, "crosstool:BUILD")
+ _tpl(repository_ctx, "crosstool:BUILD")
+ _file(repository_ctx, "sycl:LICENSE.text")
_tpl(repository_ctx, "crosstool:computecpp",
{
"%{host_cxx_compiler}" : find_cc(repository_ctx),