Skip to content

Commit

Permalink
Remove hifimini support from the bazel build. (#198)
Browse files Browse the repository at this point in the history
* Remove hifimini support from the bazel build.

 * Consolidate all kernel BUILD targets into micro_ops
 * remove select statements for xtensa_hifimini

BUG=http://b/191406930

* fix bazel build.
  • Loading branch information
advaitjain committed Jun 17, 2021
1 parent 3ebcc8a commit aaa88b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 204 deletions.
4 changes: 0 additions & 4 deletions tensorflow/lite/micro/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ cc_library(
"//tensorflow/lite/core/api",
"//tensorflow/lite/kernels:op_macros",
"//tensorflow/lite/kernels/internal:compatibility",
"//tensorflow/lite/micro/kernels:conv",
"//tensorflow/lite/micro/kernels:depthwise_conv",
"//tensorflow/lite/micro/kernels:ethosu",
"//tensorflow/lite/micro/kernels:fully_connected",
"//tensorflow/lite/micro/kernels:micro_ops",
"//tensorflow/lite/schema:schema_fbs",
],
Expand Down
1 change: 0 additions & 1 deletion tensorflow/lite/micro/benchmarks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ cc_binary(
"//tensorflow/lite/micro:micro_framework",
"//tensorflow/lite/micro:op_resolvers",
"//tensorflow/lite/micro:system_setup",
"//tensorflow/lite/micro/kernels:fully_connected",
],
)

Expand Down
223 changes: 24 additions & 199 deletions tensorflow/lite/micro/kernels/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ package(
licenses = ["notice"],
)

config_setting(
name = "xtensa_hifimini",
define_values = {"tflm_build": "xtensa_hifimini"},
)

package_group(
name = "tflite_micro",
packages = ["//..."],
Expand Down Expand Up @@ -49,43 +44,6 @@ cc_library(
],
)

cc_library(
name = "conv",
srcs = [
"conv_common.cc",
] + select({
"//conditions:default": [
"conv.cc",
],
":xtensa_hifimini": [
"xtensa/conv.cc",
],
}),
hdrs = ["conv.h"],
copts = micro_copts(),
visibility = [
# Kernel variants need to be visible to the examples and benchmarks.
":tflite_micro",
],
deps = [
":fixedpoint_utils",
":kernel_util",
":xtensa",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:common",
"//tensorflow/lite/kernels/internal:quantization_util",
"//tensorflow/lite/kernels/internal:reference_base",
"//tensorflow/lite/kernels/internal:tensor",
"//tensorflow/lite/kernels:kernel_util",
"//tensorflow/lite/kernels:padding",
] + select({
"//conditions:default": [],
":xtensa_hifimini": [
#"//third_party/xtensa/cstub64s:hifi_mini",
],
}),
)

cc_library(
name = "conv_test_common",
srcs = [
Expand All @@ -103,81 +61,6 @@ cc_library(
],
)

cc_library(
name = "depthwise_conv",
srcs = [
"depthwise_conv_common.cc",
] + select({
"//conditions:default": [
"depthwise_conv.cc",
],
":xtensa_hifimini": [
"xtensa/depthwise_conv.cc",
],
}),
hdrs = ["depthwise_conv.h"],
copts = micro_copts(),
visibility = [
# Kernel variants need to be visible to the examples and benchmarks.
":tflite_micro",
],
deps = [
":conv",
":fixedpoint_utils",
":kernel_util",
":xtensa",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:common",
"//tensorflow/lite/kernels/internal:quantization_util",
"//tensorflow/lite/kernels/internal:reference_base",
"//tensorflow/lite/kernels/internal:tensor",
"//tensorflow/lite/kernels:kernel_util",
"//tensorflow/lite/kernels:padding",
] + select({
"//conditions:default": [],
":xtensa_hifimini": [
#"//third_party/xtensa/cstub64s:hifi_mini",
],
}),
)

cc_library(
name = "ethosu",
srcs = [
"ethosu.cc",
],
hdrs = ["ethosu.h"],
copts = micro_copts(),
visibility = [
# Kernel variants need to be visible to the examples and benchmarks.
":tflite_micro",
],
deps = [
"//tensorflow/lite/c:common",
],
)

cc_library(
name = "fixedpoint_utils",
hdrs = select({
"//conditions:default": [
],
":xtensa_hifimini": [
"xtensa/fixedpoint_utils.h",
],
}),
copts = micro_copts(),
deps = [
":xtensa",
] + select({
"//conditions:default": [],
":xtensa_hifimini": [
#"//third_party/xtensa/cstub64s:hifi_mini",
"//tensorflow/lite/kernels/internal:compatibility",
],
}),
)

cc_library(
name = "detection_postprocess_flexbuffers_generated_data",
srcs = [
Expand All @@ -188,42 +71,6 @@ cc_library(
],
)

cc_library(
name = "fully_connected",
srcs = [
"fully_connected_common.cc",
] + select({
"//conditions:default": [
"fully_connected.cc",
],
":xtensa_hifimini": [
"xtensa/fully_connected.cc",
],
}),
hdrs = ["fully_connected.h"],
copts = micro_copts(),
visibility = [
# Kernel variants need to be visible to the examples and benchmarks.
":tflite_micro",
],
deps = [
":fixedpoint_utils",
":kernel_util",
":xtensa",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels:kernel_util",
"//tensorflow/lite/kernels/internal:common",
"//tensorflow/lite/kernels/internal:quantization_util",
"//tensorflow/lite/kernels/internal:reference_base",
"//tensorflow/lite/kernels/internal:tensor",
] + select({
"//conditions:default": [],
":xtensa_hifimini": [
#"//third_party/xtensa/cstub64s:hifi_mini",
],
}),
)

cc_library(
name = "kernel_runner",
srcs = [
Expand Down Expand Up @@ -254,19 +101,18 @@ cc_library(
":tflite_micro",
],
deps = [
"@flatbuffers//:runtime_cc",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:compatibility",
"//tensorflow/lite/kernels/internal:types",
"//tensorflow/lite/micro:debug_log",
"@flatbuffers//:runtime_cc",
],
)

cc_library(
name = "micro_ops",
srcs = [
"activations.cc",
"hard_swish.cc",
"add.cc",
"add_n.cc",
"arg_min_max.cc",
Expand All @@ -276,67 +122,71 @@ cc_library(
"circular_buffer.cc",
"comparisons.cc",
"concatenation.cc",
"conv.cc",
"conv_common.cc",
"cumsum.cc",
"depth_to_space.cc",
"depthwise_conv.cc",
"depthwise_conv_common.cc",
"dequantize.cc",
"detection_postprocess.cc",
"elementwise.cc",
"elu.cc",
"ethosu.cc",
"exp.cc",
"expand_dims.cc",
"fill.cc",
"floor.cc",
"floor_div.cc",
"floor_mod.cc",
"fully_connected.cc",
"fully_connected_common.cc",
"gather.cc",
"gather_nd.cc",
"hard_swish.cc",
"if.cc",
"l2norm.cc",
"l2_pool_2d.cc",
"l2norm.cc",
"leaky_relu.cc",
"log_softmax.cc",
"logical.cc",
"logistic.cc",
"log_softmax.cc",
"maximum_minimum.cc",
"mul.cc",
"neg.cc",
"pack.cc",
"pad.cc",
"pooling.cc",
"prelu.cc",
"quantize.cc",
"quantize_common.cc",
"reduce.cc",
"reshape.cc",
"resize_bilinear.cc",
"resize_nearest_neighbor.cc",
"round.cc",
"shape.cc",
"softmax.cc",
"softmax_common.cc",
"space_to_batch_nd.cc",
"split.cc",
"split_v.cc",
"squeeze.cc",
"strided_slice.cc",
"sub.cc",
"svdf.cc",
"svdf_common.cc",
"tanh.cc",
"transpose_conv.cc",
"transpose.cc",
"transpose_conv.cc",
"unpack.cc",
"zeros_like.cc",
] + select({
"//conditions:default": [
"quantize.cc",
"softmax.cc",
"svdf.cc",
],
":xtensa_hifimini": [
"xtensa/quantize.cc",
"xtensa/softmax.cc",
"xtensa/svdf.cc",
],
}),
],
hdrs = [
"conv.h",
"depthwise_conv.h",
"ethosu.h",
"fully_connected.h",
"micro_ops.h",
"quantize.h",
"softmax.h",
Expand All @@ -349,57 +199,32 @@ cc_library(
],
deps = [
":activation_utils",
":fixedpoint_utils",
":kernel_util",
":micro_utils",
":xtensa",
"@flatbuffers//:runtime_cc",
"//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:cppmath",
"//tensorflow/lite/kernels:kernel_util",
"//tensorflow/lite/kernels:op_macros",
"//tensorflow/lite/kernels:padding",
"//tensorflow/lite/kernels/internal:common",
"//tensorflow/lite/kernels/internal:compatibility",
"//tensorflow/lite/kernels/internal:cppmath",
"//tensorflow/lite/kernels/internal:quantization_util",
"//tensorflow/lite/kernels/internal:reference_base",
"//tensorflow/lite/kernels/internal:tensor",
"//tensorflow/lite/kernels/internal:types",
"//tensorflow/lite/micro:micro_graph",
"//tensorflow/lite/micro:memory_helpers",
"//tensorflow/lite/micro:micro_graph",
"//tensorflow/lite/micro:micro_utils",
"//tensorflow/lite/schema:schema_fbs",
] + select({
"//conditions:default": [],
":xtensa_hifimini": [
#"//third_party/xtensa/cstub64s:hifi_mini",
],
}),
"@flatbuffers//:runtime_cc",
],
)

cc_library(
name = "micro_utils",
hdrs = ["micro_utils.h"],
)

cc_library(
name = "xtensa",
hdrs = select({
"//conditions:default": [
],
":xtensa_hifimini": [
"xtensa/xtensa.h",
],
}),
copts = micro_copts(),
deps = select({
"//conditions:default": [],
":xtensa_hifimini": [
#"//third_party/xtensa/cstub64s:hifi_mini",
],
}),
)

####################################
# C++ tests
####################################
Expand Down

0 comments on commit aaa88b7

Please sign in to comment.