Revert TF Micro support for embedded build using proxy macros.

PiperOrigin-RevId: 323656191
Change-Id: I5940e6ff40e3019372d2cf73265a02f47f8cc0c1
This commit is contained in:
A. Unique TensorFlower 2020-07-28 14:38:29 -07:00 committed by TensorFlower Gardener
parent dd13d3b4c6
commit a6f0697328
14 changed files with 32 additions and 118 deletions

View File

@ -1,6 +1,5 @@
load("//tensorflow:tensorflow.bzl", "if_not_windows", "tf_cc_test")
load("//tensorflow/lite:build_def.bzl", "if_tflite_experimental_runtime", "tflite_cc_shared_object", "tflite_copts", "tflite_experimental_runtime_linkopts")
load("//tensorflow/lite/micro:build_def.bzl", "cc_library")
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
package(
@ -83,7 +82,6 @@ FRAMEWORK_LIB_HDRS = [
cc_library(
name = "version",
hdrs = ["version.h"],
build_for_embedded = True,
copts = TFLITE_DEFAULT_COPTS,
# Note that we only use the header defines from :version_lib.
deps = ["//tensorflow/core:version_lib"],
@ -139,7 +137,6 @@ cc_library(
name = "external_cpu_backend_context",
srcs = ["external_cpu_backend_context.cc"],
hdrs = ["external_cpu_backend_context.h"],
build_for_embedded = True,
copts = TFLITE_DEFAULT_COPTS,
deps = [
"//tensorflow/lite/c:common",
@ -193,7 +190,6 @@ cc_library(
hdrs = [
"string_type.h",
],
build_for_embedded = True,
copts = TFLITE_DEFAULT_COPTS,
)
@ -309,7 +305,6 @@ cc_library(
name = "string_util",
srcs = ["string_util.cc"],
hdrs = ["string_util.h"],
build_for_embedded = True,
copts = TFLITE_DEFAULT_COPTS,
deps = [
":string",
@ -620,7 +615,6 @@ cc_library(
cc_library(
name = "type_to_tflitetype",
hdrs = ["type_to_tflitetype.h"],
build_for_embedded = True,
deps = ["//tensorflow/lite/c:common"],
)

View File

@ -3,10 +3,6 @@ load(
"tflite_cc_shared_object",
"tflite_copts",
)
load(
"//tensorflow/lite/micro:build_def.bzl",
"cc_library",
)
package(
default_visibility = ["//visibility:public"],
@ -126,7 +122,6 @@ cc_library(
"builtin_op_data.h",
"common.h",
],
build_for_embedded = True,
alwayslink = 1,
)

View File

@ -1,5 +1,5 @@
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
load("//tensorflow/lite/micro:build_def.bzl", "cc_library", "micro_copts")
load("//tensorflow/lite/micro:build_def.bzl", "micro_copts")
package(
default_visibility = ["//visibility:public"],
@ -21,7 +21,6 @@ cc_library(
"profiler.h",
"tensor_utils.h",
],
build_for_embedded = True,
copts = tflite_copts() + micro_copts(),
deps = [
"@flatbuffers//:runtime_cc",

View File

@ -1,5 +1,5 @@
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
load("//tensorflow/lite/micro:build_def.bzl", "cc_library", "micro_copts")
load("//tensorflow/lite/micro:build_def.bzl", "micro_copts")
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite_combined")
load("//tensorflow:tensorflow.bzl", "tf_opts_nortti_if_android")
@ -281,7 +281,6 @@ cc_test(
cc_library(
name = "tflite_with_ruy_enabled",
build_for_embedded = True,
defines = ["TFLITE_WITH_RUY"],
visibility = ["//visibility:private"],
)
@ -297,8 +296,8 @@ cc_library(
cc_library(
name = "tflite_with_ruy_default",
build_for_embedded = True,
select_deps = {
visibility = ["//visibility:private"],
deps = select({
":chromiumos_arm64": [":tflite_with_ruy_enabled"],
":cpu_aarch64": [":tflite_with_ruy_enabled"],
":cpu_arm64": [":tflite_with_ruy_enabled"],
@ -308,18 +307,16 @@ cc_library(
":cpu_arm64_v8a": [":tflite_with_ruy_enabled"],
"//tensorflow:android_arm": ["tflite_with_ruy_enabled"],
"//conditions:default": [],
},
visibility = ["//visibility:private"],
}),
)
cc_library(
name = "tflite_with_ruy",
build_for_embedded = True,
select_deps = {
deps = select({
":tflite_with_ruy_explicit_true": [":tflite_with_ruy_enabled"],
":tflite_with_ruy_explicit_false": [],
"//conditions:default": [":tflite_with_ruy_default"],
},
}),
)
cc_library(
@ -432,7 +429,6 @@ cc_library(
hdrs = [
"op_macros.h",
],
build_for_embedded = True,
copts = tflite_copts(),
deps = ["//tensorflow/lite/micro:debug_log"],
)
@ -445,7 +441,6 @@ cc_library(
hdrs = [
"kernel_util.h",
],
build_for_embedded = True,
copts = tflite_copts() + micro_copts(),
deps = [
"//tensorflow/lite/c:common",
@ -501,7 +496,6 @@ cc_library(
name = "padding",
srcs = [],
hdrs = ["padding.h"],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
"//tensorflow/lite/c:common",

View File

@ -1,5 +1,3 @@
load("//tensorflow/lite/micro:build_def.bzl", "cc_library")
package(
default_visibility = [
"//visibility:public",

View File

@ -1,6 +1,6 @@
load("//tensorflow:tensorflow.bzl", "transitive_hdrs")
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
load("//tensorflow/lite/micro:build_def.bzl", "cc_library", "micro_copts")
load("//tensorflow/lite/micro:build_def.bzl", "micro_copts")
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite_combined")
package(
@ -46,7 +46,6 @@ NEON_FLAGS_IF_APPLICABLE = select({
cc_library(
name = "compatibility",
hdrs = ["compatibility.h"],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
"//tensorflow/lite/kernels:op_macros",
@ -56,7 +55,6 @@ cc_library(
cc_library(
name = "types",
hdrs = ["types.h"],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
":compatibility",
@ -66,7 +64,6 @@ cc_library(
cc_library(
name = "legacy_types",
hdrs = ["legacy_types.h"],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
":types",
@ -221,7 +218,6 @@ cc_library(
name = "common",
srcs = [],
hdrs = ["common.h"],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
":cppmath",
@ -375,7 +371,6 @@ cc_library(
"max.h",
"min.h",
],
build_for_embedded = True,
copts = tflite_copts(),
)
@ -383,7 +378,6 @@ cc_library(
name = "quantization_util",
srcs = ["quantization_util.cc"],
hdrs = ["quantization_util.h"],
build_for_embedded = True,
copts = tflite_copts() + micro_copts(),
deps = [
":compatibility",
@ -411,7 +405,6 @@ cc_library(
hdrs = [
"transpose_utils.h",
],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
":types",
@ -433,7 +426,6 @@ cc_library(
hdrs = [
"strided_slice_logic.h",
],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
":compatibility",
@ -500,20 +492,7 @@ cc_library(
"reference/sparse_ops/fully_connected.h",
],
}),
build_for_embedded = True,
copts = tflite_copts(),
select_deps = {
":haswell": tflite_deps_intel,
":ios_x86_64": tflite_deps_intel,
":k8": tflite_deps_intel,
":x86": tflite_deps_intel,
":x86_64": tflite_deps_intel,
":darwin": tflite_deps_intel,
":darwin_x86_64": tflite_deps_intel,
":freebsd": tflite_deps_intel,
":windows": tflite_deps_intel,
"//conditions:default": [],
},
deps = [
":common",
":compatibility",
@ -524,14 +503,25 @@ cc_library(
":tensor",
":tensor_utils",
":types",
"//third_party/eigen3",
"@gemmlowp//:fixedpoint",
"@ruy//ruy/profiler:instrumentation",
"//tensorflow/lite:string_util",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels:op_macros",
"//tensorflow/lite/tools/optimize/sparsity:format_converter",
"//third_party/eigen3",
"@gemmlowp//:fixedpoint",
"@ruy//ruy/profiler:instrumentation",
],
] + select({
":haswell": tflite_deps_intel,
":ios_x86_64": tflite_deps_intel,
":k8": tflite_deps_intel,
":x86": tflite_deps_intel,
":x86_64": tflite_deps_intel,
":darwin": tflite_deps_intel,
":darwin_x86_64": tflite_deps_intel,
":freebsd": tflite_deps_intel,
":windows": tflite_deps_intel,
"//conditions:default": [],
}),
)
cc_library(
@ -610,7 +600,6 @@ cc_library(
"tensor.h",
"tensor_ctypes.h",
],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
":types",
@ -704,7 +693,6 @@ cc_library(
name = "kernel_utils",
srcs = ["kernel_utils.cc"],
hdrs = ["kernel_utils.h"],
build_for_embedded = True,
copts = tflite_copts() + micro_copts(),
deps = [
":tensor_utils",
@ -742,9 +730,12 @@ cc_library(
hdrs = [
"tensor_utils.h",
],
build_for_embedded = True,
copts = tflite_copts() + NEON_FLAGS_IF_APPLICABLE,
select_deps = {
deps = [
":cpu_check",
"//third_party/eigen3",
"//tensorflow/lite/c:common",
] + select({
":aarch64": [
":neon_tensor_utils",
],
@ -808,12 +799,7 @@ cc_library(
"//conditions:default": [
":portable_tensor_utils",
],
},
deps = [
":cpu_check",
"//tensorflow/lite/c:common",
"//third_party/eigen3",
],
}),
)
cc_library(
@ -1071,9 +1057,8 @@ cc_library(
"optimized/neon_check.h",
"optimized/sse_check.h",
],
build_for_embedded = True,
copts = tflite_copts(),
select_deps = {
deps = select({
":haswell": tflite_deps_intel,
":ios_x86_64": tflite_deps_intel,
":k8": tflite_deps_intel,
@ -1084,7 +1069,7 @@ cc_library(
":freebsd": tflite_deps_intel,
":windows": tflite_deps_intel,
"//conditions:default": [],
},
}),
)
cc_test(

View File

@ -4,7 +4,6 @@ load(
)
load(
"//tensorflow/lite/micro:build_def.bzl",
"cc_library",
"micro_copts",
)
@ -23,7 +22,6 @@ cc_library(
hdrs = [
"compatibility.h",
],
build_for_embedded = True,
copts = micro_copts(),
)
@ -41,7 +39,6 @@ cc_library(
"micro_optional_debug_tools.h",
"simple_memory_allocator.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
":memory_helpers",
@ -81,7 +78,6 @@ cc_library(
hdrs = [
"test_helpers.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
":micro_utils",
@ -106,7 +102,6 @@ cc_library(
"micro_mutable_op_resolver.h",
"micro_op_resolver.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
":micro_compatibility",
@ -127,7 +122,6 @@ cc_library(
hdrs = [
"debug_log.h",
],
build_for_embedded = True,
copts = micro_copts(),
)
@ -139,7 +133,6 @@ cc_library(
hdrs = [
"micro_error_reporter.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
":debug_log",
@ -157,7 +150,6 @@ cc_library(
hdrs = [
"micro_string.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = ["//tensorflow/lite/c:common"],
)
@ -170,7 +162,6 @@ cc_library(
hdrs = [
"micro_time.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = ["//tensorflow/lite/c:common"],
)
@ -183,7 +174,6 @@ cc_library(
hdrs = [
"micro_profiler.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
":micro_compatibility",
@ -201,7 +191,6 @@ cc_library(
hdrs = [
"micro_utils.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
"//tensorflow/lite/c:common",
@ -220,7 +209,6 @@ cc_library(
"recording_micro_interpreter.h",
"recording_simple_memory_allocator.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
":micro_compatibility",

View File

@ -1,25 +1,2 @@
load(
"@rules_cc//cc:defs.bzl",
_cc_library = "cc_library",
)
load(
"@flatbuffers//:build_defs.bzl",
_flatbuffer_cc_library = "flatbuffer_cc_library",
)
def micro_copts():
return []
def cc_library(**kwargs):
kwargs.pop("build_for_embedded", False)
if "select_deps" in kwargs.keys():
select_deps = kwargs.pop("select_deps", {})
if "deps" in kwargs.keys():
kwargs["deps"] += select(select_deps)
else:
kwargs["deps"] = select(select_deps)
_cc_library(**kwargs)
def flatbuffer_cc_library(**kwargs):
kwargs.pop("build_for_embedded", False)
_flatbuffer_cc_library(**kwargs)

View File

@ -7,7 +7,6 @@ load(
)
load(
"//tensorflow/lite/micro:build_def.bzl",
"cc_library",
"micro_copts",
)
@ -23,7 +22,6 @@ cc_library(
hdrs = [
"model.h",
],
build_for_embedded = True,
copts = micro_copts(),
)

View File

@ -4,7 +4,6 @@ load(
)
load(
"//tensorflow/lite/micro:build_def.bzl",
"cc_library",
"micro_copts",
)
@ -93,8 +92,6 @@ cc_library(
],
}),
hdrs = ["micro_ops.h"],
# TODO(b/153609488): enable embedded build once we can properly support it.
#build_for_embedded = True,
copts = micro_copts(),
visibility = [
# Needed for micro:op_resolvers but visibility can not be finer-grained
@ -460,7 +457,6 @@ tflite_micro_cc_test(
cc_library(
name = "activation_utils",
hdrs = ["activation_utils.h"],
build_for_embedded = True,
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:cppmath",
@ -503,7 +499,6 @@ cc_library(
"kernel_runner.cc",
],
hdrs = ["kernel_runner.h"],
build_for_embedded = True,
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:compatibility",
@ -517,7 +512,6 @@ cc_library(
"kernel_util.cc",
],
hdrs = ["kernel_util.h"],
build_for_embedded = True,
deps = [
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:types",
@ -527,7 +521,6 @@ cc_library(
cc_library(
name = "micro_utils",
hdrs = ["micro_utils.h"],
build_for_embedded = True,
)
tflite_micro_cc_test(

View File

@ -4,7 +4,6 @@ load(
)
load(
"//tensorflow/lite/micro:build_def.bzl",
"cc_library",
"micro_copts",
)
@ -18,7 +17,6 @@ cc_library(
hdrs = [
"memory_planner.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
"//tensorflow/lite/c:common",
@ -50,7 +48,6 @@ cc_library(
hdrs = [
"greedy_memory_planner.h",
],
build_for_embedded = True,
copts = micro_copts(),
deps = [
":memory_planner",

View File

@ -1,6 +1,6 @@
load("//tensorflow:tensorflow.bzl", "py_test")
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
load("//tensorflow/lite/micro:build_def.bzl", "flatbuffer_cc_library")
load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
package(
default_visibility = [
@ -64,7 +64,6 @@ exports_files([
flatbuffer_cc_library(
name = "schema_fbs",
srcs = ["schema.fbs"],
build_for_embedded = True,
)
# Generic schema for flatbuffer converter (but with mutable makes bigger).

View File

@ -1,5 +1,4 @@
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
load("//tensorflow/lite/micro:build_def.bzl", "cc_library")
package(
default_visibility = [
@ -12,7 +11,6 @@ cc_library(
name = "format_converter",
srcs = ["format_converter.cc"],
hdrs = ["format_converter.h"],
build_for_embedded = True,
copts = tflite_copts(),
deps = [
"//tensorflow/lite/c:common",

View File

@ -2,7 +2,6 @@
load("//tensorflow:tensorflow.bzl", "pybind_extension")
load("//tensorflow:tensorflow.bzl", "if_not_windows")
load("//tensorflow/lite:build_def.bzl", "tflite_copts")
load("//tensorflow/lite/micro:build_def.bzl", "cc_library")
load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
package(