From 815d49bb5855f121707b2a5b03656a18e22062f6 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 18 Jan 2019 02:02:47 -0800 Subject: [PATCH] Automated rollback of commit 5c08b1f021e0a40fece750b5ebc0cf85b3281265 PiperOrigin-RevId: 229895719 --- tensorflow/opensource_only.files | 3 + third_party/gpus/crosstool/remote.BUILD.tpl | 10 ++ third_party/gpus/cuda/remote.BUILD.tpl | 110 ++++++++++++++++++++ third_party/gpus/cuda_configure.bzl | 17 +-- third_party/tensorrt/build_defs.bzl.tpl | 4 +- third_party/tensorrt/remote.BUILD.tpl | 7 ++ third_party/tensorrt/tensorrt_configure.bzl | 11 +- 7 files changed, 148 insertions(+), 14 deletions(-) create mode 100644 third_party/gpus/crosstool/remote.BUILD.tpl create mode 100644 third_party/gpus/cuda/remote.BUILD.tpl create mode 100644 third_party/tensorrt/remote.BUILD.tpl diff --git a/tensorflow/opensource_only.files b/tensorflow/opensource_only.files index 9c4dd2f4b86..850b5f5ca2e 100644 --- a/tensorflow/opensource_only.files +++ b/tensorflow/opensource_only.files @@ -82,6 +82,7 @@ tensorflow/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_ tensorflow/third_party/gpus/crosstool/CROSSTOOL.tpl tensorflow/third_party/gpus/crosstool/CROSSTOOL_hipcc.tpl tensorflow/third_party/gpus/crosstool/LICENSE +tensorflow/third_party/gpus/crosstool/remote.BUILD.tpl tensorflow/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl tensorflow/third_party/gpus/crosstool/BUILD.tpl tensorflow/third_party/gpus/crosstool/BUILD @@ -89,6 +90,7 @@ tensorflow/third_party/gpus/cuda/LICENSE tensorflow/third_party/gpus/cuda/BUILD.tpl tensorflow/third_party/gpus/cuda/BUILD.windows.tpl tensorflow/third_party/gpus/cuda/cuda_config.h.tpl +tensorflow/third_party/gpus/cuda/remote.BUILD.tpl tensorflow/third_party/gpus/cuda/BUILD tensorflow/third_party/gpus/cuda/build_defs.bzl.tpl tensorflow/third_party/gpus/rocm/rocm_config.h.tpl @@ -192,6 +194,7 @@ tensorflow/third_party/tensorrt/BUILD tensorflow/third_party/tensorrt/build_defs.bzl.tpl tensorflow/third_party/tensorrt/BUILD.tpl tensorflow/third_party/tensorrt/tensorrt_configure.bzl +tensorflow/third_party/tensorrt/remote.BUILD.tpl tensorflow/third_party/kafka/config.patch tensorflow/third_party/kafka/BUILD tensorflow/third_party/android/BUILD diff --git a/third_party/gpus/crosstool/remote.BUILD.tpl b/third_party/gpus/crosstool/remote.BUILD.tpl new file mode 100644 index 00000000000..b2316331db2 --- /dev/null +++ b/third_party/gpus/crosstool/remote.BUILD.tpl @@ -0,0 +1,10 @@ +# Description: +# Template for crosstool Build file to use a pre-generated config. +licenses(["restricted"]) + +package(default_visibility = ["//visibility:public"]) + +alias( + name = "toolchain", + actual = "%{remote_cuda_repo}:toolchain", +) diff --git a/third_party/gpus/cuda/remote.BUILD.tpl b/third_party/gpus/cuda/remote.BUILD.tpl new file mode 100644 index 00000000000..100c7bb7c41 --- /dev/null +++ b/third_party/gpus/cuda/remote.BUILD.tpl @@ -0,0 +1,110 @@ +# Description: +# Template for cuda Build file to use a pre-generated config. +licenses(["restricted"]) # MPL2, portions GPL v3, LGPL v3, BSD-like + +package(default_visibility = ["//visibility:public"]) + +config_setting( + name = "using_nvcc", + values = { + "define": "using_cuda_nvcc=true", + }, +) + +config_setting( + name = "using_clang", + values = { + "define": "using_cuda_clang=true", + }, +) + +# Equivalent to using_clang && -c opt. +config_setting( + name = "using_clang_opt", + values = { + "define": "using_cuda_clang=true", + "compilation_mode": "opt", + }, +) + +config_setting( + name = "darwin", + values = {"cpu": "darwin"}, + visibility = ["//visibility:public"], +) + +config_setting( + name = "freebsd", + values = {"cpu": "freebsd"}, + visibility = ["//visibility:public"], +) + +alias( + name = "cuda_headers", + actual = "%{remote_cuda_repo}/cuda:cuda_headers", +) + +alias( + name = "cudart_static", + actual = "%{remote_cuda_repo}/cuda:cudart_static", +) + +alias( + name = "cuda_driver", + actual = "%{remote_cuda_repo}/cuda:cuda_driver", +) + +alias( + name = "cudart", + actual = "%{remote_cuda_repo}/cuda:cudart", +) + +alias( + name = "cublas", + actual = "%{remote_cuda_repo}/cuda:cublas", +) + +alias( + name = "cusolver", + actual = "%{remote_cuda_repo}/cuda:cusolver", +) + +alias( + name = "cudnn", + actual = "%{remote_cuda_repo}/cuda:cudnn", +) + +alias( + name = "cudnn_header", + actual = "%{remote_cuda_repo}/cuda:cudnn_header", +) + +alias( + name = "cufft", + actual = "%{remote_cuda_repo}/cuda:cufft", +) + +alias( + name = "curand", + actual = "%{remote_cuda_repo}/cuda:curand", +) + +alias( + name = "cuda", + actual = "%{remote_cuda_repo}/cuda:cuda", +) + +alias( + name = "cupti_headers", + actual = "%{remote_cuda_repo}/cuda:cupti_headers", +) + +alias( + name = "cupti_dsos", + actual = "%{remote_cuda_repo}/cuda:cupti_dsos", +) + +alias( + name = "libdevice_root", + actual = "%{remote_cuda_repo}/cuda:libdevice_root", +) diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl index 5c9873f3346..90020b66087 100644 --- a/third_party/gpus/cuda_configure.bzl +++ b/third_party/gpus/cuda_configure.bzl @@ -1508,16 +1508,17 @@ def _create_remote_cuda_repository(repository_ctx, remote_config_repo): ), }, ) - repository_ctx.template( + _tpl( + repository_ctx, + "cuda:remote.BUILD", + { + "%{remote_cuda_repo}": remote_config_repo, + }, "cuda/BUILD", - Label(remote_config_repo + "/cuda:BUILD"), - {}, - ) - repository_ctx.template( - "crosstool/BUILD", - Label(remote_config_repo + "/crosstool:BUILD"), - {}, ) + _tpl(repository_ctx, "crosstool:remote.BUILD", { + "%{remote_cuda_repo}": remote_config_repo, + }, "crosstool/BUILD") def _cuda_autoconf_impl(repository_ctx): diff --git a/third_party/tensorrt/build_defs.bzl.tpl b/third_party/tensorrt/build_defs.bzl.tpl index 6d00513827b..0dc3a7ba2d2 100644 --- a/third_party/tensorrt/build_defs.bzl.tpl +++ b/third_party/tensorrt/build_defs.bzl.tpl @@ -2,4 +2,6 @@ def if_tensorrt(if_true, if_false=[]): """Tests whether TensorRT was enabled during the configure process.""" - return %{if_tensorrt} + if %{tensorrt_is_configured}: + return if_true + return if_false diff --git a/third_party/tensorrt/remote.BUILD.tpl b/third_party/tensorrt/remote.BUILD.tpl new file mode 100644 index 00000000000..d5afc4a5c10 --- /dev/null +++ b/third_party/tensorrt/remote.BUILD.tpl @@ -0,0 +1,7 @@ +licenses(["notice"]) # Apache 2.0 + +package(default_visibility = ["//visibility:public"]) + +alias(name="LICENSE", actual = "%{target}:LICENSE") +alias(name = "tensorrt_headers", actual = "%{target}:tensorrt_headers") +alias(name = "tensorrt", actual = "%{target}:tensorrt") diff --git a/third_party/tensorrt/tensorrt_configure.bzl b/third_party/tensorrt/tensorrt_configure.bzl index 22fd80e91ad..d3bc388346a 100644 --- a/third_party/tensorrt/tensorrt_configure.bzl +++ b/third_party/tensorrt/tensorrt_configure.bzl @@ -129,7 +129,7 @@ def _tpl(repository_ctx, tpl, substitutions): def _create_dummy_repository(repository_ctx): """Create a dummy TensorRT repository.""" - _tpl(repository_ctx, "build_defs.bzl", {"%{if_tensorrt}": "if_false"}) + _tpl(repository_ctx, "build_defs.bzl", {"%{tensorrt_is_configured}": "False"}) _tpl(repository_ctx, "BUILD", { "%{tensorrt_genrules}": "", @@ -141,10 +141,11 @@ def _tensorrt_configure_impl(repository_ctx): """Implementation of the tensorrt_configure repository rule.""" if _TF_TENSORRT_CONFIG_REPO in repository_ctx.os.environ: # Forward to the pre-configured remote repository. - remote_config_repo = repository_ctx.os.environ[_TF_TENSORRT_CONFIG_REPO] - repository_ctx.template("BUILD", Label(remote_config_repo + ":BUILD"), {}) + repository_ctx.template("BUILD", Label("//third_party/tensorrt:remote.BUILD.tpl"), { + "%{target}": repository_ctx.os.environ[_TF_TENSORRT_CONFIG_REPO], + }) # Set up config file. - _tpl(repository_ctx, "build_defs.bzl", {"%{if_tensorrt}": "if_true"}) + _tpl(repository_ctx, "build_defs.bzl", {"%{tensorrt_is_configured}": "True"}) return if _TENSORRT_INSTALL_PATH not in repository_ctx.os.environ: @@ -193,7 +194,7 @@ def _tensorrt_configure_impl(repository_ctx): )) # Set up config file. - _tpl(repository_ctx, "build_defs.bzl", {"%{if_tensorrt}": "if_true"}) + _tpl(repository_ctx, "build_defs.bzl", {"%{tensorrt_is_configured}": "True"}) # Set up BUILD file. _tpl(repository_ctx, "BUILD", {