diff options
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/curl.BUILD | 54 | ||||
-rw-r--r-- | third_party/eigen3/BUILD | 7 | ||||
-rw-r--r-- | third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h | 10 | ||||
-rw-r--r-- | third_party/gpus/cuda/BUILD.tpl | 12 | ||||
-rw-r--r-- | third_party/gpus/cuda_configure.bzl | 2 | ||||
-rw-r--r-- | third_party/llvm/llvm.BUILD | 2 | ||||
-rw-r--r-- | third_party/mkl/build_defs.bzl | 26 | ||||
-rw-r--r-- | third_party/nccl.BUILD | 18 | ||||
-rwxr-xr-x | third_party/sycl/crosstool/computecpp.tpl | 37 |
9 files changed, 100 insertions, 68 deletions
diff --git a/third_party/curl.BUILD b/third_party/curl.BUILD index c1c0f69dc0..557c2885eb 100644 --- a/third_party/curl.BUILD +++ b/third_party/curl.BUILD @@ -204,13 +204,13 @@ cc_library( "lib/wildcard.h", "lib/x509asn1.h", ] + select({ - ":darwin": [ + "@//tensorflow:darwin": [ "lib/vtls/darwinssl.c", ], - ":ios": [ + "@//tensorflow:ios": [ "lib/vtls/darwinssl.c", ], - ":windows": [ + "@//tensorflow:windows": [ "lib/asyn-thread.c", "lib/inet_ntop.c", "lib/system_win32.c", @@ -231,8 +231,8 @@ cc_library( "include/curl/typecheck-gcc.h", ], copts = select({ - ":windows": [ - "/Iexternal/curl/lib", + "@//tensorflow:windows": [ + "/I%prefix%/curl/lib", "/DHAVE_CONFIG_H", "/DCURL_DISABLE_FTP", "/DCURL_DISABLE_NTLM", @@ -245,7 +245,7 @@ cc_library( "/D_USING_V110_SDK71_", ], "//conditions:default": [ - "-Iexternal/curl/lib", + "-I%prefix%/curl/lib", "-D_GNU_SOURCE", "-DHAVE_CONFIG_H", "-DCURL_DISABLE_FTP", @@ -255,10 +255,10 @@ cc_library( "-Wno-string-plus-int", ], }) + select({ - ":darwin": [ + "@//tensorflow:darwin": [ "-fno-constant-cfstrings", ], - ":windows": [ + "@//tensorflow:windows": [ # See curl.h for discussion of write size and Windows "/DCURL_MAX_WRITE_SIZE=16384", ], @@ -268,17 +268,17 @@ cc_library( }), includes = ["include"], linkopts = select({ - ":android": [ + "@//tensorflow:android": [ "-pie", ], - ":darwin": [ + "@//tensorflow:darwin": [ "-Wl,-framework", "-Wl,CoreFoundation", "-Wl,-framework", "-Wl,Security", ], - ":ios": [], - ":windows": [ + "@//tensorflow:ios": [], + "@//tensorflow:windows": [ "ws2_32.lib", ], "//conditions:default": [ @@ -289,8 +289,8 @@ cc_library( deps = [ "@zlib_archive//:zlib", ] + select({ - ":ios": [], - ":windows": [], + "@//tensorflow:ios": [], + "@//tensorflow:windows": [], "//conditions:default": [ "@boringssl//:ssl", ], @@ -386,13 +386,13 @@ cc_binary( "src/tool_xattr.h", ], copts = select({ - ":windows": [ - "/Iexternal/curl/lib", + "@//tensorflow:windows": [ + "/I%prefix%/curl/lib", "/DHAVE_CONFIG_H", "/DCURL_DISABLE_LIBCURL_OPTION", ], "//conditions:default": [ - "-Iexternal/curl/lib", + "-I%prefix%/curl/lib", "-D_GNU_SOURCE", "-DHAVE_CONFIG_H", "-DCURL_DISABLE_LIBCURL_OPTION", @@ -657,23 +657,3 @@ genrule( "EOF", ]), ) - -config_setting( - name = "ios", - values = {"crosstool_top": "//tools/osx/crosstool:crosstool"}, -) - -config_setting( - name = "darwin", - values = {"cpu": "darwin"}, -) - -config_setting( - name = "windows", - values = {"cpu": "x64_windows_msvc"}, -) - -config_setting( - name = "android", - values = {"crosstool_top": "//external:android/crosstool"}, -) diff --git a/third_party/eigen3/BUILD b/third_party/eigen3/BUILD index ff5323939d..f38a26717e 100644 --- a/third_party/eigen3/BUILD +++ b/third_party/eigen3/BUILD @@ -10,9 +10,12 @@ licenses([ ]) exports_files(["LICENSE"]) + # INTEL_MKL start load("//tensorflow:tensorflow.bzl", "if_mkl") + # INTEL_MKL end +load("//tensorflow:tensorflow.bzl", "if_mkl") cc_library( name = "eigen3", @@ -28,10 +31,8 @@ cc_library( "unsupported/Eigen/CXX11/Tensor", "unsupported/Eigen/CXX11/FixedPoint", ], + includes = if_mkl(["./mkl_include"]), visibility = ["//visibility:public"], -# INTEL_MKL start - includes = if_mkl(["./mkl_include"]), -# INTEL_MKL end deps = [ "@eigen_archive//:eigen", "@local_config_sycl//sycl:sycl", diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h index 94d616f2b5..cbcce9e282 100644 --- a/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h +++ b/third_party/eigen3/unsupported/Eigen/CXX11/src/NeuralNetworks/Activations.h @@ -80,11 +80,11 @@ struct functor_traits<scalar_tanh_fast_derivative_op<T> > { } // namespace internal /** - * \ingroup CXX11_NeuralNetworks_Module - * \brief Template functor to clip the the magnitude of the first scalar. - * - * \sa class CwiseBinaryOp, MatrixBase::Clip - */ + * \ingroup CXX11_NeuralNetworks_Module + * \brief Template functor to clip the magnitude of the first scalar. + * + * \sa class CwiseBinaryOp, MatrixBase::Clip + */ template <typename Scalar> struct scalar_clip_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_clip_op) diff --git a/third_party/gpus/cuda/BUILD.tpl b/third_party/gpus/cuda/BUILD.tpl index 8754105619..e101f9fbd8 100644 --- a/third_party/gpus/cuda/BUILD.tpl +++ b/third_party/gpus/cuda/BUILD.tpl @@ -33,6 +33,12 @@ config_setting( visibility = ["//visibility:public"], ) +config_setting( + name = "freebsd", + values = {"cpu": "freebsd"}, + visibility = ["//visibility:public"], +) + cc_library( name = "cuda_headers", hdrs = glob([ @@ -49,8 +55,10 @@ cc_library( name = "cudart_static", srcs = ["lib/%{cudart_static_lib}"], includes = ["include/"], - linkopts = [ - "-ldl", + linkopts = select({ + ":freebsd": [], + "//conditions:default": ["-ldl"], + }) + [ "-lpthread", %{cudart_static_linkopt} ], diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl index 15e1dfc521..01e070f2be 100644 --- a/third_party/gpus/cuda_configure.bzl +++ b/third_party/gpus/cuda_configure.bzl @@ -368,7 +368,7 @@ def _lib_name(lib, cpu_value, version="", static=False): Returns: The platform-specific name of the library. """ - if cpu_value == "Linux": + if cpu_value in ("Linux", "FreeBSD"): if static: return "lib%s.a" % lib else: diff --git a/third_party/llvm/llvm.BUILD b/third_party/llvm/llvm.BUILD index 02f13939a9..fd287b056f 100644 --- a/third_party/llvm/llvm.BUILD +++ b/third_party/llvm/llvm.BUILD @@ -351,6 +351,7 @@ llvm_target_list = [ "lower_name": "arm", "short_name": "ARM", "tbl_outs": [ + ("-gen-register-bank", "lib/Target/ARM/ARMGenRegisterBank.inc"), ("-gen-register-info", "lib/Target/ARM/ARMGenRegisterInfo.inc"), ("-gen-instr-info", "lib/Target/ARM/ARMGenInstrInfo.inc"), ("-gen-emitter", "lib/Target/ARM/ARMGenMCCodeEmitter.inc"), @@ -398,6 +399,7 @@ llvm_target_list = [ "lower_name": "x86", "short_name": "X86", "tbl_outs": [ + ("-gen-register-bank", "lib/Target/X86/X86GenRegisterBank.inc"), ("-gen-register-info", "lib/Target/X86/X86GenRegisterInfo.inc"), ("-gen-disassembler", "lib/Target/X86/X86GenDisassemblerTables.inc"), ("-gen-instr-info", "lib/Target/X86/X86GenInstrInfo.inc"), diff --git a/third_party/mkl/build_defs.bzl b/third_party/mkl/build_defs.bzl index da89330c5a..9a28b312c2 100644 --- a/third_party/mkl/build_defs.bzl +++ b/third_party/mkl/build_defs.bzl @@ -1,13 +1,13 @@ -# Macros for building MKL code.
-
-def if_mkl(if_true, if_false = []):
- """Shorthand for select()'ing on whether we're building with MKL.
-
- Returns a select statement which evaluates to if_true if we're building
- with MKL enabled. Otherwise, the select statement evaluates to if_false.
-
- """
- return select({
- "//third_party/mkl:using_mkl": if_true,
- "//conditions:default": if_false
- })
+# Macros for building MKL code. + +def if_mkl(if_true, if_false = []): + """Shorthand for select()'ing on whether we're building with MKL. + + Returns a select statement which evaluates to if_true if we're building + with MKL enabled. Otherwise, the select statement evaluates to if_false. + + """ + return select({ + "//third_party/mkl:using_mkl": if_true, + "//conditions:default": if_false + }) diff --git a/third_party/nccl.BUILD b/third_party/nccl.BUILD index bb460a05e0..06b9b8ff68 100644 --- a/third_party/nccl.BUILD +++ b/third_party/nccl.BUILD @@ -43,6 +43,24 @@ cc_library( "-Iexternal/nccl_archive/src", "-O3", ] + cuda_default_copts(), + linkopts = select({ + "@%ws%//tensorflow:android": [ + "-pie", + ], + "@%ws%//tensorflow:darwin": [ + "-Wl,-framework", + "-Wl,CoreFoundation", + "-Wl,-framework", + "-Wl,Security", + ], + "@%ws%//tensorflow:ios": [], + "@%ws%//tensorflow:windows": [ + "ws2_32.lib", + ], + "//conditions:default": [ + "-lrt", + ], + }), visibility = ["//visibility:public"], deps = ["@local_config_cuda//cuda:cuda_headers"], ) diff --git a/third_party/sycl/crosstool/computecpp.tpl b/third_party/sycl/crosstool/computecpp.tpl index 532d7779f9..66dd9aea7b 100755 --- a/third_party/sycl/crosstool/computecpp.tpl +++ b/third_party/sycl/crosstool/computecpp.tpl @@ -26,9 +26,7 @@ def main(): if(output_file_index == 1): # we are linking - return subprocess.call([CPU_CXX_COMPILER] + compiler_flags) - - compiler_flags = compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DEIGEN_USE_SYCL=1'] + return subprocess.call([CPU_CXX_COMPILER] + compiler_flags + ['-Wl,--no-undefined']) # find what we compile compiling_cpp = 0 @@ -38,23 +36,48 @@ def main(): if(compited_file_name.endswith(('.cc', '.c++', '.cpp', '.CPP', '.C', '.cxx'))): compiling_cpp = 1; + compiler_flags = compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DEIGEN_USE_SYCL=1', '-DTENSORFLOW_USE_SYCL', '-DEIGEN_HAS_C99_MATH'] + + if(compiling_cpp == 1): + # create a blacklist of folders that will be skipped when compiling with ComputeCpp + _skip = ["external", "llvm", ".cu.cc"] + # if compiling external project skip computecpp + if any(_folder in _skip for _folder in output_file_name): + return subprocess.call([CPU_CXX_COMPILER] + compiler_flags) + + if(compiling_cpp == 1): + # this is an optimisation that will check if compiled file has to be compiled with ComputeCpp + + _tmp_flags = [flag for flag in compiler_flags if not flag.startswith(('-o', output_file_name))] + # create preprocessed of the file + _cmd = " ".join([CPU_CXX_COMPILER] + _tmp_flags + ["-E"]) + # check if it has parallel_for< in it + _cmd += " | grep \".parallel_for\" > /dev/null" + ps = subprocess.call(_cmd, shell=True) + # if not call CXX compiler + if(ps != 0): + return subprocess.call([CPU_CXX_COMPILER] + compiler_flags) + if(compiling_cpp == 1): filename, file_extension = os.path.splitext(output_file_name) bc_out = filename + '.sycl' # 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', '-Xclang', '-cl-denorms-are-zero', '-Xclang', '-cl-fp32-correctly-rounded-divide-sqrt'] + computecpp_device_compiler_flags + COMPUTECPP_INCLUDE, '-std=c++11', '-sycl', '-emit-llvm', '-no-serial-memop', '-Xclang', '-cl-denorms-are-zero', '-Xclang', '-cl-fp32-correctly-rounded-divide-sqrt'] + computecpp_device_compiler_flags += [flag for flag in compiler_flags if not flag.startswith(('-fsanitize'))] 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] + if not '.d' in flag + ] + + host_compiler_flags[host_compiler_flags.index('-c')] = "--include" - host_compiler_flags = ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '--include', bc_out] + host_compiler_flags + host_compiler_flags = ['-xc++', '-D_GLIBCXX_USE_CXX11_ABI=0', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '-c', bc_out] + host_compiler_flags x = subprocess.call([CPU_CXX_COMPILER] + host_compiler_flags) return x else: |