diff options
author | Yifei Feng <yifeif@google.com> | 2017-11-22 00:39:22 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-11-22 00:42:30 -0800 |
commit | e70c00950d295c519fd9c7f8b12e13a3c5aaf710 (patch) | |
tree | ee1210f8810e0b0fec9346f762e854b371899919 /third_party/sycl/sycl_configure.bzl | |
parent | ad7eeec1cc06d7fdba6ee404f03a35fab9cd3e6a (diff) |
Automated g4 rollback of changelist 176615107
PiperOrigin-RevId: 176622438
Diffstat (limited to 'third_party/sycl/sycl_configure.bzl')
-rw-r--r-- | third_party/sycl/sycl_configure.bzl | 86 |
1 files changed, 22 insertions, 64 deletions
diff --git a/third_party/sycl/sycl_configure.bzl b/third_party/sycl/sycl_configure.bzl index a0c9e4e43a..7af063178e 100644 --- a/third_party/sycl/sycl_configure.bzl +++ b/third_party/sycl/sycl_configure.bzl @@ -5,26 +5,20 @@ * 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_SYCL" in repository_ctx.os.environ: - enable_sycl = repository_ctx.os.environ["TF_NEED_OPENCL_SYCL"].strip() + if "TF_NEED_OPENCL" in repository_ctx.os.environ: + enable_sycl = repository_ctx.os.environ["TF_NEED_OPENCL"].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" @@ -65,15 +59,6 @@ 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: @@ -186,53 +171,26 @@ def _sycl_autoconf_imp(repository_ctx): _tpl(repository_ctx, "sycl:platform.bzl") _tpl(repository_ctx, "crosstool:BUILD") _file(repository_ctx, "sycl:LICENSE.text") - - 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") - + _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") sycl_configure = repository_rule( implementation = _sycl_autoconf_imp, |