Internal change
PiperOrigin-RevId: 335147548 Change-Id: Ib445cfbcb28421b4eb522d4d9524e4a64fe631df
This commit is contained in:
parent
4fa8162dd8
commit
5b5aab7f63
@ -3,7 +3,7 @@
|
|||||||
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
||||||
load(
|
load(
|
||||||
"//tensorflow:tensorflow.bzl",
|
"//tensorflow:tensorflow.bzl",
|
||||||
"if_tpu",
|
"if_libtpu",
|
||||||
"tf_cc_test",
|
"tf_cc_test",
|
||||||
"tf_copts",
|
"tf_copts",
|
||||||
"tf_cuda_cc_test",
|
"tf_cuda_cc_test",
|
||||||
@ -289,7 +289,7 @@ cc_library(
|
|||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core:protos_all_cc",
|
"//tensorflow/core:protos_all_cc",
|
||||||
"//tensorflow/core/lib/llvm_rtti",
|
"//tensorflow/core/lib/llvm_rtti",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = ["//tensorflow/compiler/mlir/tensorflow/c:mlir_c_api_registration"],
|
if_false = ["//tensorflow/compiler/mlir/tensorflow/c:mlir_c_api_registration"],
|
||||||
if_true = [],
|
if_true = [],
|
||||||
),
|
),
|
||||||
@ -354,7 +354,7 @@ cc_library(
|
|||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core:protos_all_cc",
|
"//tensorflow/core:protos_all_cc",
|
||||||
"//tensorflow/core/lib/llvm_rtti",
|
"//tensorflow/core/lib/llvm_rtti",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = ["//tensorflow/compiler/mlir/tensorflow/c:mlir_c_api_registration"],
|
if_false = ["//tensorflow/compiler/mlir/tensorflow/c:mlir_c_api_registration"],
|
||||||
if_true = [],
|
if_true = [],
|
||||||
),
|
),
|
||||||
|
@ -39,7 +39,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/c/eager/tfe_op_internal.h"
|
#include "tensorflow/c/eager/tfe_op_internal.h"
|
||||||
#include "tensorflow/c/eager/tfe_tensorhandle_internal.h"
|
#include "tensorflow/c/eager/tfe_tensorhandle_internal.h"
|
||||||
#include "tensorflow/c/tf_tensor_internal.h"
|
#include "tensorflow/c/tf_tensor_internal.h"
|
||||||
#if defined(PLATFORM_GOOGLE) && !defined(LIBTFTPU)
|
#if defined(PLATFORM_GOOGLE) && !defined(LIBTPU_ON_GCE)
|
||||||
#include "tensorflow/core/tfrt/eager/c_api_tfrt.h"
|
#include "tensorflow/core/tfrt/eager/c_api_tfrt.h"
|
||||||
#endif
|
#endif
|
||||||
#include "tensorflow/core/common_runtime/device.h"
|
#include "tensorflow/core/common_runtime/device.h"
|
||||||
@ -729,7 +729,7 @@ void TFE_DeleteContextOptions(TFE_ContextOptions* options) { delete options; }
|
|||||||
|
|
||||||
TFE_Context* TFE_NewContext(const TFE_ContextOptions* opts, TF_Status* status) {
|
TFE_Context* TFE_NewContext(const TFE_ContextOptions* opts, TF_Status* status) {
|
||||||
if (opts->use_tfrt) {
|
if (opts->use_tfrt) {
|
||||||
#if defined(PLATFORM_GOOGLE) && !defined(LIBTFTPU)
|
#if defined(PLATFORM_GOOGLE) && !defined(LIBTPU_ON_GCE)
|
||||||
return tensorflow::wrap(new tfrt::tf::ContextInterface(opts->async));
|
return tensorflow::wrap(new tfrt::tf::ContextInterface(opts->async));
|
||||||
#else
|
#else
|
||||||
status->status = tensorflow::errors::Unimplemented("TFRT is not supported");
|
status->status = tensorflow::errors::Unimplemented("TFRT is not supported");
|
||||||
|
@ -4,7 +4,7 @@ load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
|||||||
load("//tensorflow:tensorflow.bzl", "cc_header_only_library", "if_mlir", "tf_cc_test")
|
load("//tensorflow:tensorflow.bzl", "cc_header_only_library", "if_mlir", "tf_cc_test")
|
||||||
|
|
||||||
# buildifier: disable=same-origin-load
|
# buildifier: disable=same-origin-load
|
||||||
load("//tensorflow:tensorflow.bzl", "if_tpu", "tf_copts")
|
load("//tensorflow:tensorflow.bzl", "if_libtpu", "tf_copts")
|
||||||
load("//tensorflow/stream_executor:build_defs.bzl", "if_cuda_or_rocm")
|
load("//tensorflow/stream_executor:build_defs.bzl", "if_cuda_or_rocm")
|
||||||
|
|
||||||
# buildifier: disable=same-origin-load
|
# buildifier: disable=same-origin-load
|
||||||
@ -77,7 +77,7 @@ cc_library(
|
|||||||
"//tensorflow/compiler/jit/kernels:xla_ops",
|
"//tensorflow/compiler/jit/kernels:xla_ops",
|
||||||
"//tensorflow/compiler/tf2xla/kernels:xla_dummy_ops",
|
"//tensorflow/compiler/tf2xla/kernels:xla_dummy_ops",
|
||||||
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
|
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = ["//tensorflow/compiler/xla/service:cpu_plugin"],
|
if_false = ["//tensorflow/compiler/xla/service:cpu_plugin"],
|
||||||
if_true = [],
|
if_true = [],
|
||||||
),
|
),
|
||||||
@ -114,7 +114,7 @@ cc_library(
|
|||||||
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
|
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
|
||||||
"//tensorflow/core:core_cpu_internal",
|
"//tensorflow/core:core_cpu_internal",
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = [
|
if_false = [
|
||||||
"//tensorflow/compiler/xla/service:cpu_plugin", # buildcleaner: keep
|
"//tensorflow/compiler/xla/service:cpu_plugin", # buildcleaner: keep
|
||||||
],
|
],
|
||||||
@ -141,7 +141,7 @@ cc_library(
|
|||||||
"//tensorflow/core:core_cpu_internal",
|
"//tensorflow/core:core_cpu_internal",
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core/common_runtime/gpu:gpu_init",
|
"//tensorflow/core/common_runtime/gpu:gpu_init",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = [
|
if_false = [
|
||||||
"//tensorflow/compiler/xla/service:gpu_plugin", # buildcleaner: keep
|
"//tensorflow/compiler/xla/service:gpu_plugin", # buildcleaner: keep
|
||||||
],
|
],
|
||||||
@ -375,7 +375,7 @@ cc_library(
|
|||||||
"//tensorflow/core:lib_internal",
|
"//tensorflow/core:lib_internal",
|
||||||
"//tensorflow/core:protos_all_cc",
|
"//tensorflow/core:protos_all_cc",
|
||||||
"//tensorflow/core/platform:logging",
|
"//tensorflow/core/platform:logging",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = [
|
if_false = [
|
||||||
"//tensorflow/compiler/mlir:array_container_utils",
|
"//tensorflow/compiler/mlir:array_container_utils",
|
||||||
"//tensorflow/compiler/mlir/tensorflow:compile_mlir_util_no_tf_dialect_passes",
|
"//tensorflow/compiler/mlir/tensorflow:compile_mlir_util_no_tf_dialect_passes",
|
||||||
|
@ -47,7 +47,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/core/public/version.h"
|
#include "tensorflow/core/public/version.h"
|
||||||
#include "tensorflow/core/util/dump_graph.h"
|
#include "tensorflow/core/util/dump_graph.h"
|
||||||
|
|
||||||
#if !defined(LIBTFTPU)
|
#if !defined(LIBTPU_ON_GCE)
|
||||||
#include "tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.h"
|
#include "tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.h"
|
||||||
#include "tensorflow/compiler/mlir/utils/array_container_utils.h"
|
#include "tensorflow/compiler/mlir/utils/array_container_utils.h"
|
||||||
#endif
|
#endif
|
||||||
@ -289,7 +289,7 @@ Status XlaCompilationCache::CompileSingleOp(
|
|||||||
});
|
});
|
||||||
const ConfigProto* config = ctx->function_library()->config_proto();
|
const ConfigProto* config = ctx->function_library()->config_proto();
|
||||||
bool use_mlir = config && config->experimental().enable_mlir_bridge();
|
bool use_mlir = config && config->experimental().enable_mlir_bridge();
|
||||||
#ifdef LIBTFTPU
|
#ifdef LIBTPU_ON_GCE
|
||||||
if (use_mlir && has_tensor_list_arg) {
|
if (use_mlir && has_tensor_list_arg) {
|
||||||
LOG(WARNING) << "MLIR is not supported in this environment.";
|
LOG(WARNING) << "MLIR is not supported in this environment.";
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
||||||
load("//tensorflow:tensorflow.bzl", "if_tpu", "tf_cc_binary", "tf_cc_test", "tf_copts", "tf_cuda_cc_test", "tf_openmp_copts")
|
load("//tensorflow:tensorflow.bzl", "if_libtpu", "tf_cc_binary", "tf_cc_test", "tf_copts", "tf_cuda_cc_test", "tf_openmp_copts")
|
||||||
load(
|
load(
|
||||||
"//tensorflow/core/platform/default:cuda_build_defs.bzl",
|
"//tensorflow/core/platform/default:cuda_build_defs.bzl",
|
||||||
"if_cuda_is_configured",
|
"if_cuda_is_configured",
|
||||||
@ -298,7 +298,7 @@ cc_library(
|
|||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
"//tensorflow/core:protos_all_cc",
|
"//tensorflow/core:protos_all_cc",
|
||||||
"//tensorflow/stream_executor:platform",
|
"//tensorflow/stream_executor:platform",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = [
|
if_false = [
|
||||||
"//tensorflow/compiler/xla/service:cpu_plugin",
|
"//tensorflow/compiler/xla/service:cpu_plugin",
|
||||||
"//tensorflow/compiler/xla/service/cpu:buffer_info_util",
|
"//tensorflow/compiler/xla/service/cpu:buffer_info_util",
|
||||||
@ -369,7 +369,7 @@ cc_library(
|
|||||||
"//tensorflow/core:lib_internal",
|
"//tensorflow/core:lib_internal",
|
||||||
"//tensorflow/core:ops",
|
"//tensorflow/core:ops",
|
||||||
"//tensorflow/core:protos_all_cc",
|
"//tensorflow/core:protos_all_cc",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = [
|
if_false = [
|
||||||
"//tensorflow/compiler/mlir:array_container_utils",
|
"//tensorflow/compiler/mlir:array_container_utils",
|
||||||
"//tensorflow/compiler/mlir/tensorflow:compile_mlir_util_no_tf_dialect_passes",
|
"//tensorflow/compiler/mlir/tensorflow:compile_mlir_util_no_tf_dialect_passes",
|
||||||
@ -877,13 +877,13 @@ cc_library(
|
|||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "mlir_bridge_pass_registration",
|
name = "mlir_bridge_pass_registration",
|
||||||
srcs = if_tpu(
|
srcs = if_libtpu(
|
||||||
if_false = [
|
if_false = [
|
||||||
"mlir_bridge_pass_registration.cc",
|
"mlir_bridge_pass_registration.cc",
|
||||||
],
|
],
|
||||||
if_true = [],
|
if_true = [],
|
||||||
),
|
),
|
||||||
deps = if_tpu(
|
deps = if_libtpu(
|
||||||
if_false = [
|
if_false = [
|
||||||
":mlir_bridge_pass",
|
":mlir_bridge_pass",
|
||||||
"//tensorflow/compiler/mlir:mlir_graph_optimization_pass_registration",
|
"//tensorflow/compiler/mlir:mlir_graph_optimization_pass_registration",
|
||||||
|
@ -56,7 +56,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/core/protobuf/graph_debug_info.pb.h"
|
#include "tensorflow/core/protobuf/graph_debug_info.pb.h"
|
||||||
#include "tensorflow/core/util/dump_graph.h"
|
#include "tensorflow/core/util/dump_graph.h"
|
||||||
|
|
||||||
#ifndef LIBTFTPU
|
#ifndef LIBTPU_ON_GCE
|
||||||
#include "tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.h"
|
#include "tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.h"
|
||||||
#include "tensorflow/compiler/mlir/utils/array_container_utils.h"
|
#include "tensorflow/compiler/mlir/utils/array_container_utils.h"
|
||||||
#endif
|
#endif
|
||||||
@ -733,7 +733,7 @@ Status XlaCompiler::CompileFunction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
VLOG(1) << "====================================================";
|
VLOG(1) << "====================================================";
|
||||||
#ifdef LIBTFTPU
|
#ifdef LIBTPU_ON_GCE
|
||||||
if (GetMlirCommonFlags()->tf_mlir_enable_mlir_bridge) {
|
if (GetMlirCommonFlags()->tf_mlir_enable_mlir_bridge) {
|
||||||
VLOG(1) << "MLIR is not supported in this environment.";
|
VLOG(1) << "MLIR is not supported in this environment.";
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
|
|||||||
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency")
|
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency")
|
||||||
load(
|
load(
|
||||||
"//tensorflow:tensorflow.bzl",
|
"//tensorflow:tensorflow.bzl",
|
||||||
"if_tpu",
|
"if_libtpu",
|
||||||
"tf_cc_binary",
|
"tf_cc_binary",
|
||||||
"tf_cc_test",
|
"tf_cc_test",
|
||||||
)
|
)
|
||||||
@ -57,7 +57,7 @@ cc_library(
|
|||||||
"//tensorflow/core:framework_internal",
|
"//tensorflow/core:framework_internal",
|
||||||
"//tensorflow/core:lib",
|
"//tensorflow/core:lib",
|
||||||
tf_grpc_cc_dependency(),
|
tf_grpc_cc_dependency(),
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = ["//tensorflow/compiler/xla/service:cpu_plugin"],
|
if_false = ["//tensorflow/compiler/xla/service:cpu_plugin"],
|
||||||
if_true = [],
|
if_true = [],
|
||||||
),
|
),
|
||||||
|
@ -68,9 +68,9 @@ load(
|
|||||||
"if_chromiumos",
|
"if_chromiumos",
|
||||||
"if_cuda_or_rocm",
|
"if_cuda_or_rocm",
|
||||||
"if_ios",
|
"if_ios",
|
||||||
|
"if_libtpu",
|
||||||
"if_mobile",
|
"if_mobile",
|
||||||
"if_not_windows",
|
"if_not_windows",
|
||||||
"if_tpu",
|
|
||||||
"tf_android_core_proto_headers",
|
"tf_android_core_proto_headers",
|
||||||
"tf_cc_test",
|
"tf_cc_test",
|
||||||
"tf_cc_test_mkl",
|
"tf_cc_test_mkl",
|
||||||
@ -894,8 +894,7 @@ cc_library(
|
|||||||
"//tensorflow/c/kernels:summary_op_lib",
|
"//tensorflow/c/kernels:summary_op_lib",
|
||||||
] + if_chromiumos(
|
] + if_chromiumos(
|
||||||
[],
|
[],
|
||||||
# Non-tpu platforms don't need tpu dependency. It would be best to guard
|
# Non-tpu platforms don't need tpu dependency.
|
||||||
# them by if_tpu. But there is no such flag yet.
|
|
||||||
[
|
[
|
||||||
":tpu_configuration_ops_op_lib",
|
":tpu_configuration_ops_op_lib",
|
||||||
":tpu_cross_replica_ops_op_lib",
|
":tpu_cross_replica_ops_op_lib",
|
||||||
@ -916,7 +915,7 @@ cc_library(
|
|||||||
]) + if_tensorrt([
|
]) + if_tensorrt([
|
||||||
"//tensorflow/compiler/tf2tensorrt:trt_engine_resource_ops_op_lib",
|
"//tensorflow/compiler/tf2tensorrt:trt_engine_resource_ops_op_lib",
|
||||||
"//tensorflow/compiler/tf2tensorrt:trt_op_libs",
|
"//tensorflow/compiler/tf2tensorrt:trt_op_libs",
|
||||||
]) + if_tpu(
|
]) + if_libtpu(
|
||||||
if_false = ["//tensorflow/compiler/mlir/tensorflow:mlir_passthrough_op"],
|
if_false = ["//tensorflow/compiler/mlir/tensorflow:mlir_passthrough_op"],
|
||||||
if_true = [],
|
if_true = [],
|
||||||
),
|
),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
load(
|
load(
|
||||||
"//tensorflow:tensorflow.bzl",
|
"//tensorflow:tensorflow.bzl",
|
||||||
"if_tpu",
|
"if_libtpu",
|
||||||
"tf_cc_test",
|
"tf_cc_test",
|
||||||
"tf_cc_test_mkl",
|
"tf_cc_test_mkl",
|
||||||
"tf_cc_tests",
|
"tf_cc_tests",
|
||||||
@ -93,7 +93,7 @@ cc_library(
|
|||||||
deps = [
|
deps = [
|
||||||
":core_cpu",
|
":core_cpu",
|
||||||
"//tensorflow/core/common_runtime/gpu:gpu_runtime",
|
"//tensorflow/core/common_runtime/gpu:gpu_runtime",
|
||||||
] + if_tpu(["//tensorflow/core/tpu:tpu_runtime"]),
|
] + if_libtpu(["//tensorflow/core/tpu:tpu_runtime"]),
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Platform-specific build configurations.
|
# Platform-specific build configurations.
|
||||||
|
|
||||||
load("@com_google_protobuf//:protobuf.bzl", "proto_gen")
|
load("@com_google_protobuf//:protobuf.bzl", "proto_gen")
|
||||||
load("//tensorflow:tensorflow.bzl", "clean_dep", "if_not_windows", "if_tpu")
|
load("//tensorflow:tensorflow.bzl", "clean_dep", "if_libtpu", "if_not_windows")
|
||||||
load("//tensorflow/core/platform:build_config_root.bzl", "if_static")
|
load("//tensorflow/core/platform:build_config_root.bzl", "if_static")
|
||||||
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
|
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
|
||||||
load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm")
|
load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm")
|
||||||
@ -814,4 +814,4 @@ def if_llvm_system_z_available(then, otherwise = []):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def tf_tpu_dependencies():
|
def tf_tpu_dependencies():
|
||||||
return if_tpu(["//tensorflow/core/tpu/kernels"])
|
return if_libtpu(["//tensorflow/core/tpu/kernels"])
|
||||||
|
@ -5,13 +5,11 @@ load(
|
|||||||
"//tensorflow/core/platform:build_config.bzl",
|
"//tensorflow/core/platform:build_config.bzl",
|
||||||
"tf_proto_library",
|
"tf_proto_library",
|
||||||
)
|
)
|
||||||
|
load("//tensorflow:tensorflow.bzl", "if_libtpu", "tf_copts")
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency") # buildifier: disable=same-origin-load
|
load("//tensorflow:tensorflow.bzl", "tf_grpc_cc_dependency") # buildifier: disable=same-origin-load
|
||||||
load("//tensorflow:tensorflow.bzl", "tf_kernel_library") # buildifier: disable=same-origin-load
|
load("//tensorflow:tensorflow.bzl", "tf_kernel_library") # buildifier: disable=same-origin-load
|
||||||
|
|
||||||
# Config setting to enable go/libtpu support.
|
# Config setting to enable go/libtpu support.
|
||||||
WITH_TPU_SUPPORT = "//tensorflow:with_tpu_support"
|
|
||||||
|
|
||||||
DEFAULT = "//conditions:default"
|
|
||||||
|
|
||||||
package(
|
package(
|
||||||
default_visibility = [
|
default_visibility = [
|
||||||
@ -44,10 +42,10 @@ cc_library(
|
|||||||
name = "tpu_compile_op_common",
|
name = "tpu_compile_op_common",
|
||||||
srcs = ["tpu_compile_op_common.cc"],
|
srcs = ["tpu_compile_op_common.cc"],
|
||||||
hdrs = ["tpu_compile_op_common.h"],
|
hdrs = ["tpu_compile_op_common.h"],
|
||||||
deps = select({
|
deps = if_libtpu(
|
||||||
WITH_TPU_SUPPORT: [":tpu_compilation_metrics"],
|
[":tpu_compilation_metrics"],
|
||||||
DEFAULT: ["//tensorflow/core/tpu/kernels:tpu_compilation_metrics"],
|
["//tensorflow/core/tpu/kernels:tpu_compilation_metrics"],
|
||||||
}) + [
|
) + [
|
||||||
":tpu_compilation_cache_entry_unloader",
|
":tpu_compilation_cache_entry_unloader",
|
||||||
":tpu_compilation_cache_interface",
|
":tpu_compilation_cache_interface",
|
||||||
":tpu_compilation_metrics_hdrs",
|
":tpu_compilation_metrics_hdrs",
|
||||||
@ -97,14 +95,10 @@ tf_kernel_library(
|
|||||||
name = "tpu_configuration_ops",
|
name = "tpu_configuration_ops",
|
||||||
srcs = ["tpu_configuration_ops.cc"],
|
srcs = ["tpu_configuration_ops.cc"],
|
||||||
hdrs = ["tpu_configuration_ops.h"],
|
hdrs = ["tpu_configuration_ops.h"],
|
||||||
copts = select({
|
deps = if_libtpu(
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
[":tpu_util"],
|
||||||
DEFAULT: [],
|
["//tensorflow/core/tpu/kernels:tpu_util"],
|
||||||
}),
|
) + [
|
||||||
deps = select({
|
|
||||||
WITH_TPU_SUPPORT: [":tpu_util"],
|
|
||||||
DEFAULT: ["//tensorflow/core/tpu/kernels:tpu_util"],
|
|
||||||
}) + [
|
|
||||||
":tpu_compilation_cache_factory",
|
":tpu_compilation_cache_factory",
|
||||||
":tpu_compilation_cache_interface",
|
":tpu_compilation_cache_interface",
|
||||||
":tpu_compilation_cache_local_lookup",
|
":tpu_compilation_cache_local_lookup",
|
||||||
@ -346,10 +340,10 @@ cc_library(
|
|||||||
name = "tpu_compilation_cache_interface",
|
name = "tpu_compilation_cache_interface",
|
||||||
srcs = ["tpu_compilation_cache_interface.cc"],
|
srcs = ["tpu_compilation_cache_interface.cc"],
|
||||||
hdrs = ["tpu_compilation_cache_interface.h"],
|
hdrs = ["tpu_compilation_cache_interface.h"],
|
||||||
deps = select({
|
deps = if_libtpu(
|
||||||
WITH_TPU_SUPPORT: [":tpu_compilation_metrics"],
|
[":tpu_compilation_metrics"],
|
||||||
DEFAULT: ["//tensorflow/core/tpu/kernels:tpu_compilation_metrics"],
|
["//tensorflow/core/tpu/kernels:tpu_compilation_metrics"],
|
||||||
}) + [
|
) + [
|
||||||
":compiled_subgraph",
|
":compiled_subgraph",
|
||||||
":tpu_compilation_cache_common_proto_cc",
|
":tpu_compilation_cache_common_proto_cc",
|
||||||
":tpu_compilation_cache_entry",
|
":tpu_compilation_cache_entry",
|
||||||
@ -424,10 +418,7 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "tpu_compilation_metrics",
|
name = "tpu_compilation_metrics",
|
||||||
srcs = ["tpu_compilation_metrics.cc"],
|
srcs = ["tpu_compilation_metrics.cc"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
|
||||||
DEFAULT: [],
|
|
||||||
}),
|
|
||||||
deps = [
|
deps = [
|
||||||
":tpu_compilation_metrics_hdrs",
|
":tpu_compilation_metrics_hdrs",
|
||||||
],
|
],
|
||||||
@ -529,14 +520,11 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "tpu_compilation_cache_rpc_support_hdrs",
|
name = "tpu_compilation_cache_rpc_support_hdrs",
|
||||||
hdrs = ["tpu_compilation_cache_rpc_support.h"],
|
hdrs = ["tpu_compilation_cache_rpc_support.h"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
deps = if_libtpu(
|
||||||
DEFAULT: [],
|
[":tpu_compilation_cache_proto_cc"],
|
||||||
}),
|
["//tensorflow/core/tpu/kernels:tpu_compilation_cache_cc_proto"],
|
||||||
deps = select({
|
) + [
|
||||||
WITH_TPU_SUPPORT: [":tpu_compilation_cache_proto_cc"], # build_cleaner: keep
|
|
||||||
DEFAULT: ["//tensorflow/core/tpu/kernels:tpu_compilation_cache_cc_proto"], # build_cleaner: keep
|
|
||||||
}) + [
|
|
||||||
":tpu_compilation_cache_entry",
|
":tpu_compilation_cache_entry",
|
||||||
":tpu_compilation_cache_interface",
|
":tpu_compilation_cache_interface",
|
||||||
":tpu_compilation_cache_lookup",
|
":tpu_compilation_cache_lookup",
|
||||||
@ -550,10 +538,7 @@ cc_library(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "tpu_compilation_cache_rpc_support",
|
name = "tpu_compilation_cache_rpc_support",
|
||||||
srcs = ["tpu_compilation_cache_rpc_support.cc"],
|
srcs = ["tpu_compilation_cache_rpc_support.cc"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
|
||||||
DEFAULT: [],
|
|
||||||
}),
|
|
||||||
deps = [
|
deps = [
|
||||||
":tpu_compilation_cache_common_proto_cc",
|
":tpu_compilation_cache_common_proto_cc",
|
||||||
":tpu_compilation_cache_proto_cc",
|
":tpu_compilation_cache_proto_cc",
|
||||||
@ -572,14 +557,11 @@ cc_library(
|
|||||||
name = "tpu_compilation_cache_rpc_lookup",
|
name = "tpu_compilation_cache_rpc_lookup",
|
||||||
srcs = ["tpu_compilation_cache_rpc_lookup.cc"],
|
srcs = ["tpu_compilation_cache_rpc_lookup.cc"],
|
||||||
hdrs = ["tpu_compilation_cache_rpc_lookup.h"],
|
hdrs = ["tpu_compilation_cache_rpc_lookup.h"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
deps = if_libtpu(
|
||||||
DEFAULT: [],
|
[":tpu_compilation_cache_rpc_support"],
|
||||||
}),
|
["//tensorflow/core/tpu/kernels:tpu_compilation_cache_rpc_support"],
|
||||||
deps = select({
|
) + [
|
||||||
WITH_TPU_SUPPORT: [":tpu_compilation_cache_rpc_support"],
|
|
||||||
DEFAULT: ["//tensorflow/core/tpu/kernels:tpu_compilation_cache_rpc_support"],
|
|
||||||
}) + [
|
|
||||||
":tpu_compilation_cache_grpc",
|
":tpu_compilation_cache_grpc",
|
||||||
":tpu_compilation_cache_interface",
|
":tpu_compilation_cache_interface",
|
||||||
":tpu_compilation_cache_lookup",
|
":tpu_compilation_cache_lookup",
|
||||||
@ -617,14 +599,11 @@ cc_library(
|
|||||||
name = "tpu_compilation_cache_grpc",
|
name = "tpu_compilation_cache_grpc",
|
||||||
srcs = ["tpu_compilation_cache_grpc.cc"],
|
srcs = ["tpu_compilation_cache_grpc.cc"],
|
||||||
hdrs = ["tpu_compilation_cache_grpc.h"],
|
hdrs = ["tpu_compilation_cache_grpc.h"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
deps = if_libtpu(
|
||||||
DEFAULT: [],
|
[":tpu_compilation_cache_proto_cc"],
|
||||||
}),
|
["//tensorflow/core/tpu/kernels:tpu_compilation_cache_cc_proto"],
|
||||||
deps = select({
|
) + [
|
||||||
WITH_TPU_SUPPORT: [":tpu_compilation_cache_proto_cc"],
|
|
||||||
DEFAULT: ["//tensorflow/core/tpu/kernels:tpu_compilation_cache_cc_proto"],
|
|
||||||
}) + [
|
|
||||||
":tpu_compilation_cache_common_proto_cc",
|
":tpu_compilation_cache_common_proto_cc",
|
||||||
tf_grpc_cc_dependency(),
|
tf_grpc_cc_dependency(),
|
||||||
],
|
],
|
||||||
@ -634,20 +613,17 @@ cc_library(
|
|||||||
name = "tpu_compilation_cache_service",
|
name = "tpu_compilation_cache_service",
|
||||||
srcs = ["tpu_compilation_cache_service.cc"],
|
srcs = ["tpu_compilation_cache_service.cc"],
|
||||||
hdrs = ["tpu_compilation_cache_service.h"],
|
hdrs = ["tpu_compilation_cache_service.h"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
deps = if_libtpu(
|
||||||
DEFAULT: [],
|
[
|
||||||
}),
|
":tpu_compilation_cache_rpc_support",
|
||||||
deps = select({
|
":tpu_compilation_cache_proto_cc",
|
||||||
WITH_TPU_SUPPORT: [
|
|
||||||
":tpu_compilation_cache_rpc_support", # build_cleaner: keep
|
|
||||||
":tpu_compilation_cache_proto_cc", # build_cleaner: keep
|
|
||||||
],
|
],
|
||||||
DEFAULT: [
|
[
|
||||||
"//tensorflow/core/tpu/kernels:tpu_compilation_cache_rpc_support", # build_cleaner: keep
|
"//tensorflow/core/tpu/kernels:tpu_compilation_cache_rpc_support",
|
||||||
"//tensorflow/core/tpu/kernels:tpu_compilation_cache_cc_proto", # build_cleaner: keep
|
"//tensorflow/core/tpu/kernels:tpu_compilation_cache_cc_proto",
|
||||||
],
|
],
|
||||||
}) + [
|
) + [
|
||||||
":tpu_compilation_cache_common_proto_cc",
|
":tpu_compilation_cache_common_proto_cc",
|
||||||
":tpu_compilation_cache_grpc",
|
":tpu_compilation_cache_grpc",
|
||||||
":tpu_compilation_cache_interface",
|
":tpu_compilation_cache_interface",
|
||||||
@ -704,10 +680,7 @@ cc_library(
|
|||||||
name = "tpu_compile_op_impl",
|
name = "tpu_compile_op_impl",
|
||||||
srcs = ["tpu_compile_op_impl.cc"],
|
srcs = ["tpu_compile_op_impl.cc"],
|
||||||
hdrs = ["tpu_compile_op_impl.h"],
|
hdrs = ["tpu_compile_op_impl.h"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
|
||||||
DEFAULT: [],
|
|
||||||
}),
|
|
||||||
deps = [
|
deps = [
|
||||||
":tpu_compilation_cache_key",
|
":tpu_compilation_cache_key",
|
||||||
":tpu_compile_c_api_hdrs",
|
":tpu_compile_c_api_hdrs",
|
||||||
@ -952,14 +925,11 @@ cc_library(
|
|||||||
name = "tpu_pod_state",
|
name = "tpu_pod_state",
|
||||||
srcs = ["tpu_pod_state.cc"],
|
srcs = ["tpu_pod_state.cc"],
|
||||||
hdrs = ["tpu_pod_state.h"],
|
hdrs = ["tpu_pod_state.h"],
|
||||||
copts = select({
|
copts = tf_copts(),
|
||||||
WITH_TPU_SUPPORT: ["-DLIBTFTPU"],
|
deps = if_libtpu(
|
||||||
DEFAULT: [],
|
[":tpu_util"],
|
||||||
}),
|
["//tensorflow/core/tpu/kernels:tpu_util"],
|
||||||
deps = select({
|
) + [
|
||||||
WITH_TPU_SUPPORT: [":tpu_util"],
|
|
||||||
DEFAULT: ["//tensorflow/core/tpu/kernels:tpu_util"],
|
|
||||||
}) + [
|
|
||||||
":tpu_compilation_cache_service",
|
":tpu_compilation_cache_service",
|
||||||
"//tensorflow/c:tf_status",
|
"//tensorflow/c:tf_status",
|
||||||
"//tensorflow/c:tf_status_helper",
|
"//tensorflow/c:tf_status_helper",
|
||||||
|
@ -30,11 +30,11 @@ namespace tensorflow {
|
|||||||
namespace tpu {
|
namespace tpu {
|
||||||
|
|
||||||
static const char* grpcTpuCompilationCacheService_method_names[] = {
|
static const char* grpcTpuCompilationCacheService_method_names[] = {
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
"/tensorflow.tpu.TpuCompilationCacheServiceExternal/GetTpuProgram",
|
"/tensorflow.tpu.TpuCompilationCacheServiceExternal/GetTpuProgram",
|
||||||
#else // LIBTFTPU
|
#else // LIBTPU_ON_GCE
|
||||||
"/tensorflow.tpu.TpuCompilationCacheService/GetTpuProgram",
|
"/tensorflow.tpu.TpuCompilationCacheService/GetTpuProgram",
|
||||||
#endif // LIBTFTPU
|
#endif // LIBTPU_ON_GCE
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<grpc::TpuCompilationCacheService::Stub>
|
std::unique_ptr<grpc::TpuCompilationCacheService::Stub>
|
||||||
|
@ -35,7 +35,7 @@ limitations under the License.
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache.pb.h"
|
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache.pb.h"
|
||||||
#else
|
#else
|
||||||
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache.pb.h" // copybara"
|
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache.pb.h" // copybara"
|
||||||
@ -48,7 +48,7 @@ namespace grpc {
|
|||||||
class TpuCompilationCacheService final {
|
class TpuCompilationCacheService final {
|
||||||
public:
|
public:
|
||||||
using RequestType = ::tensorflow::tpu::GetTpuProgramRequest;
|
using RequestType = ::tensorflow::tpu::GetTpuProgramRequest;
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
using ResponseType = ::tensorflow::tpu::GetTpuProgramResponseExternal;
|
using ResponseType = ::tensorflow::tpu::GetTpuProgramResponseExternal;
|
||||||
#else
|
#else
|
||||||
using ResponseType = ::tensorflow::tpu::GetTpuProgramResponse;
|
using ResponseType = ::tensorflow::tpu::GetTpuProgramResponse;
|
||||||
@ -59,7 +59,7 @@ class TpuCompilationCacheService final {
|
|||||||
enum class MethodId { kGetTpuProgram = 0 };
|
enum class MethodId { kGetTpuProgram = 0 };
|
||||||
|
|
||||||
static constexpr char const* service_full_name() {
|
static constexpr char const* service_full_name() {
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
return "tensorflow.tpu.TpuCompilationCacheServiceExternal";
|
return "tensorflow.tpu.TpuCompilationCacheServiceExternal";
|
||||||
#else
|
#else
|
||||||
return "tensorflow.tpu.TpuCompilationCacheService";
|
return "tensorflow.tpu.TpuCompilationCacheService";
|
||||||
|
@ -25,7 +25,7 @@ namespace tensorflow {
|
|||||||
namespace tpu {
|
namespace tpu {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
using ResponseType = GetTpuProgramResponseExternal;
|
using ResponseType = GetTpuProgramResponseExternal;
|
||||||
#else
|
#else
|
||||||
using ResponseType = GetTpuProgramResponse;
|
using ResponseType = GetTpuProgramResponse;
|
||||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/compiler/tf2xla/host_compute_metadata.pb.h"
|
#include "tensorflow/compiler/tf2xla/host_compute_metadata.pb.h"
|
||||||
#include "tensorflow/core/distributed_runtime/rpc/grpc_util.h"
|
#include "tensorflow/core/distributed_runtime/rpc/grpc_util.h"
|
||||||
#include "tensorflow/core/platform/casts.h"
|
#include "tensorflow/core/platform/casts.h"
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache.pb.h"
|
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache.pb.h"
|
||||||
#endif
|
#endif
|
||||||
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache_common.pb.h"
|
#include "tensorflow/core/tpu/kernels/tpu_compilation_cache_common.pb.h"
|
||||||
@ -30,7 +30,7 @@ std::shared_ptr<::grpc::ChannelCredentials> CreateChannelCredentials() {
|
|||||||
return ::grpc::InsecureChannelCredentials(); // NOLINT
|
return ::grpc::InsecureChannelCredentials(); // NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
template <>
|
template <>
|
||||||
Status DeserializeRpcResponseToCacheEntry<GetTpuProgramResponseExternal>(
|
Status DeserializeRpcResponseToCacheEntry<GetTpuProgramResponseExternal>(
|
||||||
absl::string_view local_proto_key, GetTpuProgramResponseExternal* response,
|
absl::string_view local_proto_key, GetTpuProgramResponseExternal* response,
|
||||||
@ -156,6 +156,6 @@ xla::StatusOr<std::vector<::grpc::Slice>> SerializeCacheEntryToBufferSlices(
|
|||||||
|
|
||||||
return std::vector<::grpc::Slice>{::grpc::Slice(encoded_header)};
|
return std::vector<::grpc::Slice>{::grpc::Slice(encoded_header)};
|
||||||
}
|
}
|
||||||
#endif // LIBTFTPU
|
#endif // LIBTPU_ON_GCE
|
||||||
} // namespace tpu
|
} // namespace tpu
|
||||||
} // namespace tensorflow
|
} // namespace tensorflow
|
||||||
|
@ -19,7 +19,7 @@ namespace tpu {
|
|||||||
|
|
||||||
// TODO(henrytan): remove this once `TpuCompilationCache` migration to OSS is
|
// TODO(henrytan): remove this once `TpuCompilationCache` migration to OSS is
|
||||||
// completed.
|
// completed.
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
/* static */
|
/* static */
|
||||||
void TpuCompilationMetrics::IncrementCacheLookupCount(
|
void TpuCompilationMetrics::IncrementCacheLookupCount(
|
||||||
bool is_cache_hit, absl::string_view session_name) {
|
bool is_cache_hit, absl::string_view session_name) {
|
||||||
@ -36,7 +36,7 @@ void TpuCompilationMetrics::IncrementCompilationCount(
|
|||||||
absl::string_view session_name) {
|
absl::string_view session_name) {
|
||||||
// A placeholder for tracking metrics.
|
// A placeholder for tracking metrics.
|
||||||
}
|
}
|
||||||
#endif // LIBTFTPU
|
#endif // LIBTPU_ON_GCE
|
||||||
|
|
||||||
} // namespace tpu
|
} // namespace tpu
|
||||||
} // namespace tensorflow
|
} // namespace tensorflow
|
||||||
|
@ -68,11 +68,11 @@ class TpuCompileOpImplFactory : public CompileOpImplFactory {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
REGISTER_MODULE_INITIALIZER(tpu_compile_op_impl_factory, {
|
REGISTER_MODULE_INITIALIZER(tpu_compile_op_impl_factory, {
|
||||||
VLOG(1) << "register TpuCompileOpImplFactory()";
|
VLOG(1) << "register TpuCompileOpImplFactory()";
|
||||||
CompileOpImplFactory::Register(new TpuCompileOpImplFactory());
|
CompileOpImplFactory::Register(new TpuCompileOpImplFactory());
|
||||||
});
|
});
|
||||||
#endif // LIBTFTPU
|
#endif // LIBTPU_ON_GCE
|
||||||
} // namespace tpu
|
} // namespace tpu
|
||||||
} // namespace tensorflow
|
} // namespace tensorflow
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/c/tf_status_helper.h"
|
#include "tensorflow/c/tf_status_helper.h"
|
||||||
#include "tensorflow/core/tpu/tpu_api.h"
|
#include "tensorflow/core/tpu/tpu_api.h"
|
||||||
|
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
#include "tensorflow/core/tpu/kernels/tpu_util.h"
|
#include "tensorflow/core/tpu/kernels/tpu_util.h"
|
||||||
#else
|
#else
|
||||||
#include "tensorflow/core/tpu/kernels/tpu_util.h" // copybara"
|
#include "tensorflow/core/tpu/kernels/tpu_util.h" // copybara"
|
||||||
@ -54,7 +54,7 @@ xla::StatusOr<std::unique_ptr<TpuCompilationCacheService>>
|
|||||||
ConstructCacheService(ResourceMgr* rmgr, int serving_port,
|
ConstructCacheService(ResourceMgr* rmgr, int serving_port,
|
||||||
tpu::TpuCompilationCacheInterface* compilation_cache) {
|
tpu::TpuCompilationCacheInterface* compilation_cache) {
|
||||||
xla::StatusOr<std::unique_ptr<::grpc::ServerBuilder>> server_builder;
|
xla::StatusOr<std::unique_ptr<::grpc::ServerBuilder>> server_builder;
|
||||||
#if defined(LIBTFTPU)
|
#if defined(LIBTPU_ON_GCE)
|
||||||
server_builder = tpu::CreateServerBuilder(serving_port);
|
server_builder = tpu::CreateServerBuilder(serving_port);
|
||||||
#else
|
#else
|
||||||
server_builder = tpu::CreateServerBuilderGoogle(serving_port);
|
server_builder = tpu::CreateServerBuilderGoogle(serving_port);
|
||||||
|
@ -10,7 +10,7 @@ load(
|
|||||||
"//tensorflow/core/platform/default:cuda_build_defs.bzl",
|
"//tensorflow/core/platform/default:cuda_build_defs.bzl",
|
||||||
"if_cuda_is_configured",
|
"if_cuda_is_configured",
|
||||||
)
|
)
|
||||||
load("//tensorflow:tensorflow.bzl", "if_tpu", "tf_copts")
|
load("//tensorflow:tensorflow.bzl", "if_libtpu", "tf_copts")
|
||||||
load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm_is_configured")
|
load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm_is_configured")
|
||||||
load(
|
load(
|
||||||
"//tensorflow/core/platform:rules_cc.bzl",
|
"//tensorflow/core/platform:rules_cc.bzl",
|
||||||
@ -70,7 +70,7 @@ cc_library(
|
|||||||
"//tensorflow/stream_executor:device_options",
|
"//tensorflow/stream_executor:device_options",
|
||||||
"//tensorflow/stream_executor/lib",
|
"//tensorflow/stream_executor/lib",
|
||||||
"//tensorflow/stream_executor/platform",
|
"//tensorflow/stream_executor/platform",
|
||||||
] + if_tpu(
|
] + if_libtpu(
|
||||||
if_false = ["@local_config_cuda//cuda:cuda_headers"],
|
if_false = ["@local_config_cuda//cuda:cuda_headers"],
|
||||||
if_true = [],
|
if_true = [],
|
||||||
),
|
),
|
||||||
|
@ -261,8 +261,8 @@ def if_nccl(if_true, if_false = []):
|
|||||||
"//conditions:default": if_true,
|
"//conditions:default": if_true,
|
||||||
})
|
})
|
||||||
|
|
||||||
def if_tpu(if_true, if_false = []):
|
def if_libtpu(if_true, if_false = []):
|
||||||
"""Shorthand for select()ing whether to build for TPUs."""
|
"""Shorthand for select()ing whether to build support for using TPUs via libtpu.so"""
|
||||||
return select({
|
return select({
|
||||||
str(Label("//tensorflow:with_tpu_support")): if_true,
|
str(Label("//tensorflow:with_tpu_support")): if_true,
|
||||||
"//conditions:default": if_false,
|
"//conditions:default": if_false,
|
||||||
@ -328,7 +328,7 @@ def tf_copts(
|
|||||||
(if_not_windows(["-fno-exceptions"]) if not allow_exceptions else []) +
|
(if_not_windows(["-fno-exceptions"]) if not allow_exceptions else []) +
|
||||||
if_cuda(["-DGOOGLE_CUDA=1"]) +
|
if_cuda(["-DGOOGLE_CUDA=1"]) +
|
||||||
if_nvcc(["-DTENSORFLOW_USE_NVCC=1"]) +
|
if_nvcc(["-DTENSORFLOW_USE_NVCC=1"]) +
|
||||||
if_tpu(["-DLIBTFTPU"]) +
|
if_libtpu(["-DLIBTPU_ON_GCE"], []) +
|
||||||
if_xla_available(["-DTENSORFLOW_USE_XLA=1"]) +
|
if_xla_available(["-DTENSORFLOW_USE_XLA=1"]) +
|
||||||
if_tensorrt(["-DGOOGLE_TENSORRT=1"]) +
|
if_tensorrt(["-DGOOGLE_TENSORRT=1"]) +
|
||||||
if_mkl(["-DINTEL_MKL=1", "-DENABLE_MKLDNN_V1", "-DENABLE_INTEL_MKL_BFLOAT16"]) +
|
if_mkl(["-DINTEL_MKL=1", "-DENABLE_MKLDNN_V1", "-DENABLE_INTEL_MKL_BFLOAT16"]) +
|
||||||
|
Loading…
Reference in New Issue
Block a user