Refactor the mobile/portable/android/ios targets to use filegroups

where possible.

PiperOrigin-RevId: 290126994
Change-Id: I5e456b788e306cef294882445cd2bf9005343dd5
This commit is contained in:
A. Unique TensorFlower 2020-01-16 13:03:09 -08:00 committed by TensorFlower Gardener
parent fd2cd3e10e
commit de37b1eaca
22 changed files with 597 additions and 497 deletions

View File

@ -79,6 +79,8 @@ load(
"tf_cc_tests",
"tf_copts",
"tf_cuda_library",
"tf_defines_nortti_if_android",
"tf_defines_nortti_if_emscripten",
"tf_features_nomodules_if_android",
"tf_features_nomodules_if_emscripten",
"tf_gen_op_libs",
@ -123,6 +125,7 @@ load(
"tf_jspb_proto_library",
"tf_kernel_tests_linkstatic",
"tf_lib_proto_parsing_deps",
"tf_portable_deps_no_runtime",
"tf_proto_library",
"tf_proto_library_cc",
"tf_protos_all",
@ -1292,80 +1295,76 @@ filegroup(
visibility = ["//visibility:public"],
)
# Core sources for Android builds.
# Sources required to build the TensorFlow framework without the runtime on
# mobile platforms. This is essentially the sources required to build
# tensorflow/core/framework:tensor without using granular targets.
filegroup(
name = "mobile_srcs_no_runtime",
srcs = [
"//tensorflow/compiler/jit:mobile_srcs_no_runtime",
"//tensorflow/core/framework:attr_value_proto_text_srcs",
"//tensorflow/core/framework:mobile_srcs_no_runtime",
"//tensorflow/core/lib/bfloat16:bfloat16.cc",
"//tensorflow/core/lib/bfloat16:bfloat16.h",
"//tensorflow/core/lib/core:legacy_lib_core_all_headers",
"//tensorflow/core/lib/core:legacy_lib_core_all_srcs",
"//tensorflow/core/lib/gtl:legacy_lib_gtl_all_headers",
"//tensorflow/core/lib/hash:legacy_lib_hash_all_headers",
"//tensorflow/core/lib/hash:legacy_lib_hash_all_srcs",
"//tensorflow/core/lib/histogram:legacy_lib_histogram_all_headers",
"//tensorflow/core/lib/histogram:legacy_lib_histogram_all_srcs",
"//tensorflow/core/lib/io:legacy_lib_io_all_headers",
"//tensorflow/core/lib/io:legacy_lib_io_all_srcs",
"//tensorflow/core/lib/math:math_util.h",
"//tensorflow/core/lib/monitoring:legacy_lib_monitoring_all_headers",
"//tensorflow/core/lib/monitoring:legacy_lib_monitoring_all_srcs",
"//tensorflow/core/lib/random:legacy_lib_random_all_headers",
"//tensorflow/core/lib/random:legacy_lib_random_all_srcs",
"//tensorflow/core/lib/strings:legacy_lib_strings_all_headers",
"//tensorflow/core/lib/strings:legacy_lib_strings_all_srcs",
"//tensorflow/core/platform:legacy_mobile_srcs",
"//tensorflow/core/profiler:mobile_srcs",
"//tensorflow/core/lib/bfloat16:mobile_srcs_no_runtime",
"//tensorflow/core/lib/core:mobile_srcs_no_runtime",
"//tensorflow/core/lib/gtl:mobile_srcs_no_runtime",
"//tensorflow/core/lib/hash:mobile_srcs_no_runtime",
"//tensorflow/core/lib/strings:mobile_srcs_no_runtime",
"//tensorflow/core/platform:mobile_srcs_no_runtime",
"//tensorflow/core/public:mobile_srcs_no_runtime",
"//tensorflow/core/util/ctc:android_srcs",
"//tensorflow/core/util/sparse:mobile_srcs_no_runtime_group",
"//tensorflow/core/util:mobile_srcs_no_runtime",
] + glob(
[
"client/**/*.cc",
"lib/**/*.h",
"lib/**/*.cc",
],
exclude = [
"**/*test.*",
"**/*testutil*",
"**/*testlib*",
"**/*main.cc",
"debug/**/*",
"lib/jpeg/**/*",
"lib/png/**/*",
"lib/gif/**/*",
"user_ops/**/*.cu.cc",
"common_runtime/gpu/**/*",
"common_runtime/eager/*",
"common_runtime/gpu_device_factory.*",
],
) + if_chromiumos(
["//tensorflow/core/platform:legacy_srcs_no_runtime_google"],
otherwise = ["//tensorflow/core/platform:legacy_srcs_no_runtime"],
),
visibility = ["//visibility:private"],
)
# Sources required to build the TensorFlow framework with runtime on
# mobile platforms without granular targets. It is assumed that the source
# files in tensorflow/core:mobile_srcs_no_runtime have been compiled
# separately and are linked in as a dependency.
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
# Sources for which we do not yet have granular targets.
"//tensorflow/c/eager:srcs",
"//tensorflow/c:srcs",
"//tensorflow/core/common_runtime/eager:srcs",
"//tensorflow/core/framework:mobile_srcs_only_runtime",
"//tensorflow/core/kernels:android_srcs",
"//tensorflow/core/lib/io:mobile_srcs_only_runtime",
"//tensorflow/core/profiler:mobile_srcs",
"//tensorflow/core/public:mobile_srcs_only_runtime",
"//tensorflow/core/util/ctc:android_srcs",
"//tensorflow/core/util/sparse:mobile_srcs_only_runtime",
"//tensorflow/core/util/tensor_bundle:android_srcs",
"//tensorflow/core/util:mobile_srcs_only_runtime",
# Sources for which we already have granular targets.
"//tensorflow/core/lib/core:mobile_srcs_only_runtime",
"//tensorflow/core/lib/gtl:mobile_srcs_only_runtime",
"//tensorflow/core/lib/hash:mobile_srcs_only_runtime",
"//tensorflow/core/lib/histogram:mobile_srcs_only_runtime",
"//tensorflow/core/lib/math:mobile_srcs_only_runtime",
"//tensorflow/core/lib/monitoring:mobile_srcs_only_runtime",
"//tensorflow/core/lib/random:mobile_srcs_only_runtime",
"//tensorflow/core/lib/strings:mobile_srcs_only_runtime",
"//tensorflow/core/platform:mobile_srcs_only_runtime",
] + glob(
[
"common_runtime/**/*.h",
"common_runtime/**/*.cc",
"graph/**/*.h",
"common_runtime/**/*.h",
"graph/**/*.cc",
"graph/**/*.h",
"lib/wav/*.cc",
"lib/wav/*.h",
],
exclude = [
"**/*test.*",
@ -1389,6 +1388,12 @@ filegroup(
visibility = ["//visibility:public"],
)
alias(
name = "android_srcs",
actual = ":mobile_srcs",
visibility = ["//visibility:public"],
)
# Native library support for Android applications. Does not contain
# operators, use :android_tensorflow_lib if you want full operator
# support.
@ -1405,51 +1410,31 @@ filegroup(
# --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
cc_library(
name = "android_tensorflow_lib_lite",
srcs = if_android([":android_srcs"]),
copts = tf_copts(android_optimization_level_override = None) + [
"-DSUPPORT_SELECTIVE_REGISTRATION",
],
srcs = if_android([":mobilesrcs"]),
copts = tf_copts(android_optimization_level_override = None),
defines = ["SUPPORT_SELECTIVE_REGISTRATION"],
linkopts = ["-lz"],
tags = [
"manual",
"notap",
],
visibility = ["//visibility:public"],
deps = [
":mobile_additional_lib_deps",
":protos_all_cc_impl",
"//tensorflow/core/util:stats_calculator_portable",
"//third_party/eigen3",
"@com_google_protobuf//:protobuf",
"@double_conversion//:double-conversion",
"@farmhash_archive//:farmhash",
"@nsync//:nsync_cpp",
],
alwayslink = 1,
)
cc_library(
name = "android_tensorflow_lib_lite_nortti",
srcs = if_android([":android_srcs"]),
copts = tf_copts(android_optimization_level_override = None) + [
"-DSUPPORT_SELECTIVE_REGISTRATION",
] + tf_opts_nortti_if_android(),
srcs = if_android([":mobile_srcs"]),
copts = tf_copts(android_optimization_level_override = None) + tf_opts_nortti_if_android(),
defines = [
"SUPPORT_SELECTIVE_REGISTRATION",
] + tf_defines_nortti_if_android(),
linkopts = ["-lz"],
tags = [
"manual",
"notap",
],
visibility = ["//visibility:public"],
deps = [
":mobile_additional_lib_deps",
":protos_all_cc_impl",
"//tensorflow/core/util:stats_calculator_portable",
"//third_party/eigen3",
"@com_google_protobuf//:protobuf",
"@double_conversion//:double-conversion",
"@farmhash_archive//:farmhash",
"@nsync//:nsync_cpp",
],
alwayslink = 1,
)
@ -1463,29 +1448,6 @@ cc_library(
],
)
cc_library(
name = "emscripten_tensorflow_lib_lite_nortti_lite_protos_no_runtime",
srcs = if_emscripten([":mobile_srcs_no_runtime"]),
copts = ["-DSUPPORT_SELECTIVE_REGISTRATION"] + tf_opts_nortti_if_emscripten(),
defines = ["TENSORFLOW_LITE_PROTOS"],
tags = [
"manual",
"notap",
],
visibility = ["//visibility:public"],
deps = [
":emscripten_proto_lib_no_rtti_lite_runtime",
":mobile_additional_lib_deps",
"//tensorflow/core/util:stats_calculator_portable",
"//third_party/eigen3",
"@double_conversion//:double-conversion",
"@farmhash_archive//:farmhash",
"@nsync//:nsync_cpp",
"@zlib_archive//:zlib",
],
alwayslink = 1,
)
# Native library support for iOS applications.
#
# bazel build --config=ios_x86_64 \
@ -1513,19 +1475,10 @@ cc_library(
cc_library(
name = "ios_tensorflow_lib_lite",
srcs = if_ios([":android_srcs"]),
srcs = if_ios([":mobile_srcs"]),
copts = tf_copts() + ["-Os"],
visibility = ["//visibility:public"],
deps = [
":mobile_additional_lib_deps",
":protos_all_cc_impl",
"//tensorflow/core/util:stats_calculator_portable",
"//third_party/eigen3",
"@com_google_protobuf//:protobuf",
"@double_conversion//:double-conversion",
"@farmhash_archive//:farmhash",
"@nsync//:nsync_cpp",
],
deps = tf_portable_deps_no_runtime(),
alwayslink = 1,
)
@ -1599,7 +1552,7 @@ filegroup(
visibility = ["//visibility:public"],
)
# This is like android_test_srcs, minus the things that are already in android_srcs.
# This is like android_test_srcs, minus the things that are already in mobile_srcs.
filegroup(
name = "android_test_srcs_no_core",
srcs = [
@ -4656,21 +4609,3 @@ tf_portable_proto_library(
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:protobuf"],
)
alias(
name = "android_srcs_no_runtime",
actual = ":mobile_srcs_no_runtime",
visibility = ["//visibility:public"],
)
alias(
name = "android_srcs_only_runtime",
actual = ":mobile_srcs_only_runtime",
visibility = ["//visibility:public"],
)
alias(
name = "android_srcs",
actual = ":mobile_srcs",
visibility = ["//visibility:public"],
)

View File

@ -258,11 +258,44 @@ filegroup(
"allocator.h",
"allocator_registry.cc",
"allocator_registry.h",
"attr_value_util.cc",
"attr_value_util.h",
"bfloat16.cc",
"bfloat16.h",
"bounds_check.h",
"cpu_allocator_impl.cc",
"log_memory.cc",
"log_memory.h",
"numeric_types.h",
"register_types.h",
"resource_handle.cc",
"resource_handle.h",
"tensor.cc",
"tensor.h",
"tensor_shape.cc",
"tensor_shape.h",
"tensor_types.h",
"tracking_allocator.cc",
"tracking_allocator.h",
"type_index.h",
"type_traits.h",
"typed_allocator.cc",
"typed_allocator.h",
"types.cc",
"types.h",
"variant.cc",
"variant.h",
"variant_encode_decode.h",
"variant_op_registry.cc",
"variant_op_registry.h",
"variant_tensor_data.cc",
"variant_tensor_data.h",
],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"attr_value_util.cc",
"attr_value_util.h",
"cancellation.cc",
"cancellation.h",
"collective.cc",
@ -270,12 +303,11 @@ filegroup(
"common_shape_fns.cc",
"common_shape_fns.h",
"control_flow.h",
"cpu_allocator_impl.cc",
"dataset.cc",
"dataset.h",
"dataset_stateful_op_whitelist.h",
"device_base.cc",
"device_base.h",
"fake_input.cc",
"fake_input.h",
"function.cc",
"function.h",
"function_handle_cache.cc",
@ -291,8 +323,6 @@ filegroup(
"load_library.cc",
"local_rendezvous.cc",
"local_rendezvous.h",
"log_memory.cc",
"log_memory.h",
"logging.cc",
"logging.h",
"lookup_interface.cc",
@ -303,15 +333,16 @@ filegroup(
"model.h",
"node_def_builder.cc",
"node_def_builder.h",
"node_def_util.cc",
"node_def_util.h",
"numeric_op.h",
"numeric_types.h",
"op.cc",
"op.h",
"op_def_builder.cc",
"op_def_builder.h",
"op_def_util.cc",
"op_def_util.h",
"op_kernel.cc",
"op_kernel.h",
"op_segment.cc",
"op_segment.h",
@ -319,16 +350,10 @@ filegroup(
"ops_util.h",
"partial_tensor_shape.h",
"queue_interface.h",
"reader_base.cc",
"reader_base.h",
"reader_interface.h",
"reader_op_kernel.h",
"register_types.h",
"register_types_traits.h",
"rendezvous.cc",
"rendezvous.h",
"resource_handle.cc",
"resource_handle.h",
"resource_mgr.cc",
"resource_mgr.h",
"resource_op_kernel.h",
@ -341,52 +366,21 @@ filegroup(
"session_state.h",
"shape_inference.cc",
"shape_inference.h",
"shared_ptr_variant.h",
"stats_aggregator.h",
"tensor.cc",
"tensor.h",
"tensor_interface.h",
"tensor_reference.h",
"tensor_shape.cc",
"tensor_shape.h",
"tensor_slice.cc",
"tensor_slice.h",
"tensor_types.h",
"tensor_util.cc",
"tensor_util.h",
"thread_factory.h",
"tracking_allocator.cc",
"tracking_allocator.h",
"type_index.h",
"type_traits.h",
"typed_allocator.cc",
"typed_allocator.h",
"types.cc",
"types.h",
"unique_tensor_references.cc",
"unique_tensor_references.h",
"variant.cc",
"variant.h",
"variant_encode_decode.h",
"variant_op_registry.cc",
"variant_op_registry.h",
"variant_tensor_data.cc",
"variant_tensor_data.h",
"versions.cc",
"versions.h",
],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"dataset.cc",
"dataset.h",
"node_def_util.cc",
"op_kernel.cc",
],
)
filegroup(
name = "android_test_hdrs",
srcs = [

View File

@ -32,13 +32,6 @@ std::unordered_set<string>* UnaryVariantOpRegistry::PersistentStringStorage() {
return string_storage;
}
// static
UnaryVariantOpRegistry* UnaryVariantOpRegistry::Global() {
static UnaryVariantOpRegistry* global_unary_variant_op_registry =
new UnaryVariantOpRegistry;
return global_unary_variant_op_registry;
}
UnaryVariantOpRegistry::VariantDecodeFn* UnaryVariantOpRegistry::GetDecodeFn(
StringPiece type_name) {
auto found = decode_fns.find(type_name);
@ -102,28 +95,6 @@ REGISTER_VARIANT_DECODE_TYPE(double);
#undef REGISTER_VARIANT_DECODE_TYPE
UnaryVariantOpRegistry::AsyncVariantDeviceCopyFn*
UnaryVariantOpRegistry::GetDeviceCopyFn(
const VariantDeviceCopyDirection direction, const TypeIndex& type_index) {
auto found = device_copy_fns.find(std::make_pair(direction, type_index));
if (found == device_copy_fns.end()) return nullptr;
return &found->second;
}
void UnaryVariantOpRegistry::RegisterDeviceCopyFn(
const VariantDeviceCopyDirection direction, const TypeIndex& type_index,
const AsyncVariantDeviceCopyFn& device_copy_fn) {
AsyncVariantDeviceCopyFn* existing = GetDeviceCopyFn(direction, type_index);
CHECK_EQ(existing, nullptr)
<< "UnaryVariantDeviceCopy for direction: " << direction
<< " and type_index: " << port::MaybeAbiDemangle(type_index.name())
<< " already registered";
device_copy_fns.insert(
std::pair<std::pair<VariantDeviceCopyDirection, TypeIndex>,
AsyncVariantDeviceCopyFn>(std::make_pair(direction, type_index),
device_copy_fn));
}
Status VariantDeviceCopy(
const VariantDeviceCopyDirection direction, const Variant& from,
Variant* to,
@ -171,26 +142,6 @@ REGISTER_VARIANT_DEVICE_COPY_TYPE(bool);
#undef REGISTER_VARIANT_DEVICE_COPY_TYPE
// Special casing UnaryOpFn per op and per device.
UnaryVariantOpRegistry::VariantUnaryOpFn* UnaryVariantOpRegistry::GetUnaryOpFn(
VariantUnaryOp op, StringPiece device, const TypeIndex& type_index) {
auto found = unary_op_fns.find({op, device, type_index});
if (found == unary_op_fns.end()) return nullptr;
return &found->second;
}
void UnaryVariantOpRegistry::RegisterUnaryOpFn(
VariantUnaryOp op, const string& device, const TypeIndex& type_index,
const VariantUnaryOpFn& unary_op_fn) {
VariantUnaryOpFn* existing = GetUnaryOpFn(op, device, type_index);
CHECK_EQ(existing, nullptr)
<< "Unary VariantUnaryOpFn for type_index: "
<< port::MaybeAbiDemangle(type_index.name())
<< " already registered for device type: " << device;
unary_op_fns.insert(std::pair<FuncTuple<VariantUnaryOp>, VariantUnaryOpFn>(
{op, GetPersistentStringPiece(device), type_index}, unary_op_fn));
}
namespace {
template <typename T>
Status ZerosLikeVariantPrimitiveType(OpKernelContext* ctx, const T& t,
@ -213,27 +164,6 @@ REGISTER_VARIANT_ZEROS_LIKE_TYPE(bool);
#undef REGISTER_VARIANT_ZEROS_LIKE_TYPE
// Special casing BinaryOpFn per op and per device.
UnaryVariantOpRegistry::VariantBinaryOpFn*
UnaryVariantOpRegistry::GetBinaryOpFn(VariantBinaryOp op, StringPiece device,
const TypeIndex& type_index) {
auto found = binary_op_fns.find({op, device, type_index});
if (found == binary_op_fns.end()) return nullptr;
return &found->second;
}
void UnaryVariantOpRegistry::RegisterBinaryOpFn(
VariantBinaryOp op, const string& device, const TypeIndex& type_index,
const VariantBinaryOpFn& add_fn) {
VariantBinaryOpFn* existing = GetBinaryOpFn(op, device, type_index);
CHECK_EQ(existing, nullptr)
<< "Unary VariantBinaryOpFn for type_index: "
<< port::MaybeAbiDemangle(type_index.name())
<< " already registered for device type: " << device;
binary_op_fns.insert(std::pair<FuncTuple<VariantBinaryOp>, VariantBinaryOpFn>(
{op, GetPersistentStringPiece(device), type_index}, add_fn));
}
namespace {
template <typename T>
Status AddVariantPrimitiveType(OpKernelContext* ctx, const T& a, const T& b,

View File

@ -102,35 +102,78 @@ class UnaryVariantOpRegistry {
// Add a copy-to-GPU function to the registry.
void RegisterDeviceCopyFn(const VariantDeviceCopyDirection direction,
const TypeIndex& type_index,
const AsyncVariantDeviceCopyFn& device_copy_fn);
const AsyncVariantDeviceCopyFn& device_copy_fn) {
AsyncVariantDeviceCopyFn* existing = GetDeviceCopyFn(direction, type_index);
CHECK_EQ(existing, nullptr)
<< "UnaryVariantDeviceCopy for direction: " << direction
<< " and type_index: " << port::MaybeAbiDemangle(type_index.name())
<< " already registered";
device_copy_fns.insert(
std::pair<std::pair<VariantDeviceCopyDirection, TypeIndex>,
AsyncVariantDeviceCopyFn>(
std::make_pair(direction, type_index), device_copy_fn));
}
// Returns nullptr if no copy function was found for the given
// TypeName and direction.
AsyncVariantDeviceCopyFn* GetDeviceCopyFn(
const VariantDeviceCopyDirection direction, const TypeIndex& type_index);
const VariantDeviceCopyDirection direction, const TypeIndex& type_index) {
auto found = device_copy_fns.find(std::make_pair(direction, type_index));
if (found == device_copy_fns.end()) return nullptr;
return &found->second;
}
// Add a unary op function to the registry.
void RegisterUnaryOpFn(VariantUnaryOp op, const string& device,
const TypeIndex& type_index,
const VariantUnaryOpFn& unary_op_fn);
const VariantUnaryOpFn& unary_op_fn) {
VariantUnaryOpFn* existing = GetUnaryOpFn(op, device, type_index);
CHECK_EQ(existing, nullptr)
<< "Unary VariantUnaryOpFn for type_index: "
<< port::MaybeAbiDemangle(type_index.name())
<< " already registered for device type: " << device;
unary_op_fns.insert(std::pair<FuncTuple<VariantUnaryOp>, VariantUnaryOpFn>(
{op, GetPersistentStringPiece(device), type_index}, unary_op_fn));
}
// Returns nullptr if no unary op function was found for the given
// op, device, and TypeName.
VariantUnaryOpFn* GetUnaryOpFn(VariantUnaryOp op, StringPiece device,
const TypeIndex& type_index);
const TypeIndex& type_index) {
auto found = unary_op_fns.find({op, device, type_index});
if (found == unary_op_fns.end()) return nullptr;
return &found->second;
}
// Add a binary op function to the registry.
void RegisterBinaryOpFn(VariantBinaryOp op, const string& device,
const TypeIndex& type_index,
const VariantBinaryOpFn& add_fn);
const VariantBinaryOpFn& add_fn) {
VariantBinaryOpFn* existing = GetBinaryOpFn(op, device, type_index);
CHECK_EQ(existing, nullptr)
<< "Unary VariantBinaryOpFn for type_index: "
<< port::MaybeAbiDemangle(type_index.name())
<< " already registered for device type: " << device;
binary_op_fns.insert(
std::pair<FuncTuple<VariantBinaryOp>, VariantBinaryOpFn>(
{op, GetPersistentStringPiece(device), type_index}, add_fn));
}
// Returns nullptr if no binary op function was found for the given
// op, device and TypeName.
VariantBinaryOpFn* GetBinaryOpFn(VariantBinaryOp op, StringPiece device,
const TypeIndex& type_index);
const TypeIndex& type_index) {
auto found = binary_op_fns.find({op, device, type_index});
if (found == binary_op_fns.end()) return nullptr;
return &found->second;
}
// Get a pointer to a global UnaryVariantOpRegistry object
static UnaryVariantOpRegistry* Global();
static UnaryVariantOpRegistry* Global() {
static UnaryVariantOpRegistry* global_unary_variant_op_registry =
new UnaryVariantOpRegistry;
return global_unary_variant_op_registry;
}
// Get a pointer to a global persistent string storage object.
// ISO/IEC C++ working draft N4296 clarifies that insertion into an

View File

@ -15,6 +15,15 @@ cc_library(
],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_no_runtime",
srcs = [
"bfloat16.cc",
"bfloat16.h",
],
)
# TODO(bmzhao): Remove the following once references in core/BUILD is removed.
exports_files(
glob(["*"]),

View File

@ -140,6 +140,35 @@ tf_proto_library(
exports = ["//tensorflow/core:error_codes_proto_impl"],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_no_runtime",
srcs = [
"blocking_counter.h",
"coding.h",
"errors.h",
"refcount.h",
"status.h",
"stringpiece.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"arena.cc",
"arena.h",
"bitmap.h",
"bits.h",
"notification.h",
"threadpool.h",
"threadpool_interface.h",
"threadpool_options.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_core_all_headers",
srcs = [
@ -162,15 +191,6 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_core_all_srcs",
srcs = [
"arena.cc",
"bitmap.cc",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_core_all_tests",
srcs = [

View File

@ -189,6 +189,36 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_no_runtime",
srcs = [
"array_slice.h",
"flatmap.h",
"flatrep.h",
"inlined_vector.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"cleanup.h",
"edit_distance.h",
"flatset.h",
"int_type.h",
"iterator_range.h",
"manual_constructor.h",
"map_util.h",
"optional.h",
"priority_queue_util.h",
"subtle/map_traits.h",
"top_n.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_gtl_all_headers",
srcs = [

View File

@ -49,24 +49,34 @@ cc_library(
],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "legacy_lib_hash_all_headers",
name = "mobile_srcs_no_runtime",
srcs = [
"crc32c.h",
"hash.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_hash_all_srcs",
name = "mobile_srcs_only_runtime",
srcs = [
"crc32c.cc",
"crc32c.h",
"crc32c_accelerate.cc",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_hash_all_headers",
srcs = [
"crc32c.h",
"hash.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_internal_public_headers",
srcs = [

View File

@ -26,18 +26,20 @@ cc_library(
alwayslink = True,
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "legacy_lib_histogram_all_headers",
name = "mobile_srcs_only_runtime",
srcs = [
"histogram.cc",
"histogram.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_histogram_all_srcs",
name = "legacy_lib_histogram_all_headers",
srcs = [
"histogram.cc",
"histogram.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)

View File

@ -275,6 +275,45 @@ cc_library(
alwayslink = True,
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"block.cc",
"block.h",
"block_builder.cc",
"block_builder.h",
"buffered_inputstream.cc",
"buffered_inputstream.h",
"compression.cc",
"compression.h",
"format.cc",
"format.h",
"inputbuffer.cc",
"inputbuffer.h",
"inputstream_interface.cc",
"inputstream_interface.h",
"iterator.cc",
"iterator.h",
"path.h",
"random_inputstream.cc",
"random_inputstream.h",
"record_reader.cc",
"record_reader.h",
"table.cc",
"table.h",
"table_builder.cc",
"table_builder.h",
"table_options.h",
"two_level_iterator.cc",
"two_level_iterator.h",
"zlib_compression_options.cc",
"zlib_compression_options.h",
"zlib_inputstream.cc",
"zlib_inputstream.h",
],
)
filegroup(
name = "legacy_lib_io_all_headers",
srcs = [
@ -304,32 +343,6 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_io_all_srcs",
srcs = [
"block.cc",
"block_builder.cc",
"buffered_inputstream.cc",
"compression.cc",
"format.cc",
"inputbuffer.cc",
"inputstream_interface.cc",
"iterator.cc",
"random_inputstream.cc",
"record_reader.cc",
"record_writer.cc",
"snappy/snappy_inputbuffer.cc",
"snappy/snappy_outputbuffer.cc",
"table.cc",
"table_builder.cc",
"two_level_iterator.cc",
"zlib_compression_options.cc",
"zlib_inputstream.cc",
"zlib_outputbuffer.cc",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_io_all_tests",
srcs = [

View File

@ -16,6 +16,15 @@ cc_library(
],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"math_util.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
exports_files([
"math_util.h",
"math_util_test.cc",

View File

@ -194,6 +194,22 @@ cc_library(
],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"counter.h",
"gauge.h",
"metric_def.h",
"mobile_counter.h",
"mobile_gauge.h",
"mobile_sampler.h",
"sampler.h",
"types.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_monitoring_lib_headers",
srcs = [
@ -239,16 +255,6 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_monitoring_all_srcs",
srcs = [
"collection_registry.cc",
"percentile_sampler.cc",
"sampler.cc",
],
visibility = ["//tensorflow/core:__pkg__"],
)
# Note(bmzhao): Ideally we would use a filegroup to represent these tests instead.
# However, that causes tf_cc_tests to link all of these tests into a single object
# file. This breaks collection_registry_test, because sample_test.cc has static variables

View File

@ -92,6 +92,23 @@ cc_library(
alwayslink = 1,
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"distribution_sampler.cc",
"distribution_sampler.h",
"exact_uniform_int.h",
"philox_random.h",
"random.h",
"random_distributions.h",
"simple_philox.cc",
"simple_philox.h",
"weighted_picker.cc",
"weighted_picker.h",
],
)
filegroup(
name = "legacy_lib_random_headers",
srcs = [
@ -136,17 +153,6 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_random_all_srcs",
srcs = [
"distribution_sampler.cc",
"random_distributions.cc",
"simple_philox.cc",
"weighted_picker.cc",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_random_tests",
srcs = [

View File

@ -92,6 +92,33 @@ cc_library(
deps = ["//tensorflow/core/platform:stringprintf"],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_no_runtime",
srcs = [
"proto_text_util.cc",
"proto_text_util.h",
"scanner.h",
"str_util.h",
"strcat.h",
"stringprintf.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"base64.h",
"numbers.h",
"ordered_code.cc",
"ordered_code.h",
"proto_serialization.cc",
"proto_serialization.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_strings_all_headers",
srcs = [
@ -108,16 +135,6 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_strings_all_srcs",
srcs = [
"ordered_code.cc",
"proto_serialization.cc",
"proto_text_util.cc",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_lib_strings_all_tests",
srcs = [

View File

@ -20,8 +20,9 @@ load(
"tf_additional_tensor_coding_deps",
"tf_additional_test_srcs",
"tf_fingerprint_deps",
"tf_google_mobile_srcs_no_runtime",
"tf_google_mobile_srcs_only_runtime",
"tf_kernel_tests_linkstatic",
"tf_legacy_srcs_no_runtime_google",
"tf_logging_deps",
"tf_monitoring_deps",
"tf_platform_alias",
@ -32,6 +33,7 @@ load(
)
load(
"//tensorflow:tensorflow.bzl",
"if_chromiumos",
"if_not_android",
"tf_cc_test",
"tf_cc_tests",
@ -1247,162 +1249,117 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
# These are the files in common between :legacy_srcs_no_runtime
# and :legacy_srcs_no_runtime_google
# These files as basically all the headers + cc files under tensorflow/core/platform,
# excluding any test sources, testing utilities, cuda, rocm, stream_executor,
# image headers (gif.h, jpeg.h, png.h), and certain translation units (
# env_time.cc, logging.cc, logger.cc, mutex.cc) that would cause collisions
# with :platform_base, a common dependency for downstream targets.
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "legacy_srcs_common",
name = "mobile_srcs_no_runtime",
srcs = [
"//tensorflow/core/platform:abi.cc",
"//tensorflow/core/platform:abi.h",
"//tensorflow/core/platform:base64.cc",
"//tensorflow/core/platform:base64.h",
"//tensorflow/core/platform:blocking_counter.h",
"//tensorflow/core/platform:byte_order.h",
"//tensorflow/core/platform:casts.h",
"//tensorflow/core/platform:coding.cc",
"//tensorflow/core/platform:coding.h",
"//tensorflow/core/platform:context.h",
"//tensorflow/core/platform:cord.h",
"//tensorflow/core/platform:cpu_feature_guard.cc",
"//tensorflow/core/platform:cpu_feature_guard.h",
"//tensorflow/core/platform:cpu_info.cc",
"//tensorflow/core/platform:cpu_info.h",
"//tensorflow/core/platform:demangle.h",
"//tensorflow/core/platform:denormal.cc",
"//tensorflow/core/platform:denormal.h",
"//tensorflow/core/platform:dynamic_annotations.h",
"//tensorflow/core/platform:env.cc",
"//tensorflow/core/platform:env.h",
"//tensorflow/core/platform:env_time.h",
"//tensorflow/core/platform:error.cc",
"//tensorflow/core/platform:error.h",
"//tensorflow/core/platform:errors.h",
"//tensorflow/core/platform:file_statistics.h",
"//tensorflow/core/platform:file_system.cc",
"//tensorflow/core/platform:file_system.h",
"//tensorflow/core/platform:file_system_helper.cc",
"//tensorflow/core/platform:file_system_helper.h",
"//tensorflow/core/platform:fingerprint.h",
"//tensorflow/core/platform:hash.cc",
"//tensorflow/core/platform:hash.h",
"//tensorflow/core/platform:host_info.h",
"//tensorflow/core/platform:human_readable_json.h",
"//tensorflow/core/platform:init_main.h",
"//tensorflow/core/platform:load_library.h",
"//tensorflow/core/platform:logger.h",
"//tensorflow/core/platform:logging.h",
"//tensorflow/core/platform:macros.h",
"//tensorflow/core/platform:mem.h",
"//tensorflow/core/platform:monitoring.h",
"//tensorflow/core/platform:mutex.h",
"//tensorflow/core/platform:net.h",
"//tensorflow/core/platform:notification.h",
"//tensorflow/core/platform:null_file_system.h",
"//tensorflow/core/platform:numa.h",
"//tensorflow/core/platform:numbers.cc",
"//tensorflow/core/platform:numbers.h",
"//tensorflow/core/platform:path.cc",
"//tensorflow/core/platform:path.h",
"//tensorflow/core/platform:platform.h",
"//tensorflow/core/platform:platform_strings.cc",
"//tensorflow/core/platform:platform_strings.h",
"//tensorflow/core/platform:platform_strings_computed.h",
"//tensorflow/core/platform:prefetch.h",
"//tensorflow/core/platform:profile_utils/android_armv7a_cpu_utils_helper.cc",
"//tensorflow/core/platform:profile_utils/android_armv7a_cpu_utils_helper.h",
"//tensorflow/core/platform:profile_utils/clock_cycle_profiler.cc",
"//tensorflow/core/platform:profile_utils/clock_cycle_profiler.h",
"//tensorflow/core/platform:profile_utils/cpu_utils.cc",
"//tensorflow/core/platform:profile_utils/cpu_utils.h",
"//tensorflow/core/platform:profile_utils/i_cpu_utils_helper.h",
"//tensorflow/core/platform:protobuf.cc",
"//tensorflow/core/platform:protobuf.h",
"//tensorflow/core/platform:protobuf_compiler.h",
"//tensorflow/core/platform:protobuf_internal.h",
"//tensorflow/core/platform:protobuf_util.cc",
"//tensorflow/core/platform:random.cc",
"//tensorflow/core/platform:random.h",
"//tensorflow/core/platform:raw_coding.h",
"//tensorflow/core/platform:refcount.h",
"//tensorflow/core/platform:regexp.h",
"//tensorflow/core/platform:scanner.cc",
"//tensorflow/core/platform:scanner.h",
"//tensorflow/core/platform:setround.cc",
"//tensorflow/core/platform:setround.h",
"//tensorflow/core/platform:snappy.h",
"//tensorflow/core/platform:stacktrace.h",
"//tensorflow/core/platform:stacktrace_handler.h",
"//tensorflow/core/platform:status.cc",
"//tensorflow/core/platform:status.h",
"//tensorflow/core/platform:str_util.cc",
"//tensorflow/core/platform:str_util.h",
"//tensorflow/core/platform:strcat.cc",
"//tensorflow/core/platform:strcat.h",
"//tensorflow/core/platform:stream_executor_no_cuda.h",
"//tensorflow/core/platform:stringpiece.h",
"//tensorflow/core/platform:stringprintf.cc",
"//tensorflow/core/platform:stringprintf.h",
"//tensorflow/core/platform:strong_hash.h",
"//tensorflow/core/platform:subprocess.h",
"//tensorflow/core/platform:tensor_coding.cc",
"//tensorflow/core/platform:tensor_coding.h",
"//tensorflow/core/platform:test_benchmark.h",
"//tensorflow/core/platform:thread_annotations.h",
"//tensorflow/core/platform:threadpool.cc",
"//tensorflow/core/platform:threadpool.h",
"//tensorflow/core/platform:threadpool_interface.h",
"//tensorflow/core/platform:threadpool_options.h",
"//tensorflow/core/platform:tracing.cc",
"//tensorflow/core/platform:tracing.h",
"//tensorflow/core/platform:tstring.h",
"//tensorflow/core/platform:types.h",
"//tensorflow/core/platform:unbounded_work_queue.h",
],
visibility = ["//visibility:private"],
)
filegroup(
name = "legacy_srcs_no_runtime",
srcs = [
":legacy_srcs_common",
"//tensorflow/core/platform/default:casts.h",
"//tensorflow/core/platform/default:context.h",
"//tensorflow/core/platform/default:cord.h",
"//tensorflow/core/platform/default:dynamic_annotations.h",
"//tensorflow/core/platform/default:env.cc",
"//tensorflow/core/platform/default:human_readable_json.cc",
"//tensorflow/core/platform/default:integral_types.h",
"//tensorflow/core/platform/default:load_library.cc",
"//tensorflow/core/platform/default:logging.h",
"//tensorflow/core/platform/default:monitoring.cc",
"//tensorflow/core/platform/default:mutex.h",
"//tensorflow/core/platform/default:mutex_data.h",
"//tensorflow/core/platform/default:net.cc",
"//tensorflow/core/platform/default:notification.h",
"//tensorflow/core/platform/default:port.cc",
"//tensorflow/core/platform/default:posix_file_system.cc",
"//tensorflow/core/platform/default:posix_file_system.h",
"//tensorflow/core/platform/default:stacktrace.h",
"//tensorflow/core/platform/default:stacktrace_handler.cc",
"//tensorflow/core/platform/default:strong_hash.h",
"//tensorflow/core/platform/default:subprocess.cc",
"//tensorflow/core/platform/default:subprocess.h",
"//tensorflow/core/platform/default:tracing.cc",
"//tensorflow/core/platform/default:tracing_impl.h",
"//tensorflow/core/platform/default:unbounded_work_queue.cc",
"//tensorflow/core/platform/default:unbounded_work_queue.h",
],
"abi.cc",
"abi.h",
"blocking_counter.h",
"byte_order.h",
"coding.cc",
"coding.h",
"context.h",
"cord.h",
"cpu_info.cc",
"cpu_info.h",
"demangle.h",
"denormal.cc",
"denormal.h",
"dynamic_annotations.h",
"env.cc",
"env.h",
"env_time.h",
"error.cc",
"error.h",
"errors.h",
"file_statistics.h",
"file_system.cc",
"file_system.h",
"file_system_helper.cc",
"file_system_helper.h",
"hash.cc",
"hash.h",
"host_info.h",
"init_main.h",
"load_library.h",
"logging.h",
"macros.h",
"mem.h",
"mutex.h",
"numa.h",
"numbers.cc",
"numbers.h",
"path.cc",
"path.h",
"platform.h",
"prefetch.h",
"protobuf.cc",
"protobuf.h",
"protobuf_util.cc",
"raw_coding.h",
"refcount.h",
"scanner.cc",
"scanner.h",
"setround.cc",
"setround.h",
"snappy.h",
"stacktrace.h",
"status.cc",
"status.h",
"str_util.cc",
"str_util.h",
"strcat.cc",
"strcat.h",
"stringpiece.h",
"stringprintf.cc",
"stringprintf.h",
"tensor_coding.cc",
"tensor_coding.h",
"thread_annotations.h",
"threadpool.cc",
"threadpool.h",
"threadpool_interface.h",
"tracing.cc",
"tracing.h",
"tstring.h",
"types.h",
] + if_chromiumos(
tf_google_mobile_srcs_no_runtime(),
otherwise = [
"//tensorflow/core/platform/default:mobile_srcs_no_runtime",
],
) + tf_platform_alias("additional_mobile_srcs_no_runtime"),
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "legacy_srcs_no_runtime_google",
srcs = [":legacy_srcs_common"] + tf_legacy_srcs_no_runtime_google(),
name = "mobile_srcs_only_runtime",
srcs = [
"base64.cc",
"base64.h",
"casts.h",
"cpu_feature_guard.cc",
"cpu_feature_guard.h",
"fingerprint.h",
"monitoring.h",
"notification.h",
"platform_strings.cc",
"platform_strings.h",
"platform_strings_computed.h",
"profile_utils/android_armv7a_cpu_utils_helper.cc",
"profile_utils/android_armv7a_cpu_utils_helper.h",
"profile_utils/cpu_utils.cc",
"profile_utils/cpu_utils.h",
"profile_utils/i_cpu_utils_helper.h",
"protobuf_internal.h",
"random.cc",
"random.h",
"test_benchmark.h",
"threadpool_options.h",
"unbounded_work_queue.h",
"//tensorflow/core/platform/default:mobile_srcs_only_runtime",
] + tf_google_mobile_srcs_only_runtime(),
visibility = ["//tensorflow/core:__pkg__"],
)
@ -1448,16 +1405,6 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
# These are the sources needed to build the target tensorflow/core:mobile_srcs_no_runtime.
# We want to get rid of all such android targets, as described in
# https://github.com/tensorflow/community/pull/179.
# This temporary filegroup is allows us to remove the legacy "build_config" directories.
filegroup(
name = "legacy_mobile_srcs",
srcs = tf_platform_alias("legacy_mobile_srcs"),
visibility = ["//tensorflow/core:__pkg__"],
)
bzl_library(
name = "build_config_root_bzl",
srcs = [

View File

@ -17,14 +17,16 @@ load(
_tf_additional_test_deps = "tf_additional_test_deps",
_tf_additional_test_srcs = "tf_additional_test_srcs",
_tf_fingerprint_deps = "tf_fingerprint_deps",
_tf_google_mobile_srcs_no_runtime = "tf_google_mobile_srcs_no_runtime",
_tf_google_mobile_srcs_only_runtime = "tf_google_mobile_srcs_only_runtime",
_tf_jspb_proto_library = "tf_jspb_proto_library",
_tf_kernel_tests_linkstatic = "tf_kernel_tests_linkstatic",
_tf_legacy_srcs_no_runtime_google = "tf_legacy_srcs_no_runtime_google",
_tf_lib_proto_parsing_deps = "tf_lib_proto_parsing_deps",
_tf_logging_deps = "tf_logging_deps",
_tf_monitoring_deps = "tf_monitoring_deps",
_tf_platform_alias = "tf_platform_alias",
_tf_platform_deps = "tf_platform_deps",
_tf_portable_deps_no_runtime = "tf_portable_deps_no_runtime",
_tf_proto_library = "tf_proto_library",
_tf_proto_library_cc = "tf_proto_library_cc",
_tf_proto_library_py = "tf_proto_library_py",
@ -55,14 +57,16 @@ tf_additional_tensor_coding_deps = _tf_additional_tensor_coding_deps
tf_additional_test_deps = _tf_additional_test_deps
tf_additional_test_srcs = _tf_additional_test_srcs
tf_fingerprint_deps = _tf_fingerprint_deps
tf_google_mobile_srcs_no_runtime = _tf_google_mobile_srcs_no_runtime
tf_google_mobile_srcs_only_runtime = _tf_google_mobile_srcs_only_runtime
tf_jspb_proto_library = _tf_jspb_proto_library
tf_kernel_tests_linkstatic = _tf_kernel_tests_linkstatic
tf_legacy_srcs_no_runtime_google = _tf_legacy_srcs_no_runtime_google
tf_lib_proto_parsing_deps = _tf_lib_proto_parsing_deps
tf_logging_deps = _tf_logging_deps
tf_monitoring_deps = _tf_monitoring_deps
tf_platform_alias = _tf_platform_alias
tf_platform_deps = _tf_platform_deps
tf_portable_deps_no_runtime = _tf_portable_deps_no_runtime
tf_proto_library = _tf_proto_library
tf_proto_library_cc = _tf_proto_library_cc
tf_proto_library_py = _tf_proto_library_py

View File

@ -472,8 +472,41 @@ bzl_library(
visibility = ["//tensorflow:__subpackages__"],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "legacy_mobile_srcs",
name = "additional_mobile_srcs_no_runtime",
visibility = ["//tensorflow/core/platform:__pkg__"],
)
filegroup(
name = "mobile_srcs_no_runtime",
srcs = [
"context.h",
"dynamic_annotations.h",
"env.cc",
"integral_types.h",
"load_library.cc",
"port.cc",
"posix_file_system.cc",
"posix_file_system.h",
"stacktrace.h",
"tracing_impl.h",
],
visibility = ["//tensorflow/core/platform:__pkg__"],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"casts.h",
"cord.h",
"monitoring.cc",
"mutex.h",
"mutex_data.h",
"notification.h",
"unbounded_work_queue.cc",
"unbounded_work_queue.h",
],
visibility = ["//tensorflow/core/platform:__pkg__"],
)

View File

@ -753,5 +753,20 @@ def tf_logging_deps():
def tf_monitoring_deps():
return ["//tensorflow/core/platform/default:monitoring"]
def tf_legacy_srcs_no_runtime_google():
def tf_portable_deps_no_runtime():
return [
"@com_google_protobuf//:protobuf",
"//third_party/eigen3",
"@double_conversion//:double-conversion",
"@nsync//:nsync_cpp",
"//tensorflow/core/util:stats_calculator_portable",
"//tensorflow/core:mobile_additional_lib_deps",
"//tensorflow/core:protos_all_cc_impl",
"@farmhash_archive//:farmhash",
]
def tf_google_mobile_srcs_no_runtime():
return []
def tf_google_mobile_srcs_only_runtime():
return []

View File

@ -14,12 +14,20 @@ exports_files(
visibility = ["//visibility:public"],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_no_runtime",
srcs = [
"version.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"session.h",
"session_options.h",
"version.h",
],
visibility = ["//tensorflow/core:__pkg__"],
)

View File

@ -85,25 +85,77 @@ exports_files(
],
)
# The following filegroups are needed since globbing across packages boundaries
# will just fail silently (see 3rd caveat at
# https://docs.bazel.build/versions/master/be/functions.html#glob).
# Files needed for core:framework_internal_impl.
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_no_runtime",
srcs = glob(
[
"*.cc",
"*.h",
],
exclude = [
"*_test.*",
"debug_events_writer.*",
"stats_calculator.*",
"events_writer.*",
"reporter.*",
],
),
srcs = [
"overflow.h",
],
)
filegroup(
name = "mobile_srcs_only_runtime",
srcs = [
"batch_util.cc",
"batch_util.h",
"bcast.cc",
"bcast.h",
"command_line_flags.cc",
"command_line_flags.h",
"device_name_utils.cc",
"device_name_utils.h",
"dump_graph.cc",
"dump_graph.h",
"einsum_op_util.cc",
"einsum_op_util.h",
"env_var.cc",
"env_var.h",
"equal_graph_def.cc",
"equal_graph_def.h",
"example_proto_fast_parsing.cc",
"example_proto_fast_parsing.h",
"example_proto_helper.cc",
"example_proto_helper.h",
"guarded_philox_random.cc",
"guarded_philox_random.h",
"matmul_autotune.cc",
"matmul_autotune.h",
"matmul_bcast.cc",
"matmul_bcast.h",
"mirror_pad_mode.cc",
"mirror_pad_mode.h",
"padding.cc",
"padding.h",
"port.cc",
"port.h",
"presized_cuckoo_map.h",
"ptr_util.h",
"reffed_status_callback.h",
"saved_tensor_slice_util.cc",
"saved_tensor_slice_util.h",
"stat_summarizer.cc",
"stat_summarizer.h",
"strided_slice_op.cc",
"strided_slice_op.h",
"tensor_format.cc",
"tensor_format.h",
"tensor_ops_util.h",
"tensor_slice_reader.cc",
"tensor_slice_reader.h",
"tensor_slice_reader_cache.cc",
"tensor_slice_reader_cache.h",
"tensor_slice_set.cc",
"tensor_slice_set.h",
"tensor_slice_util.h",
"tensor_slice_writer.cc",
"tensor_slice_writer.h",
"use_cudnn.cc",
"use_cudnn.h",
"util.cc",
"util.h",
"work_sharder.cc",
"work_sharder.h",
],
)
filegroup(

View File

@ -8,8 +8,9 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
# Export source files needed for mobile builds, which do not use granular targets.
filegroup(
name = "mobile_srcs_no_runtime_group",
name = "mobile_srcs_only_runtime",
srcs = [
"dim_comparator.h",
"group_iterator.cc",

View File

@ -195,6 +195,8 @@ def if_ios_x86_64(a):
def if_mobile(a):
return select({
clean_dep("//tensorflow:android"): a,
clean_dep("//tensorflow:chromiumos"): a,
clean_dep("//tensorflow:emscripten"): a,
clean_dep("//tensorflow:ios"): a,
"//conditions:default": [],
})
@ -202,6 +204,8 @@ def if_mobile(a):
def if_not_mobile(a):
return select({
clean_dep("//tensorflow:android"): [],
clean_dep("//tensorflow:chromiumos"): [],
clean_dep("//tensorflow:emscripten"): [],
clean_dep("//tensorflow:ios"): [],
"//conditions:default": a,
})
@ -346,6 +350,18 @@ def tf_opts_nortti_if_emscripten():
"-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
])
def tf_defines_nortti_if_android():
return if_android([
"GOOGLE_PROTOBUF_NO_RTTI",
"GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
])
def tf_defines_nortti_if_emscripten():
return if_emscripten([
"GOOGLE_PROTOBUF_NO_RTTI",
"GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
])
def tf_features_nomodules_if_android():
return if_android(["-use_header_modules"])