From aaa88b7db6cf359d7ceea219a180c6f83775a368 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Thu, 17 Jun 2021 16:38:29 -0700 Subject: [PATCH] Remove hifimini support from the bazel build. (#198) * 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. --- tensorflow/lite/micro/BUILD | 4 - tensorflow/lite/micro/benchmarks/BUILD | 1 - tensorflow/lite/micro/kernels/BUILD | 223 +++---------------------- 3 files changed, 24 insertions(+), 204 deletions(-) diff --git a/tensorflow/lite/micro/BUILD b/tensorflow/lite/micro/BUILD index 3db5a0bd13..0a9073e8b8 100644 --- a/tensorflow/lite/micro/BUILD +++ b/tensorflow/lite/micro/BUILD @@ -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", ], diff --git a/tensorflow/lite/micro/benchmarks/BUILD b/tensorflow/lite/micro/benchmarks/BUILD index e2eafc0684..e47e394593 100644 --- a/tensorflow/lite/micro/benchmarks/BUILD +++ b/tensorflow/lite/micro/benchmarks/BUILD @@ -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", ], ) diff --git a/tensorflow/lite/micro/kernels/BUILD b/tensorflow/lite/micro/kernels/BUILD index 3f61369f0a..e81f5202db 100644 --- a/tensorflow/lite/micro/kernels/BUILD +++ b/tensorflow/lite/micro/kernels/BUILD @@ -6,11 +6,6 @@ package( licenses = ["notice"], ) -config_setting( - name = "xtensa_hifimini", - define_values = {"tflm_build": "xtensa_hifimini"}, -) - package_group( name = "tflite_micro", packages = ["//..."], @@ -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 = [ @@ -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 = [ @@ -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 = [ @@ -254,11 +101,11 @@ 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", ], ) @@ -266,7 +113,6 @@ cc_library( name = "micro_ops", srcs = [ "activations.cc", - "hard_swish.cc", "add.cc", "add_n.cc", "arg_min_max.cc", @@ -276,27 +122,35 @@ 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", @@ -304,6 +158,7 @@ cc_library( "pad.cc", "pooling.cc", "prelu.cc", + "quantize.cc", "quantize_common.cc", "reduce.cc", "reshape.cc", @@ -311,6 +166,7 @@ cc_library( "resize_nearest_neighbor.cc", "round.cc", "shape.cc", + "softmax.cc", "softmax_common.cc", "space_to_batch_nd.cc", "split.cc", @@ -318,25 +174,19 @@ cc_library( "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", @@ -349,32 +199,25 @@ 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( @@ -382,24 +225,6 @@ cc_library( 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 ####################################