1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_oss_build_kwargs", "runtime") 2 3SIZE_TEST_SOURCES = [ 4 "size_test.cpp", 5] 6 7SIZE_TEST_DEPS = [ 8 "//executorch/runtime/executor:program", 9 "//executorch/extension/data_loader:file_data_loader", 10] 11 12def define_common_targets(): 13 """Defines targets that should be shared between fbcode and xplat. 14 15 The directory containing this targets.bzl file should also contain both 16 TARGETS and BUCK files that call this function. 17 """ 18 19 # DO NOT MODIFY: This target `size_test_static` is being used on a per-diff 20 # CI job to guard Executorch binary size. It doesn't contain any operators 21 # or kernels thus shouldn't be used to run a model. Adding/removing dependencies 22 # will likely result in inaccurate measure results. 23 # 24 # It's also best to build this with `-c executorch.enable_program_verification=false` 25 # to remove ~30kB of optional flatbuffer verification code from the binary. 26 # Building with `-c executorch.enable_et_log=0` removes ~15kB from the binary. 27 runtime.cxx_binary( 28 name = "size_test", 29 srcs = SIZE_TEST_SOURCES, 30 deps = SIZE_TEST_DEPS, 31 define_static_target = True, 32 **get_oss_build_kwargs() 33 ) 34 35 runtime.cxx_binary( 36 name = "size_test_all_ops", 37 srcs = SIZE_TEST_SOURCES, 38 deps = SIZE_TEST_DEPS + [ 39 "//executorch/kernels/portable:generated_lib", 40 "//executorch/runtime/executor/test:test_backend_compiler_lib", 41 ], 42 define_static_target = True, 43 **get_oss_build_kwargs() 44 ) 45 46 runtime.export_file( 47 name = "size_test.cpp", 48 visibility = [ 49 "@EXECUTORCH_CLIENTS", 50 ], 51 ) 52