From a52f97f86f32ba5c323c2f67f7f075ea50631ba2 Mon Sep 17 00:00:00 2001 From: Ryan Kuester Date: Tue, 15 Oct 2024 17:28:09 -0500 Subject: [PATCH] build(bazel): replace cc_* with tflm_cc_* in remaining TFLM code Replace cc_* targets remaining in TFLM code with tflm_cc_* targets. These are targets which did not formerly use the common copts. Avoid changing imported TFLite code, if for no other reason than to avoid merge conflicts during the automatic sync with upstream TFLite. --- tensorflow/lite/micro/BUILD | 36 ++-- tensorflow/lite/micro/arena_allocator/BUILD | 9 +- tensorflow/lite/micro/benchmarks/BUILD | 18 +- tensorflow/lite/micro/compression/BUILD | 8 +- .../lite/micro/examples/hello_world/BUILD | 3 +- .../lite/micro/examples/micro_speech/BUILD | 18 +- .../micro/examples/person_detection/BUILD | 25 +-- tensorflow/lite/micro/kernels/BUILD | 155 +++++++++--------- tensorflow/lite/micro/kernels/testdata/BUILD | 7 +- tensorflow/lite/micro/testing/BUILD | 10 +- .../lite/micro/tools/benchmarking/BUILD | 13 +- .../templates/BUILD.mako | 3 +- .../tools/project_generation/BUILD.testing | 9 +- 13 files changed, 177 insertions(+), 137 deletions(-) diff --git a/tensorflow/lite/micro/BUILD b/tensorflow/lite/micro/BUILD index 9b6011493f7..f6922c24aa2 100644 --- a/tensorflow/lite/micro/BUILD +++ b/tensorflow/lite/micro/BUILD @@ -421,7 +421,7 @@ tflm_cc_library( ], ) -cc_test( +tflm_cc_test( name = "micro_log_test", srcs = [ "micro_log_test.cc", @@ -433,7 +433,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_mutable_op_resolver_test", srcs = [ "micro_mutable_op_resolver_test.cc", @@ -445,7 +445,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_interpreter_context_test", srcs = [ "micro_interpreter_context_test.cc", @@ -459,7 +459,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "fake_micro_context_test", srcs = [ "fake_micro_context_test.cc", @@ -473,7 +473,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_interpreter_test", srcs = [ "micro_interpreter_test.cc", @@ -490,7 +490,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_allocator_test", srcs = [ "micro_allocator_test.cc", @@ -508,7 +508,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_allocation_info_test", srcs = [ "micro_allocation_info_test.cc", @@ -520,7 +520,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "recording_micro_allocator_test", srcs = [ "recording_micro_allocator_test.cc", @@ -535,7 +535,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "flatbuffer_utils_test", srcs = [ "flatbuffer_utils_test.cc", @@ -550,7 +550,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "hexdump_test", size = "small", srcs = [ @@ -562,7 +562,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "memory_helpers_test", srcs = [ "memory_helpers_test.cc", @@ -574,7 +574,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "span_test", size = "small", srcs = [ @@ -586,7 +586,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "testing_helpers_test", srcs = [ "testing_helpers_test.cc", @@ -598,7 +598,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_utils_test", srcs = [ "micro_utils_test.cc", @@ -609,7 +609,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_time_test", srcs = [ "micro_time_test.cc", @@ -620,7 +620,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "micro_resource_variable_test", srcs = ["micro_resource_variable_test.cc"], deps = [ @@ -629,7 +629,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "memory_arena_threshold_test", srcs = [ "memory_arena_threshold_test.cc", @@ -643,7 +643,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "static_vector_test", size = "small", srcs = [ diff --git a/tensorflow/lite/micro/arena_allocator/BUILD b/tensorflow/lite/micro/arena_allocator/BUILD index d8422bb58c7..1f1b2951093 100644 --- a/tensorflow/lite/micro/arena_allocator/BUILD +++ b/tensorflow/lite/micro/arena_allocator/BUILD @@ -1,5 +1,6 @@ load("//tensorflow/lite/micro:build_def.bzl", "tflm_cc_library", + "tflm_cc_test", ) package( @@ -33,7 +34,7 @@ tflm_cc_library( ], ) -cc_test( +tflm_cc_test( name = "non_persistent_arena_buffer_allocator_test", srcs = ["non_persistent_arena_buffer_allocator_test.cc"], deps = [ @@ -57,7 +58,7 @@ tflm_cc_library( ], ) -cc_test( +tflm_cc_test( name = "persistent_arena_buffer_allocator_test", srcs = ["persistent_arena_buffer_allocator_test.cc"], deps = [ @@ -85,7 +86,7 @@ tflm_cc_library( ], ) -cc_test( +tflm_cc_test( name = "simple_memory_allocator_test", srcs = [ "single_arena_buffer_allocator_test.cc", @@ -113,7 +114,7 @@ tflm_cc_library( ], ) -cc_test( +tflm_cc_test( name = "recording_simple_memory_allocator_test", srcs = [ "recording_single_arena_buffer_allocator_test.cc", diff --git a/tensorflow/lite/micro/benchmarks/BUILD b/tensorflow/lite/micro/benchmarks/BUILD index d0f67b6d60e..bc7e539dd0f 100644 --- a/tensorflow/lite/micro/benchmarks/BUILD +++ b/tensorflow/lite/micro/benchmarks/BUILD @@ -1,5 +1,11 @@ # Description: # TensorFlow Lite microcontroller benchmarks. + +load("//tensorflow/lite/micro:build_def.bzl", + "tflm_cc_binary", + "tflm_cc_library", +) + package( # Disabling layering_check because of http://b/177257332 features = ["-layering_check"], @@ -11,7 +17,7 @@ package_group( packages = ["//tensorflow/lite/micro"], ) -cc_library( +tflm_cc_library( name = "micro_benchmark", hdrs = [ "micro_benchmark.h", @@ -29,7 +35,7 @@ cc_library( ], ) -cc_library( +tflm_cc_library( name = "keyword_scrambled_model_data", srcs = [ "//tensorflow/lite/micro/models:generated_keyword_scrambled_model_cc", @@ -42,7 +48,7 @@ cc_library( ], ) -cc_binary( +tflm_cc_binary( name = "keyword_benchmark", srcs = ["keyword_benchmark.cc"], deps = [ @@ -57,7 +63,7 @@ cc_binary( ], ) -cc_library( +tflm_cc_library( name = "keyword_scrambled_8bit_model_data", srcs = [ "//tensorflow/lite/micro/models:generated_keyword_scrambled_8bit_model_cc", @@ -68,7 +74,7 @@ cc_library( visibility = ["//visibility:private"], ) -cc_binary( +tflm_cc_binary( name = "keyword_benchmark_8bit", srcs = ["keyword_benchmark_8bit.cc"], deps = [ @@ -82,7 +88,7 @@ cc_binary( ], ) -cc_binary( +tflm_cc_binary( name = "person_detection_benchmark", srcs = ["person_detection_benchmark.cc"], deps = [ diff --git a/tensorflow/lite/micro/compression/BUILD b/tensorflow/lite/micro/compression/BUILD index 937599cc7cf..6278310e215 100644 --- a/tensorflow/lite/micro/compression/BUILD +++ b/tensorflow/lite/micro/compression/BUILD @@ -1,3 +1,7 @@ +load("//tensorflow/lite/micro:build_def.bzl", + "tflm_cc_library", + "tflm_cc_test", +) load( "@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", @@ -19,7 +23,7 @@ flatbuffer_cc_library( srcs = ["metadata.fbs"], ) -cc_library( +tflm_cc_library( # The header-only library generated by flatc in ":metadata_cc" is saved to # the source tree and comitted to git as "metadata_saved.h", which is used # by code which builds via the Make build system, which has no means of @@ -50,7 +54,7 @@ flatbuffer_py_library( srcs = ["metadata.fbs"], ) -cc_test( +tflm_cc_test( name = "metadata_test_cc", size = "small", srcs = ["metadata_test.cc"], diff --git a/tensorflow/lite/micro/examples/hello_world/BUILD b/tensorflow/lite/micro/examples/hello_world/BUILD index 231e7594ec3..52eb91e0e27 100644 --- a/tensorflow/lite/micro/examples/hello_world/BUILD +++ b/tensorflow/lite/micro/examples/hello_world/BUILD @@ -5,6 +5,7 @@ load("@tflm_pip_deps//:requirements.bzl", "requirement") load( "//tensorflow/lite/micro:build_def.bzl", "tflm_cc_library", + "tflm_cc_test", ) package( @@ -25,7 +26,7 @@ tflm_cc_library( ], ) -cc_test( +tflm_cc_test( name = "hello_world_test", srcs = [ "hello_world_test.cc", diff --git a/tensorflow/lite/micro/examples/micro_speech/BUILD b/tensorflow/lite/micro/examples/micro_speech/BUILD index 10d1c1052ec..d7270f7f3a7 100644 --- a/tensorflow/lite/micro/examples/micro_speech/BUILD +++ b/tensorflow/lite/micro/examples/micro_speech/BUILD @@ -2,7 +2,11 @@ # TensorFlow Lite microcontroller example. load("@rules_python//python:defs.bzl", "py_binary", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") -load("//tensorflow/lite/micro:build_def.bzl", "generate_cc_arrays") +load("//tensorflow/lite/micro:build_def.bzl", + "generate_cc_arrays", + "tflm_cc_library", + "tflm_cc_test", +) package( default_visibility = ["//visibility:public"], @@ -107,7 +111,7 @@ generate_cc_arrays( out = "models/audio_preprocessor_int8_model_data.h", ) -cc_library( +tflm_cc_library( name = "micro_speech_model_data", srcs = [ ":generated_micro_speech_model_cc", @@ -117,7 +121,7 @@ cc_library( ], ) -cc_library( +tflm_cc_library( name = "audio_preprocessor_model_data", srcs = [ ":generated_audio_preprocessor_model_cc", @@ -127,7 +131,7 @@ cc_library( ], ) -cc_library( +tflm_cc_library( name = "audio_sample_test_data_30ms", srcs = [ ":generated_no_30ms_wav_cc", @@ -139,7 +143,7 @@ cc_library( ], ) -cc_library( +tflm_cc_library( name = "audio_sample_test_data_1000ms", srcs = [ ":generated_no_1000ms_wav_cc", @@ -155,14 +159,14 @@ cc_library( ], ) -cc_library( +tflm_cc_library( name = "micro_model_settings", hdrs = [ "micro_model_settings.h", ], ) -cc_test( +tflm_cc_test( name = "micro_speech_test", srcs = [ "micro_speech_test.cc", diff --git a/tensorflow/lite/micro/examples/person_detection/BUILD b/tensorflow/lite/micro/examples/person_detection/BUILD index 449c4be11da..cfbbd3380aa 100644 --- a/tensorflow/lite/micro/examples/person_detection/BUILD +++ b/tensorflow/lite/micro/examples/person_detection/BUILD @@ -1,6 +1,11 @@ # Description: # TensorFlow Lite for Microcontrollers Vision Example. -load("//tensorflow/lite/micro:build_def.bzl", "generate_cc_arrays") +load("//tensorflow/lite/micro:build_def.bzl", + "generate_cc_arrays", + "tflm_cc_binary", + "tflm_cc_library", + "tflm_cc_test", +) package( default_visibility = ["//visibility:public"], @@ -9,7 +14,7 @@ package( licenses = ["notice"], ) -cc_library( +tflm_cc_library( name = "model_settings", srcs = [ "model_settings.cc", @@ -43,7 +48,7 @@ generate_cc_arrays( out = "testdata/person_image_data.h", ) -cc_library( +tflm_cc_library( name = "person_detect_model_data", srcs = [ "//tensorflow/lite/micro/models:generated_person_detect_model_cc", @@ -53,7 +58,7 @@ cc_library( ], ) -cc_library( +tflm_cc_library( name = "simple_images_test_data", srcs = [ ":generated_no_person_bmp_cc", @@ -68,7 +73,7 @@ cc_library( ], ) -cc_test( +tflm_cc_test( name = "person_detection_test", srcs = ["person_detection_test.cc"], deps = [ @@ -84,7 +89,7 @@ cc_test( ], ) -cc_library( +tflm_cc_library( name = "image_provider", srcs = [ "image_provider.cc", @@ -98,7 +103,7 @@ cc_library( ], ) -cc_test( +tflm_cc_test( name = "image_provider_test", srcs = [ "image_provider_test.cc", @@ -111,7 +116,7 @@ cc_test( ], ) -cc_library( +tflm_cc_library( name = "detection_responder", srcs = [ "detection_responder.cc", @@ -125,7 +130,7 @@ cc_library( ], ) -cc_test( +tflm_cc_test( name = "detection_responder_test", srcs = [ "detection_responder_test.cc", @@ -136,7 +141,7 @@ cc_test( ], ) -cc_binary( +tflm_cc_binary( name = "person_detection", srcs = [ "main.cc", diff --git a/tensorflow/lite/micro/kernels/BUILD b/tensorflow/lite/micro/kernels/BUILD index 2924e57e626..31c695336c5 100644 --- a/tensorflow/lite/micro/kernels/BUILD +++ b/tensorflow/lite/micro/kernels/BUILD @@ -1,6 +1,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "string_flag") load("//tensorflow/lite/micro:build_def.bzl", "tflm_cc_library", + "tflm_cc_test", "tflm_copts", "tflm_kernel_cc_library", ) @@ -386,7 +387,7 @@ tflm_kernel_cc_library( # C++ tests #################################### -cc_test( +tflm_cc_test( name = "activations_test", srcs = [ "activations_test.cc", @@ -400,7 +401,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "add_n_test", srcs = [ "add_n_test.cc", @@ -415,7 +416,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "add_test", srcs = [ "add_test.cc", @@ -429,7 +430,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "arg_min_max_test", srcs = [ "arg_min_max_test.cc", @@ -443,7 +444,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "batch_matmul_test", srcs = [ "batch_matmul_test.cc", @@ -457,7 +458,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "batch_to_space_nd_test", srcs = [ "batch_to_space_nd_test.cc", @@ -471,7 +472,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "broadcast_args_test", srcs = [ "broadcast_args_test.cc", @@ -485,7 +486,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "broadcast_to_test", srcs = [ "broadcast_to_test.cc", @@ -499,7 +500,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "call_once_test", srcs = ["call_once_test.cc"], deps = [ @@ -511,7 +512,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "cast_test", srcs = ["cast_test.cc"], deps = [ @@ -524,7 +525,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "ceil_test", srcs = [ "ceil_test.cc", @@ -538,7 +539,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "circular_buffer_test", srcs = [ "circular_buffer_test.cc", @@ -554,7 +555,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "comparisons_test", srcs = [ "comparisons_test.cc", @@ -567,7 +568,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "concatenation_test", srcs = [ "concatenation_test.cc", @@ -580,7 +581,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "conv_test", srcs = [ "conv_test.cc", @@ -596,7 +597,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "cumsum_test", srcs = [ "cumsum_test.cc", @@ -611,7 +612,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "depth_to_space_test", srcs = [ "depth_to_space_test.cc", @@ -626,7 +627,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "depthwise_conv_test", srcs = [ "depthwise_conv_test.cc", @@ -640,7 +641,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "dequantize_test", srcs = [ "dequantize_test.cc", @@ -653,7 +654,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "detection_postprocess_test", srcs = [ "detection_postprocess_test.cc", @@ -669,7 +670,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "div_test", srcs = [ "div_test.cc", @@ -682,7 +683,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "elementwise_test", srcs = ["elementwise_test.cc"], deps = [ @@ -695,7 +696,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "elu_test", srcs = [ "elu_test.cc", @@ -710,7 +711,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "embedding_lookup_test", srcs = [ "embedding_lookup_test.cc", @@ -725,7 +726,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "exp_test", srcs = ["exp_test.cc"], deps = [ @@ -738,7 +739,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "expand_dims_test", srcs = ["expand_dims_test.cc"], deps = [ @@ -751,7 +752,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "fill_test", srcs = [ "fill_test.cc", @@ -765,7 +766,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "floor_div_test", srcs = ["floor_div_test.cc"], deps = [ @@ -778,7 +779,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "floor_mod_test", srcs = ["floor_mod_test.cc"], deps = [ @@ -791,7 +792,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "floor_test", srcs = [ "floor_test.cc", @@ -805,7 +806,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "fully_connected_test", srcs = [ "fully_connected_test.cc", @@ -820,7 +821,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "gather_test", srcs = [ "gather_test.cc", @@ -835,7 +836,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "gather_nd_test", srcs = [ "gather_nd_test.cc", @@ -850,7 +851,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "hard_swish_test", srcs = ["hard_swish_test.cc"], deps = [ @@ -862,7 +863,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "if_test", srcs = ["if_test.cc"], deps = [ @@ -876,7 +877,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "l2norm_test", srcs = [ "l2norm_test.cc", @@ -890,7 +891,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "l2_pool_2d_test", srcs = [ "l2_pool_2d_test.cc", @@ -905,7 +906,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "leaky_relu_test", srcs = [ "leaky_relu_test.cc", @@ -920,7 +921,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "logical_test", srcs = [ "logical_test.cc", @@ -934,7 +935,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "logistic_test", srcs = [ "logistic_test.cc", @@ -948,7 +949,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "log_softmax_test", srcs = [ "log_softmax_test.cc", @@ -963,7 +964,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "lstm_eval_test", srcs = [ "lstm_eval_test.cc", @@ -975,7 +976,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "maximum_minimum_test", srcs = [ "maximum_minimum_test.cc", @@ -989,7 +990,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "mirror_pad_test", srcs = [ "mirror_pad_test.cc", @@ -1003,7 +1004,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "mul_test", srcs = [ "mul_test.cc", @@ -1016,7 +1017,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "neg_test", srcs = [ "neg_test.cc", @@ -1030,7 +1031,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "pack_test", srcs = [ "pack_test.cc", @@ -1044,7 +1045,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "pad_test", srcs = [ "pad_test.cc", @@ -1062,7 +1063,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "pooling_test", srcs = [ "pooling_test.cc", @@ -1075,7 +1076,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "prelu_test", srcs = [ "prelu_test.cc", @@ -1088,7 +1089,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "quantization_util_test", srcs = [ "quantization_util_test.cc", @@ -1100,7 +1101,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "quantize_test", srcs = [ "quantize_test.cc", @@ -1113,7 +1114,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "reduce_test", srcs = [ "reduce_test.cc", @@ -1127,7 +1128,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "reshape_test", srcs = [ "reshape_test.cc", @@ -1142,7 +1143,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "resize_bilinear_test", srcs = [ "resize_bilinear_test.cc", @@ -1156,7 +1157,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "resize_nearest_neighbor_test", srcs = [ "resize_nearest_neighbor_test.cc", @@ -1170,7 +1171,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "round_test", srcs = [ "round_test.cc", @@ -1184,7 +1185,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "select_test", srcs = [ "select_test.cc", @@ -1198,7 +1199,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "shape_test", srcs = ["shape_test.cc"], deps = [ @@ -1210,7 +1211,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "slice_test", srcs = ["slice_test.cc"], deps = [ @@ -1222,7 +1223,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "softmax_test", srcs = [ "softmax_test.cc", @@ -1236,7 +1237,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "space_to_batch_nd_test", srcs = [ "space_to_batch_nd_test.cc", @@ -1250,7 +1251,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "space_to_depth_test", srcs = [ "space_to_depth_test.cc", @@ -1265,7 +1266,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "split_test", srcs = [ "split_test.cc", @@ -1280,7 +1281,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "split_v_test", srcs = [ "split_v_test.cc", @@ -1295,7 +1296,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "squared_difference_test", srcs = [ "squared_difference_test.cc", @@ -1308,7 +1309,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "squeeze_test", srcs = ["squeeze_test.cc"], deps = [ @@ -1320,7 +1321,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "strided_slice_test", srcs = [ "strided_slice_test.cc", @@ -1334,7 +1335,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "sub_test", srcs = [ "sub_test.cc", @@ -1347,7 +1348,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "svdf_test", srcs = [ "svdf_test.cc", @@ -1360,7 +1361,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "tanh_test", srcs = ["tanh_test.cc"], deps = [ @@ -1371,7 +1372,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "transpose_test", srcs = ["transpose_test.cc"], deps = [ @@ -1382,7 +1383,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "transpose_conv_test", srcs = [ "transpose_conv_test.cc", @@ -1398,7 +1399,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "unidirectional_sequence_lstm_test", srcs = [ "unidirectional_sequence_lstm_test.cc", @@ -1415,7 +1416,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "unpack_test", srcs = [ "unpack_test.cc", @@ -1429,7 +1430,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "while_test", srcs = [ "while_test.cc", @@ -1443,7 +1444,7 @@ cc_test( ], ) -cc_test( +tflm_cc_test( name = "zeros_like_test", srcs = ["zeros_like_test.cc"], deps = [ diff --git a/tensorflow/lite/micro/kernels/testdata/BUILD b/tensorflow/lite/micro/kernels/testdata/BUILD index 0c7822d3dd6..2d0e7511145 100644 --- a/tensorflow/lite/micro/kernels/testdata/BUILD +++ b/tensorflow/lite/micro/kernels/testdata/BUILD @@ -1,5 +1,8 @@ load("@rules_python//python:defs.bzl", "py_binary", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") +load("//tensorflow/lite/micro:build_def.bzl", + "tflm_cc_library", +) package( default_visibility = ["//tensorflow/lite/micro/kernels:__pkg__"], @@ -12,14 +15,14 @@ package( # C++ libraries #################################### -cc_library( +tflm_cc_library( name = "conv_test_data", srcs = ["conv_test_data.cc"], hdrs = ["conv_test_data.h"], deps = ["//tensorflow/lite/c:common"], ) -cc_library( +tflm_cc_library( name = "lstm_test_data", srcs = ["lstm_test_data.cc"], hdrs = [ diff --git a/tensorflow/lite/micro/testing/BUILD b/tensorflow/lite/micro/testing/BUILD index 7a246990a23..d55975774ed 100644 --- a/tensorflow/lite/micro/testing/BUILD +++ b/tensorflow/lite/micro/testing/BUILD @@ -1,5 +1,9 @@ load("@rules_python//python:defs.bzl", "py_binary", "py_library") load("@tflm_pip_deps//:requirements.bzl", "requirement") +load("//tensorflow/lite/micro:build_def.bzl", + "tflm_cc_library", + "tflm_cc_test", +) load( "//tensorflow:extra_rules.bzl", "tflm_kernel_friends", @@ -26,7 +30,7 @@ package_group( packages = tflm_kernel_friends(), ) -cc_library( +tflm_cc_library( name = "micro_test", hdrs = [ "micro_test.h", @@ -46,7 +50,7 @@ cc_library( ], ) -cc_test( +tflm_cc_test( name = "util_test", srcs = [ "util_test.cc", @@ -56,7 +60,7 @@ cc_test( ], ) -cc_library( +tflm_cc_library( name = "test_conv_model", srcs = [ "test_conv_model.cc", diff --git a/tensorflow/lite/micro/tools/benchmarking/BUILD b/tensorflow/lite/micro/tools/benchmarking/BUILD index 6691ac31814..3bc3268c2ea 100644 --- a/tensorflow/lite/micro/tools/benchmarking/BUILD +++ b/tensorflow/lite/micro/tools/benchmarking/BUILD @@ -1,11 +1,16 @@ -cc_library( +load("//tensorflow/lite/micro:build_def.bzl", + "tflm_cc_binary", + "tflm_cc_library", +) + +tflm_cc_library( name = "op_resolver", hdrs = ["op_resolver.h"], visibility = ["//tensorflow/lite/micro/tools:__subpackages__"], deps = ["//tensorflow/lite/micro:op_resolvers"], ) -cc_library( +tflm_cc_library( name = "metrics", srcs = ["metrics.cc"], hdrs = ["metrics.h"], @@ -17,7 +22,7 @@ cc_library( ], ) -cc_library( +tflm_cc_library( name = "generic_benchmark_lib", srcs = ["generic_model_benchmark.cc"], hdrs = ["show_meta_data.h"], @@ -37,7 +42,7 @@ cc_library( ], ) -cc_binary( +tflm_cc_binary( name = "tflm_benchmark", deps = [":generic_benchmark_lib"], ) diff --git a/tensorflow/lite/micro/tools/gen_micro_mutable_op_resolver/templates/BUILD.mako b/tensorflow/lite/micro/tools/gen_micro_mutable_op_resolver/templates/BUILD.mako index a26b5c16d15..c6531199936 100644 --- a/tensorflow/lite/micro/tools/gen_micro_mutable_op_resolver/templates/BUILD.mako +++ b/tensorflow/lite/micro/tools/gen_micro_mutable_op_resolver/templates/BUILD.mako @@ -3,6 +3,7 @@ load( "//tensorflow/lite/micro:build_def.bzl", "generate_cc_arrays", + "tflm_library", "tflm_cc_test", ) @@ -61,7 +62,7 @@ tflm_cc_library( ], ) -cc_library( +tflm_cc_library( name = "gen_micro_op_resolver", hdrs = ["gen_micro_mutable_op_resolver.h",], visibility = ["//visibility:public"], diff --git a/tensorflow/lite/micro/tools/project_generation/BUILD.testing b/tensorflow/lite/micro/tools/project_generation/BUILD.testing index 088b19ca127..bc7b030c936 100644 --- a/tensorflow/lite/micro/tools/project_generation/BUILD.testing +++ b/tensorflow/lite/micro/tools/project_generation/BUILD.testing @@ -1,10 +1,15 @@ # standalone BUILD file used to test project generation with bazel. +# +load("//tensorflow/lite/micro:build_def.bzl", + "tflm_cc_library", + "tflm_copts", +) -cc_library( +tflm_cc_library( name = "libtflm", srcs = glob(["tensorflow/**/*.cc", "tensorflow/**/*.c", "third_party/**/*.cc", "third_party/**/*.c"]), hdrs = glob(["tensorflow/**/*.h", "third_party/**/*.h"]), - copts = [ + copts = tflm_copts() + [ "-Ithird_party/gemmlowp", "-Ithird_party/flatbuffers/include", "-Ithird_party/kissfft",