diff options
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/aws.BUILD | 3 | ||||
-rw-r--r-- | third_party/boringssl/add_boringssl_s390x.patch | 133 | ||||
-rw-r--r-- | third_party/curl.BUILD | 1 | ||||
-rw-r--r-- | third_party/nanopb.BUILD | 23 | ||||
-rwxr-xr-x | third_party/sycl/crosstool/CROSSTOOL.tpl | 8 | ||||
-rw-r--r-- | third_party/sycl/crosstool/trisycl.tpl | 73 | ||||
-rwxr-xr-x | third_party/sycl/sycl/BUILD.tpl | 17 | ||||
-rwxr-xr-x | third_party/sycl/sycl/build_defs.bzl.tpl | 17 | ||||
-rw-r--r-- | third_party/sycl/sycl_configure.bzl | 86 | ||||
-rw-r--r-- | third_party/zlib.BUILD | 2 |
10 files changed, 175 insertions, 188 deletions
diff --git a/third_party/aws.BUILD b/third_party/aws.BUILD index bc6a2fd8cc..bc9e37ffb3 100644 --- a/third_party/aws.BUILD +++ b/third_party/aws.BUILD @@ -21,6 +21,9 @@ cc_library( "@%ws%//tensorflow:linux_ppc64le": glob([ "aws-cpp-sdk-core/source/platform/linux-shared/*.cpp", ]), + "@%ws%//tensorflow:raspberry_pi_armeabi": glob([ + "aws-cpp-sdk-core/source/platform/linux-shared/*.cpp", + ]), "//conditions:default": [], }) + glob([ "aws-cpp-sdk-core/include/**/*.h", diff --git a/third_party/boringssl/add_boringssl_s390x.patch b/third_party/boringssl/add_boringssl_s390x.patch deleted file mode 100644 index 8b42d10e68..0000000000 --- a/third_party/boringssl/add_boringssl_s390x.patch +++ /dev/null @@ -1,133 +0,0 @@ -diff --git a/src/include/openssl/base.h b/src/include/openssl/base.h -index 7a3adfb..88012ad 100644 ---- a/src/include/openssl/base.h -+++ b/src/include/openssl/base.h -@@ -94,6 +94,8 @@ extern "C" { - #define OPENSSL_PNACL - #elif defined(__myriad2__) - #define OPENSSL_32_BIT -+#elif defined(__s390x__) -+#define OPENSSL_64_BIT - #else - #error "Unknown target CPU" - #endif -diff --git a/BUILD b/BUILD -index 6b645e61..c90b7beb 100644 ---- a/BUILD -+++ b/BUILD -@@ -40,29 +40,46 @@ config_setting( - values = {"cpu": "darwin"}, - ) - --boringssl_copts = [ -- # Assembler option --noexecstack adds .note.GNU-stack to each object to -- # ensure that binaries can be built with non-executable stack. -- "-Wa,--noexecstack", -- -- # This is needed on Linux systems (at least) to get rwlock in pthread. -- "-D_XOPEN_SOURCE=700", -- -- # This list of warnings should match those in the top-level CMakeLists.txt. -- "-Wall", -- "-Werror", -- "-Wformat=2", -- "-Wsign-compare", -- "-Wmissing-field-initializers", -- "-Wwrite-strings", -- "-Wshadow", -- "-fno-common", -- -- # Modern build environments should be able to set this to use atomic -- # operations for reference counting rather than locks. However, it's -- # known not to work on some Android builds. -- # "-DOPENSSL_C11_ATOMIC", --] + select({ -+config_setting( -+ name = "windows", -+ values = {"cpu": "x64_windows"}, -+ visibility = ["//visibility:public"], -+) -+ -+config_setting( -+ name = "windows_msvc", -+ values = {"cpu": "x64_windows_msvc"}, -+ visibility = ["//visibility:public"], -+) -+ -+boringssl_copts = select({ -+ ":windows": [ -+ "-DWIN32_LEAN_AND_MEAN", -+ ], -+ "//conditions:default": [ -+ # Assembler option --noexecstack adds .note.GNU-stack to each object to -+ # ensure that binaries can be built with non-executable stack. -+ "-Wa,--noexecstack", -+ -+ # This is needed on Linux systems (at least) to get rwlock in pthread. -+ "-D_XOPEN_SOURCE=700", -+ -+ # This list of warnings should match those in the top-level CMakeLists.txt. -+ "-Wall", -+ "-Werror", -+ "-Wformat=2", -+ "-Wsign-compare", -+ "-Wmissing-field-initializers", -+ "-Wwrite-strings", -+ "-Wshadow", -+ "-fno-common", -+ -+ # Modern build environments should be able to set this to use atomic -+ # operations for reference counting rather than locks. However, it's -+ # known not to work on some Android builds. -+ # "-DOPENSSL_C11_ATOMIC", -+ ], -+}) + select({ - ":linux_x86_64": [], - ":mac_x86_64": [], - "//conditions:default": ["-DOPENSSL_NO_ASM"], -@@ -75,18 +92,26 @@ crypto_sources_asm = select({ - }) - - # For C targets only (not C++), compile with C11 support. --boringssl_copts_c11 = boringssl_copts + [ -- "-std=c11", -- "-Wmissing-prototypes", -- "-Wold-style-definition", -- "-Wstrict-prototypes", --] -+boringssl_copts_c11 = boringssl_copts + select({ -+ ":windows": [], -+ ":windows_msvc": [], -+ "//conditions:default": [ -+ "-std=c11", -+ "-Wmissing-prototypes", -+ "-Wold-style-definition", -+ "-Wstrict-prototypes", -+ ], -+}) - - # For C targets only (not C++), compile with C11 support. --boringssl_copts_cxx = boringssl_copts + [ -- "-std=c++11", -- "-Wmissing-declarations", --] -+boringssl_copts_cxx = boringssl_copts + select({ -+ ":windows": [], -+ ":windows_msvc": [], -+ "//conditions:default": [ -+ "-std=c++11", -+ "-Wmissing-declarations", -+ ], -+}) - - cc_library( - name = "crypto", -@@ -96,6 +121,8 @@ cc_library( - includes = ["src/include"], - linkopts = select({ - ":mac_x86_64": [], -+ ":windows": [], -+ ":windows_msvc": [], - "//conditions:default": ["-lpthread"], - }), - visibility = ["//visibility:public"], diff --git a/third_party/curl.BUILD b/third_party/curl.BUILD index 882967df1c..805a30d262 100644 --- a/third_party/curl.BUILD +++ b/third_party/curl.BUILD @@ -477,7 +477,6 @@ genrule( "# define HAVE_RAND_EGD 1", "# define HAVE_RAND_STATUS 1", "# define HAVE_SSL_GET_SHUTDOWN 1", - "# define HAVE_STROPTS_H 1", "# define HAVE_TERMIOS_H 1", "# define OS \"x86_64-pc-linux-gnu\"", "# define RANDOM_FILE \"/dev/urandom\"", diff --git a/third_party/nanopb.BUILD b/third_party/nanopb.BUILD deleted file mode 100644 index d21866911b..0000000000 --- a/third_party/nanopb.BUILD +++ /dev/null @@ -1,23 +0,0 @@ -# Description: -# Nanopb, a tiny ANSI C protobuf implementation for use on embedded devices. - -licenses(["notice"]) # zlib license - -exports_files(["LICENSE.txt"]) - -cc_library( - name = "nanopb", - srcs = [ - "pb_common.c", - "pb_decode.c", - "pb_encode.c", - ], - hdrs = [ - "pb.h", - "pb_common.h", - "pb_decode.h", - "pb_encode.h", - ], - includes = ["."], - visibility = ["//visibility:public"], -) diff --git a/third_party/sycl/crosstool/CROSSTOOL.tpl b/third_party/sycl/crosstool/CROSSTOOL.tpl index 32884d71e7..f8e50efcc6 100755 --- a/third_party/sycl/crosstool/CROSSTOOL.tpl +++ b/third_party/sycl/crosstool/CROSSTOOL.tpl @@ -35,10 +35,10 @@ toolchain { tool_path { name: "compat-ld" path: "/usr/bin/ld" } tool_path { name: "cpp" path: "/usr/bin/cpp" } tool_path { name: "dwp" path: "/usr/bin/dwp" } - tool_path { name: "gcc" path: "computecpp" } + tool_path { name: "gcc" path: "%{sycl_impl}" } # Use "-std=c++11" for nvcc. For consistency, force both the host compiler # and the device compiler to use "-std=c++11". - cxx_flag: "-std=c++11" + cxx_flag: "%{c++_std}" linker_flag: "-Wl,-no-as-needed" linker_flag: "-lstdc++" linker_flag: "-B/usr/bin/" @@ -53,7 +53,7 @@ toolchain { cxx_builtin_include_directory: "/usr/local/include" cxx_builtin_include_directory: "/usr/include" - cxx_builtin_include_directory: "%{computecpp_toolkit_path}" + cxx_builtin_include_directory: "%{sycl_include_dir}" cxx_builtin_include_directory: "%{python_lib_path}" tool_path { name: "gcov" path: "/usr/bin/gcov" } @@ -214,4 +214,4 @@ toolchain { compiler_flag: "-O2" compiler_flag: "-DNDEBUG" } -} +}
\ No newline at end of file diff --git a/third_party/sycl/crosstool/trisycl.tpl b/third_party/sycl/crosstool/trisycl.tpl new file mode 100644 index 0000000000..b470772fbf --- /dev/null +++ b/third_party/sycl/crosstool/trisycl.tpl @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +import os +import sys +import tempfile +from subprocess import call + +CPU_CXX_COMPILER = ('%{host_cxx_compiler}') +CPU_C_COMPILER = ('%{host_c_compiler}') + +CURRENT_DIR = os.path.dirname(sys.argv[0]) +TRISYCL_INCLUDE_DIR = CURRENT_DIR + '/../sycl/include' + +def main(): + compiler_flags = [] + + remove_flags = ('-Wl,--no-undefined', '-Wno-unused-but-set-variable', '-Wignored-attributes', '-fno-exceptions') + # remove -fsamotoze-coverage from string with g++ + if 'g++' in CPU_CXX_COMPILER: + remove_flags += ('-fsanitize-coverage',) + compiler_flags += ['-fopenmp'] + else: + compiler_flags += ['-fopenmp=libomp'] + + compiler_flags += [flag for flag in sys.argv[1:] if not flag.startswith(remove_flags)] + + + 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 call([CPU_CXX_COMPILER] + compiler_flags + + ['-Wl,--no-undefined']) + + # find what we compile + compiling_cpp = 0 + if('-c' in compiler_flags): + compiled_file_index = compiler_flags.index('-c') + 1 + compiled_file_name = compiler_flags[compiled_file_index] + if(compiled_file_name.endswith(('.cc', '.c++', '.cpp', '.CPP', + '.C', '.cxx'))): + compiling_cpp = 1; + + debug_flags = ['-DTRISYCL_DEBUG', '-DBOOST_LOG_DYN_LINK', '-DTRISYCL_TRACE_KERNEL', '-lpthread', '-lboost_log', '-g', '-rdynamic'] + + opt_flags = ['-DNDEBUG', '-DBOOST_DISABLE_ASSERTS', '-O3'] + + compiler_flags = compiler_flags + ['-DEIGEN_USE_SYCL=1', + '-DEIGEN_HAS_C99_MATH', + '-DEIGEN_MAX_ALIGN_BYTES=16', + '-DTENSORFLOW_USE_SYCL'] + opt_flags + + if(compiling_cpp == 1): + # create a blacklist of folders that will be skipped when compiling + # with triSYCL + skip_extensions = [".cu.cc"] + skip_folders = ["tensorflow/compiler", "tensorflow/docs_src", "tensorflow/tensorboard", "third_party", "external", "hexagon"] + skip_folders = [(folder + '/') for folder in skip_folders] + # if compiling external project skip triSYCL + if any(compiled_file_name.endswith(_ext) for _ext in skip_extensions) or any(_folder in output_file_name for _folder in skip_folders): + return call([CPU_CXX_COMPILER] + compiler_flags) + + host_compiler_flags = ['-xc++', '-Wno-unused-variable', + '-I', TRISYCL_INCLUDE_DIR] + compiler_flags + x = call([CPU_CXX_COMPILER] + host_compiler_flags) + return x + else: + # compile for C + return call([CPU_C_COMPILER] + compiler_flags) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/third_party/sycl/sycl/BUILD.tpl b/third_party/sycl/sycl/BUILD.tpl index 6cad190630..b6ceaadda7 100755 --- a/third_party/sycl/sycl/BUILD.tpl +++ b/third_party/sycl/sycl/BUILD.tpl @@ -10,16 +10,27 @@ package(default_visibility = ["//visibility:public"]) exports_files(["LICENSE.text"]) config_setting( - name = "using_sycl", - values = { - "define": "using_sycl=true", + name = "using_sycl_ccpp", + define_values = { + "using_sycl": "true", + "using_trisycl": "false", }, ) +config_setting( + name = "using_sycl_trisycl", + define_values = { + "using_sycl": "true", + "using_trisycl": "false", + }, +) + + cc_library( name = "sycl_headers", hdrs = glob([ "**/*.h", + "**/*.hpp", ]), includes = [".", "include"], ) diff --git a/third_party/sycl/sycl/build_defs.bzl.tpl b/third_party/sycl/sycl/build_defs.bzl.tpl index 09bef0a661..33386f8957 100755 --- a/third_party/sycl/sycl/build_defs.bzl.tpl +++ b/third_party/sycl/sycl/build_defs.bzl.tpl @@ -5,9 +5,24 @@ def if_sycl(if_true, if_false = []): Returns a select statement which evaluates to if_true if we're building with SYCL enabled. Otherwise, the select statement evaluates to if_false. + If we are building with triSYCL instead of ComputeCPP, a list with + the first element of if_true is returned. + """ + return select({ + "@local_config_sycl//sycl:using_sycl_ccpp": if_true, + "@local_config_sycl//sycl:using_sycl_trisycl": if_true[0:1], + "//conditions:default": if_false + }) + +def if_ccpp(if_true, if_false = []): + """Shorthand for select()'ing if we are building with ComputeCPP. + Returns a select statement which evaluates to if_true if we're building + with ComputeCPP enabled. Otherwise, the select statement evaluates + to if_false. """ return select({ - "@local_config_sycl//sycl:using_sycl": if_true, + "@local_config_sycl//sycl:using_sycl_ccpp": if_true, + "@local_config_sycl//sycl:using_sycl_trisycl": if_false, "//conditions:default": if_false }) diff --git a/third_party/sycl/sycl_configure.bzl b/third_party/sycl/sycl_configure.bzl index 7af063178e..a0c9e4e43a 100644 --- a/third_party/sycl/sycl_configure.bzl +++ b/third_party/sycl/sycl_configure.bzl @@ -5,20 +5,26 @@ * HOST_CXX_COMPILER: The host C++ compiler * HOST_C_COMPILER: The host C compiler * COMPUTECPP_TOOLKIT_PATH: The path to the ComputeCpp toolkit. + * TRISYCL_INCLUDE_DIR: The path to the include directory of triSYCL. + (if using triSYCL instead of ComputeCPP) * PYTHON_LIB_PATH: The path to the python lib """ _HOST_CXX_COMPILER = "HOST_CXX_COMPILER" _HOST_C_COMPILER= "HOST_C_COMPILER" _COMPUTECPP_TOOLKIT_PATH = "COMPUTECPP_TOOLKIT_PATH" +_TRISYCL_INCLUDE_DIR = "TRISYCL_INCLUDE_DIR" _PYTHON_LIB_PATH = "PYTHON_LIB_PATH" def _enable_sycl(repository_ctx): - if "TF_NEED_OPENCL" in repository_ctx.os.environ: - enable_sycl = repository_ctx.os.environ["TF_NEED_OPENCL"].strip() + if "TF_NEED_OPENCL_SYCL" in repository_ctx.os.environ: + enable_sycl = repository_ctx.os.environ["TF_NEED_OPENCL_SYCL"].strip() return enable_sycl == "1" return False +def _enable_compute_cpp(repository_ctx): + return _COMPUTECPP_TOOLKIT_PATH in repository_ctx.os.environ + def auto_configure_fail(msg): """Output failure message when auto configuration fails.""" red = "\033[0;31m" @@ -59,6 +65,15 @@ def find_computecpp_root(repository_ctx): return sycl_name fail("Cannot find SYCL compiler, please correct your path") +def find_trisycl_include_dir(repository_ctx): + """Find triSYCL include directory. """ + sycl_name = "" + if _TRISYCL_INCLUDE_DIR in repository_ctx.os.environ: + sycl_name = repository_ctx.os.environ[_TRISYCL_INCLUDE_DIR].strip() + if sycl_name.startswith("/"): + return sycl_name + fail( "Cannot find triSYCL include directory, please correct your path") + def find_python_lib(repository_ctx): """Returns python path.""" if _PYTHON_LIB_PATH in repository_ctx.os.environ: @@ -171,26 +186,53 @@ def _sycl_autoconf_imp(repository_ctx): _tpl(repository_ctx, "sycl:platform.bzl") _tpl(repository_ctx, "crosstool:BUILD") _file(repository_ctx, "sycl:LICENSE.text") - _tpl(repository_ctx, "crosstool:computecpp", - { - "%{host_cxx_compiler}" : find_cc(repository_ctx), - "%{host_c_compiler}" : find_c(repository_ctx), - }) - - computecpp_root = find_computecpp_root(repository_ctx) - _check_dir(repository_ctx, computecpp_root) - - _tpl(repository_ctx, "crosstool:CROSSTOOL", - { - "%{computecpp_toolkit_path}" : computecpp_root, - "%{python_lib_path}" : find_python_lib(repository_ctx), - }) - - # symlink libraries - _check_lib(repository_ctx, computecpp_root+"/lib", "libComputeCpp.so" ) - _symlink_dir(repository_ctx, computecpp_root + "/lib", "sycl/lib") - _symlink_dir(repository_ctx, computecpp_root + "/include", "sycl/include") - _symlink_dir(repository_ctx, computecpp_root + "/bin", "sycl/bin") + + if _enable_compute_cpp(repository_ctx): + _tpl(repository_ctx, "crosstool:computecpp", + { + "%{host_cxx_compiler}" : find_cc(repository_ctx), + "%{host_c_compiler}" : find_c(repository_ctx) + }) + + computecpp_root = find_computecpp_root(repository_ctx); + _check_dir(repository_ctx, computecpp_root) + + _tpl(repository_ctx, "crosstool:CROSSTOOL", + { + "%{sycl_include_dir}" : computecpp_root, + "%{sycl_impl}" : "computecpp", + "%{c++_std}" : "-std=c++11", + "%{python_lib_path}" : find_python_lib(repository_ctx), + }) + + # symlink libraries + _check_lib(repository_ctx, computecpp_root+"/lib", "libComputeCpp.so" ) + _symlink_dir(repository_ctx, computecpp_root + "/lib", "sycl/lib") + _symlink_dir(repository_ctx, computecpp_root + "/include", "sycl/include") + _symlink_dir(repository_ctx, computecpp_root + "/bin", "sycl/bin") + else: + + trisycl_include_dir = find_trisycl_include_dir(repository_ctx); + _check_dir(repository_ctx, trisycl_include_dir) + + _tpl(repository_ctx, "crosstool:trisycl", + { + "%{host_cxx_compiler}" : find_cc(repository_ctx), + "%{host_c_compiler}" : find_c(repository_ctx), + "%{trisycl_include_dir}" : trisycl_include_dir + }) + + + _tpl(repository_ctx, "crosstool:CROSSTOOL", + { + "%{sycl_include_dir}" : trisycl_include_dir, + "%{sycl_impl}" : "trisycl", + "%{c++_std}" : "-std=c++1y", + "%{python_lib_path}" : find_python_lib(repository_ctx), + }) + + _symlink_dir(repository_ctx, trisycl_include_dir, "sycl/include") + sycl_configure = repository_rule( implementation = _sycl_autoconf_imp, diff --git a/third_party/zlib.BUILD b/third_party/zlib.BUILD index 8509668891..d164ee719c 100644 --- a/third_party/zlib.BUILD +++ b/third_party/zlib.BUILD @@ -49,7 +49,7 @@ cc_library( ":windows_msvc": [], "//conditions:default": [ "-Wno-shift-negative-value", - "-Wno-implicit-function-declaration", + "-DZ_HAVE_UNISTD_H", ], }), includes = ["."], |